AddPortGroup (CustomOperator)

Introduced

4.0

Description

Creates and returns a new PortGroup for the custom operator.

Normal custom operators only need a single PortGroup, but dynamic operators should create a separate PortGroup for any input ports that need to be connected dynamically or with multiple instances.

Note: If the operator has branch group support, then the filter must also match the group as an allowed component. Otherwise, groups will be rejected when Operator.Connect is called.

Scripting Syntax

CustomOperator.AddPortGroup( Name, [Min], [Max], [Filter], [PickPrompt], [Flags] )

C# Syntax

PortGroup CustomOperator.AddPortGroup( String Name, Int32 groupmin, Int32 groupmax, String filterid, String PickPrompt, Int32 Flags );

Parameters

Parameter

Type

Description

Name

String

Name of the port

Min

Long

Minimum objects required for a valid connection.

Default Value: 1

Max

Long

Minimum objects required for a valid connection.

Default Value: 1

Filter

String

Filter to be used to determine whether object can be connected to group.

Default Value: "" (filter not defined)

PickPrompt

String

The string displayed in the status bar during a picking session for picking objects to be connected to the operator.

Default Value: "" (pick prompt not defined)

Flags

Long

Mask of port group flags (Not Implemented).

Default Value: 0 (flags not defined)

Return Value

Returns the newly created PortGroup object.

Examples

JScript Example

/*
   This example illustrates how to use the AddPortGroup method to define 
   a PortGroup. Use this method if you want to determine the number
   of objects that can be connected to the group or restrict the 
   types of objects connecting to the group by using a filter.
*/
NewScene( null, false );
var obj = CreatePrim( "Cube", "MeshSurface");

var sop = XSIFactory.CreateScriptedOp( "MyOperator", MyOperator_Update.toString(), "JScript" )

var group = sop.AddPortGroup( "MainGroup", 1, 1, siPolyMeshFilter, "please pick a polygon mesh" );

sop.AddIOPort( obj.ActivePrimitive, "", group.Index );

sop.Connect();

// The operator's update function
function MyOperator_Update( ctx, out, in1 ) 
{
   Application.LogMessage( "MyOperator_Update: " + out.Value );
   var aPos = in1.Value.Geometry.Points.PositionArray.toArray();
   out.Value.Geometry.Points.PositionArray = aPos;
}


Autodesk Softimage v7.5