## AddPortToICENode2

### Introduced

v11.0 (2013)

### Description

Adds a new port at the specified location and returns an XSICollection of new port object(s). Most of the time the collection will contain only one port. However, when a port group instance is added then the collection may contain multiple ports.

### Scripting Syntax

    oReturn = AddPortToICENode2( Port, [InsertLocation] );

### Return Value

XSICollection of new port object(s). If you add input port(s), a collection of ICENodeInputPort is returned. If you add output port(s), a collection of ICENodeOutputPort is returned.

### Parameters

Parameter | Type | Description
--- | --- | ---
Port | String | The port after or before which to add the new port. The port full name needs to be specified.
InsertLocation | siNodePortDataInsertionLocation | The relative location where the port will be added. Default Value: siNodePortDataInsertionLocationBefore

### Examples

#### Python Example

    #

    # Basic examples to demonstrate how to use AddPortToICENode2.

    #

    from sipyutils import *

    si = si()

    si.NewScene("", "")

    si.CreatePrim("Cone", "MeshSurface", "", "")

    si.ApplyOp("ICETree", "cone", "siNode", "", "", 0)

    si.AddICENode("$XSI_DSPRESETS\\ICENodes\\BlendNode.Preset", "cone.polymsh.ICETree")

    # Add a new port group instance

    ports = si.AddPortToICENode2("cone.polymsh.ICETree.BlendNode.value2", C.siNodePortDataInsertionLocationAfter )

    for p in ports:

    	logf( '%s: %s', si.ClassName( p ), p )

    # Output

    # INFO : ICENodeInputPort: cone.polymsh.ICETree.BlendNode.value3

    # INFO : ICENodeInputPort: cone.polymsh.ICETree.BlendNode.weight3

    # Add a new port

    si.AddICENode("$XSI_DSPRESETS\\ICENodes\\BuildArrayNode.Preset", "cone.polymsh.ICETree")

    ports = si.AddPortToICENode2("cone.polymsh.ICETree.BuildArrayNode.value1", C.siNodePortDataInsertionLocationBefore )

    for p in ports:

    	logf( '%s: %s', si.ClassName( p ), p )

    # Output

    # INFO : ICENodeInputPort: cone.polymsh.ICETree.BuildArrayNode.value1

### See Also

AddAttributeToSetDataICENode AddICECompoundNode AddExposedParamToICECompoundNode AddICENode AddNodeToICECompoundNode CleanDisconnectedICENodes ConnectICENodes CreateICECompoundNode DisconnectICENodePort EditExposedParamInICECompoundNode ExplodeICECompoundNode RemoveAttributeFromSetDataICENode RemoveExposedParamFromICECompoundNode RemoveNodeFromICECompoundNode RemovePortFromICENode