GetNumPortsInGrou p (Operator) *

Introduced

3.0

Description

Returns the number of Ports in a PortGroup. Returns -1 if there is a failure.

Scripting Syntax

    Operator.GetNumPortsInGroup( PortGroupIndex )

C# Syntax

    Int32 Operator.GetNumPortsInGroup( Int32 in_lPortGroupIndex );

Parameters

Parameter | Type | Description
PortGroupIndex | Long | Port.GroupIndex

Return Value

Long

Examples

JScript Example

    /*
       This example illustrates how to get the number of ports within operator's
       port groups.
    */
    NewScene( null, false );

    var sphere = CreatePrim( "Sphere", "MeshSurface" );
    var cube = CreatePrim( "Cube", "MeshSurface" );
    cube.posx.Value = 3;
    cube.posy.Value = 3;

    var objs_array = new Array(2);
    objs_array[0] = cube;
    objs_array[1] = sphere;

    // Boolean difference grid
       ApplyOp( "BooleanGenDifference", objs_array );

    // Get generated mesh from selection
    var mesh = selection(0);

    // Get boolean operator from cube's construction history
    var e = new Enumerator(mesh.ActivePrimitive.ConstructionHistory);

    var op;
    for ( ; !e.atEnd(); e.moveNext() )
    if ( e.item().Type == "booleangen" )
    {
    op = e.item();
    break;
    }

    // Print the number of ports in each group
    Application.LogMessage( op.Name + ": num port groups = " + op.GetNumPortGroups() );
    for ( var i=0; i<op.GetNumPortGroups(); i++ )
    Application.LogMessage( op.Name + ": num ports in group " + i + " = " + op.GetNumPortsInGroup(i) );

    //INFO : "Boolean Generator: num port groups = 3"
    //INFO : "Boolean Generator: num ports in group 0 = 2"
    //INFO : "Boolean Generator: num ports in group 1 = 2"
    //INFO : "Boolean Generator: num ports in group 2 = 2"

Autodesk Softimage v7.5