ISch_RobotManager interface
The ISch_RobotManager interface represents an object that can send Schematic messages into the Schematic Editor server from your extension to update the sub-systems such as the Undo system.
public interface ISch_RobotManager
Namespace: SCH · Assembly: Altium.SDK.Interfaces
Remarks
Part of ISch_ServerInterface object interface
Methods
| Method | Returns | Description |
|---|---|---|
| SendMessage | void | The SendMessage method sends a message into Schematic Editor notifying that the data structures need to be updated and synchronized. |
| SendMessageByHandle | void |
SendMessage
The SendMessage method sends a message into Schematic Editor notifying that the data structures need to be updated and synchronized. It could be an object being modified, added or deleted from the schematic document.
void SendMessage(ISch_BasicContainer argSource, ISch_BasicContainer argDestination, ushort argMessageID, ISch_BasicContainer argMessageData);
void SendMessage(object argSource, object argDestination, ushort argMessageID, object argMessageData);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argSource | ISch_BasicContainer | value | |
argDestination | ISch_BasicContainer | value | Normally the SCHConstant.BroadCast value, when an object is being modified, added or removed. |
argMessageID | ushort | value | Normally when an object is being modified, the SCHConstant.SCHMPrimitiveRegistration value. Normally when a new object is being added, the SCHConstant.SCHMBeginModify and SCHConstant.SCHMEndModify values. Normally when an object is being removed, the SCHConstant.SCHMPrimitiveRegistration value. |
argMessageData | ISch_BasicContainer | value | Normally when a new object is being added, the SCHConstant.NoEventData value. |
Returns: nothing (void)
The first overload is an extension method of ISch_RobotManagerHelper (using SCH;) with typed parameters; the second is declared by the interface.
Example: Change the color of the wires on the current sheet, with undo support.
using DXP;
using SCH;
ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document document = schServer?.GetCurrentSchDocument();
if (document == null)
return;
IProcessControl processControl = DXP.GlobalVars.Client.GetProcessControl();
ISch_RobotManager robotManager = schServer.GetState_RobotManager();
// Initialize the robots in the schematic editor.
processControl.PreProcess(document, "");
ISch_Iterator iterator = document.SchIterator_Create();
if (iterator == null)
return;
iterator.AddFilter_ObjectSet(new SCH.TObjectSet { TObjectId.ePort, TObjectId.eWire });
try
{
for (var anObject = iterator.FirstSchObject() as ISch_GraphicalObject; anObject != null; anObject = iterator.NextSchObject() as ISch_GraphicalObject)
{
if (anObject.GetState_ObjectId() != TObjectId.eWire)
continue;
robotManager.SendMessage(anObject, SCHConstant.BroadCast, SCHConstant.SCHMBeginModify, SCHConstant.NoEventData);
anObject.SetState_Color(0x0000FF); // red, in BGR format
robotManager.SendMessage(anObject, SCHConstant.BroadCast, SCHConstant.SCHMEndModify, SCHConstant.NoEventData);
}
}
finally
{
document.SchIterator_Destroy(ref iterator);
}
// Clean up the robots in the schematic editor.
processControl.PostProcess(document, "");
Examples: Extension_ModifySchWireColor
SendMessageByHandle
No description yet.
void SendMessageByHandle(string argSource, string argDestination, ushort argMessageID, string argMessageData);
| Parameter | Type | Passing |
|---|---|---|
argSource | string | value |
argDestination | string | value |
argMessageID | ushort | value |
argMessageData | string | value |
Returns: nothing (void)
Returned by
ISch_ServerInterface.RobotManager
Examples
Used in the SDK examples: Extension_ModifySchWireColor.