## CustomOperator.AddIOPortByClassID

### Introduced

v5.1

### Description

Adds an InputPort and an OutputPort to the custom operator. This method makes it possible to define a connection to a custom operator by specifying the type of object it needs to connect to, rather than providing an actual existing object as is the case in CustomOperator.AddIOPort. This is for use in advanced operators, where the port may be optional and dynamically connected after the operator is instantiated.

### C# Syntax

    PortCollection CustomOperator.AddIOPortByClassID( siClassID in_TargetClassID, String in_PortName, Int32 in_portgroup, Int32 in_flags );

### Scripting Syntax

    oReturn = CustomOperator.AddIOPortByClassID( TargetClassID, [PortName], [PortGroup], [Flags] );

### Return Value

Returns the newly created input and output ports in a PortCollection object.

### Parameters

Parameter | Type | Description
--- | --- | ---
TargetClassID | siClassID | Type of object that can connect to this object, for example siKinematicStateID, siClusterPropertyID, siParameterID or siPrimitiveID.
PortName | String | The name of the ports. If a name is not specified then the names of the input and output ports are created automatically. The input port has "In" prefixed to the name plus the Parameter.ScriptName of the object connected to the port. The output port is the same but with the prefix "Out". Default Value: "" (empty string)
PortGroup | Long | Index of the port group. Default Value: -1 (add to end of port groups)
Flags | Long | Mask of port group flags described by siPortFlags. Default Value: 0

### See Also

CustomOperator.AddIOPort CustomOperator.AddInputPortByClassID Operator.ConnectToGroup