Finds and returns the specified Port
object for the operator. PortGroup and PortGroupInstance (index)
arguments are ignored for scripted operators created using the
scripted operator editor (also known as runtime scripted
operators). For all other types of operators if PortGroup and
PortGroupInstance are not specified, the first port found with the
given Name is returned.
Note: Python does not support input parameters on properties, so
this property will fail in Python. Use the Operator.GetPort2 method instead.
// get accessor Port Operator.get_Port( String in_bstrPort, String in_bstrPortGroup, Int32 in_lPortGroupInstance ); |
Parameter | Type | Description |
---|---|---|
Name | String | Name of a port |
PortGroup | String | Name of a port group.
Default Value: "" (empty string) |
PortGroupInstance | Long | The port group instance index. This argument does not apply to
runtime operators. If you don't provide a port group this argument
is ignored.
Default Value: 0 |
/* The following code illustrates how to get the port from an operator if you know its name. */ NewScene( null, false ); var oObject = ActiveSceneRoot.AddGeometry("Sphere","MeshSurface"); apply_deform( oObject ); var oDeformOperator = oObject.ActivePrimitive.ConstructionHistory.Find( "MyDeform" ); var oPort = oDeformOperator.Port("InGeom","MainGroup",0); var oInputGeometry = oPort.Target2; Application.LogMessage( oDeformOperator.Name + " is reading from the " + oInputGeometry.FullName ); function apply_deform( oObject ) { var op = XSIFactory.CreateScriptedOp( "MyDeform", MyDeform_Update.toString(), "JScript" ); // Define connections var group = op.AddPortGroup( "MainGroup" ); var ioport = op.AddIOPort( oObject.ActivePrimitive, "Geom", group.Index ); // Define parameters var pdef = XSIFactory.CreateParamDef2( "Factor", siDouble, 0.5, 0, 1 ); op.addparameter(pdef); // Connect operator op.Connect(oObject); } function MyDeform_Update( ctx, out, InGeom ) { // Get the factor. var dFactor = ctx.Parameters("Factor").Value // Get the array of point positions. var aPnts = InGeom.Value.Geometry.Points.PositionArray.toArray(); // Deform geometry // Update the object//s point positions. out.Value.Geometry.Points.PositionArray = aPnts; return; } // |