GetConnectionSet
 
 
 

GetConnectionSet

Introduced

v1.0

Description

Returns the connection set group specifying an operator's input objects. When used with ApplyOp and ApplyOperator, it allows picking objects to apply an operator to if no input objects are supplied by the caller, or if secondary objects are required.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference. Normally you can get the output arguments via either XSIApplication.ExecuteCommand method (C#) or the ISIVTCollection (scripting languages), but this command already returns a value.

The only available workaround in this case is to create a VBScript custom command which returns both the output arguments and the return value in one array. For details, see What Happens when the Function Already Returns a Value?.

Scripting Syntax

oReturn = GetConnectionSet( PresetObj, [ConnectionSet], [CnxGroupType], [ConnectType], [Interactive], [CreateOutputObjs], [OutputObjs] );

Return Value

Returns an XSICollection that contains a list of the connection sets created.

Parameters

Parameter Type Description
PresetObj String or a preset object (for example, an object obtained from SIGetPreset) An Operator Preset.
ConnectionSet ConnectionSet Specifies the objects connected to an operator.

Note: Because this is an in/out parameter, any string (variable or value) you pass into this parameter is automatically converted to a ConnectionSet object.

Default Value: Current selection.

Warning: An error occurs if the connection set is invalid. Please verify the connection set required for this operator to avoid breaking your scripts.

CnxGroupType siCnxSetType Type of output connection set required.

Default Value: siGroupLevel

ConnectType siBranchFlag Specifies the type of connection (node or branch).

Default Value: siUnspecified

Interactive Boolean True to prompt user to pick objects, if ConnectionSet wasn't specified, or if there is nothing selected.

Default Value: False

CreateOutputObjs Boolean True to create output primitive objects required by the operator.

Default Value: False

OutputObjs XSICollection Returns the primitives created by the operator. For example, Loft creates a primitive surface.

Examples

VBScript Example

'
' Apply a simple Twist operator on a sphere:
set oSphere = CreatePrim( "Sphere", "MeshSurface" )
set cnxsetlist = GetConnectionSet( "Twist", oSphere, siGroupLevel )
set TwistOp = ApplyOperator( "Twist", cnxsetlist(0) )
Application.LogMessage "New Twist operator: " & TwistOp
' Prepare to create apply a Loft operator
oCircle = CreatePrim( "Circle", "NurbsCurve" )
Rotate oCircle, 0, 90, 0
Duplicate oCircle , 2, 2, 1, 1, 0, 0, 1, 0, 1, , , , , , , 1.0
AddToSelection oCircle
' Now, apply a Loft on the current selection (3 circles).
' We've requested that GetConnectionSet generates the output surface.
set cnxsetlist = GetConnectionSet( "Loft", , siGroupLevel, , , True, SrfMshObjCreated )
if cnxsetlist.Count <> 0 then
        LoftOp = ApplyOperator( "Loft", cnxsetlist(0) & ";" & SrfMshObjCreated )
        LogMessage "New Loft operator: " & LoftOp
end if
' By deselecting all curves before calling GetConnectionSet,
' we could have set the "Interactive" argument to True so that
' the user is then requested to pick the curves as input to the Loft operator.
' Running this script should log the following:
' ---------------------------------------------
'INFO : "New Twist operator: sphere.polymsh.twistop"
'INFO : "New Loft operator: surfmsh.surfmsh.loft"

See Also

ApplyOperator ApplyOp