
# 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.

```csharp
public interface ISch_RobotManager
```

**Namespace:** SCH · **Assembly:** Altium.SDK.Interfaces

## Remarks

Part of [`ISch_ServerInterface`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_ServerInterface.md) object interface

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [SendMessage](#sendmessage) | `void` | The `SendMessage` method sends a message into Schematic Editor notifying that the data structures need to be updated and synchronized. |
| [SendMessageByHandle](#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.

```csharp
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](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_BasicContainer.md) | value |  |
| `argDestination` | [ISch_BasicContainer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_BasicContainer.md) | value | Normally the [`SCHConstant.BroadCast`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/SCHConstant.md#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](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_BasicContainer.md) | value | Normally when a new object is being added, the [`SCHConstant.NoEventData`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/SCHConstant.md#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.

```csharp
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](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_ModifySchWireColor/Source%20Code/Commands.cs#L49)

### SendMessageByHandle

*No description yet.*

```csharp
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](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_ServerInterface.md#robotmanager)

## Examples

Used in the SDK examples: [Extension_ModifySchWireColor](https://github.com/AltiumDeveloper/ad-sdk-examples/blob/5b144f54740a53ec578b3b6c3f902b831e0b1144/Extension_ModifySchWireColor/Source%20Code/Commands.cs#L47).
