Introduced
3.0
Description
Returns the specified Port object.
Note: Regardless of the order that ports are added to a Group, input ports are always indexed before output ports. For example, if a custom operator is built with two output ports A and B and two input ports C and D then port 0 will be C, port 1 will be D, port 2 will be A and port 3 will be B.
Scripting Syntax
Operator.PortAt( PortIndex, PortGroupIndex, PortGroupInstance )
C# Syntax
Port Operator.PortAt( Int32 in_lPortIndex, Int32 in_lPortGroupIndex, Int32 in_lPortGroupInstance );Parameters
|
Parameter |
Type |
Description |
|
PortIndex |
Port index. |
|
|
PortGroupIndex |
Port group index. |
|
|
PortGroupInstance |
Port group instance index. |
Return Value
Examples
JScript Example
/* This example illustrates how to generate a mesh by using the loft operator and a number of input curves. The code also illustrates how to traverse the operator's port group, port group instances and ports and logs the name of the port, its type and the full path name of the object connected to the port. */ NewScene( null, false ); var arc = Application.ActiveSceneRoot.AddGeometry( "Arc", "NurbsCurve" ); // Duplicate arc 4 times and translate in y var args = new Array(19); args[0] = arc; // source object args[1] = 4; // number of copies args[9] = siApplyRepeatXForm; // Xform args[18] = 1; // Ty var objs = Application.ExecuteScriptCommand( "Duplicate", args ); // Create array containing arc and duplicates var aobjs = new Array(5) aobjs[0] = arc; for ( var i = 0; i < objs.count; i++ ) aobjs[i+1] = objs(i); // Apply loft operator var op = ApplyOp( "Loft", aobjs )(0); // Traverse port group, instances and ports and log port connections // For each port group ... for ( var idxGroup = 0; idxGroup < op.GetNumPortGroups(); idxGroup++ ) { // For each instance in a port group ... for ( var idxInstance = 0; idxInstance < op.GetNumInstancesInGroup( idxGroup ); idxInstance++ ) { // For each port in a port group instance ... for ( var idxPort = 0; idxPort < op.GetNumPortsInGroup( idxGroup ); idxPort++ ) { // Get a specific port var port = op.PortAt( idxPort, idxGroup, idxInstance ); // If the port is an input port ... if ( port.PortType == siPortInput ) porttypestr = "input" else if ( port.PortType == siPortOutput ) porttypestr = "output" else porttypestr = "error" var target = port.target2; // ... and the connected type is an object connection if ( typeof(target) == "object" ) { Application.LogMessage( op.Name + " group:" + port.groupindex + " " + " instance:" + port.GroupInstance + " " + porttypestr + "port:" + port.Index + ":" + target.FullName ); } } } } //INFO : "Loft group:0 instance:0 inputport:0:arc.crvlist" //INFO : "Loft group:0 instance:0 inputport:1:arc.kine.global" //INFO : "Loft group:0 instance:1 inputport:0:arc1.crvlist" //INFO : "Loft group:0 instance:1 inputport:1:arc1.kine.global" //INFO : "Loft group:0 instance:2 inputport:0:arc2.crvlist" //INFO : "Loft group:0 instance:2 inputport:1:arc2.kine.global" //INFO : "Loft group:0 instance:3 inputport:0:arc3.crvlist" //INFO : "Loft group:0 instance:3 inputport:1:arc3.kine.global" //INFO : "Loft group:0 instance:4 inputport:0:arc4.crvlist" //INFO : "Loft group:0 instance:4 inputport:1:arc4.kine.global" //INFO : "Loft group:1 instance:0 inputport:0:surfmsh.kine.global" //INFO : "Loft group:1 instance:0 outputport:1:surfmsh.surfmsh"
See Also
Autodesk Softimage v7.5