Operator.GetNumPortGroups operator

導入

v3.0

詳細

PortGroupの数を戻します(問題が発生した場合は、-1を戻します)。ポートグループを定義しないオペレータ(つまり、スクリプトオペレータエディタ、またはエクスプレッションエディタで作成されたオペレータ)の場合は、ポートグループの数は 1とレポートされます。これは厳密には正しくありませんが、ポートにアクセスするための一般的なコードは記述できます(例についてはOperatorオブジェクトを参照)。

PortGroupCollection.Countプロパティ(Operator.PortGroupsからアクセス可能)では 0が戻されます。

C#構文

Int32 Operator.GetNumPortGroups();

スクリプト構文

oLong = Operator.GetNumPortGroups();

戻り値

Long

JScript の例

/*

	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 );

CreatePrim( "Grid", "NurbsSurface" );

// Bend grid	

ApplyOp( "Bend", grid );

// Get grid from selection

var grid = selection(0);

// Get bend operator from the grid's construction history

var e = new Enumerator( grid.ActivePrimitive.ConstructionHistory );

var op;

for ( ; ! e.atEnd(); e.moveNext() )

if ( e.item().type == "bendop" )

{

op = e.item();

break;

}

// Print the number of port groups defined by the bend operator

Application.LogMessage( op.Name + ": num port groups = " + op.GetNumPortGroups() );

// Expected result:

// INFO : "Bend Op: num port groups = 1"