Operator.GetNumPortsInGroup operator

導入

v3.0

詳細

PortGroup内のPortの数を戻します。問題が発生した場合は、-1 が戻されます。

C#構文

Int32 Operator.GetNumPortsInGroup( Int32 in_lPortGroupIndex );

スクリプト構文

oLong = Operator.GetNumPortsInGroup( PortGroupIndex );

戻り値

Long

パラメータ

パラメータ タイプ 説明
PortGroupIndex Long Port.GroupIndex

JScript の例

/*

	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"