## CustomOperator.AddInputPort

### Introduced

v4.0

### Description

Adds an InputPort to the custom operator.
Note: When defining a CustomOperator it is good practice to add the output ports before the input ports. This enables Softimage to correctly identify I/O ports.

### C# Syntax

    InputPort CustomOperator.AddInputPort( Object in_PortTarget, String in_PortName, Int32 in_portgroup, Int32 in_InsertAt, Int32 in_flags );

### Scripting Syntax

    oReturn = CustomOperator.AddInputPort( PortTarget, [PortName], [PortGroup], [InsertAt], [Flags] );

### Return Value

The newly created InputPort.

### Parameters

Parameter | Type | Description
--- | --- | ---
PortTarget | Variant | Object or full name of the object to connect to the port. Softimage will remember the full name of the object, but this can be overridden at connection time to connect to a different object (see Operator.Connect and Operator.ConnectToGroup).
PortName | String | Name of the port Default Value: The default name is "In" + the Parameter.ScriptName of the object being connected, for example "Inposx".
PortGroup | Long | Index of the port group. Default Value: -1
InsertAt | Long | Index of the port at a specific index. (Not Implemented) Default Value: -1
Flags | Long | Mask of port group flags described by siPortFlags. Default Value: 0

### Examples

#### JScript Example

    /*

    	This example illustrates how to use the AddInputPort method to define

    	an input port.

    */

    NewScene( null, false );

    var obj = CreatePrim( "Cube", "MeshSurface");

    var sop = XSIFactory.CreateScriptedOp( "MyOperator", MyOperator_Update.toString(), "JScript" )

    var group1 = sop.AddPortGroup( "MainGroup" );

    sop.AddOutputPort( obj.ActivePrimitive, "OutPolygonMesh", group1.Index );

    sop.AddInputPort( "cube.polymsh", "InPolygonMesh", group1.Index );

    sop.Connect();

    // The operator's update function

    function MyOperator_Update( ctx, out, in1 )

    {

    	Application.LogMessage( "MyOperator_Update: " + out.Value );

    	var aPos = in1.Value.Geometry.Points.PositionArray.toArray();

    	out.Value.Geometry.Points.PositionArray = aPos;

    }

### See Also

CustomOperator.AddInputPortByClassID AddCustomOp