PortGroupCollection
 
 
 

PortGroupCollection

Introduced

v4.0

Description

A collection of PortGroup objects that represent the port groups defined by an Operator object. This collection is 0-based.

Methods

Filter Find GetAsText  
       

Properties

Count operator Item operator    
       

Examples

JScript Example

// This example illustrates how to browse the port groups
// of an operator.
newscene( null, false );
CreatePrim("Cylinder", "MeshSurface", null, null);
var col = ApplyOp("Shear", "cylinder", 3, siPersistentOperation);
var op = col(0);
dump_portgroups(op);
function dump_portgroups(op)
{
        if ( ! op.belongsto("Operators") )
                return;
        var ePortGroups = new Enumerator(op.portgroups);
        for ( ; ! ePortGroups.atEnd(); ePortGroups.moveNext() )
        {
                var portgroup = ePortGroups.item();
                var str = ""; 
                str += "group name: " + portgroup.name;
                str += ", type: " + portgroup.type;
                str += ", parent: " + portgroup.parent;
                str += ", index: " + portgroup.index;
                str += ", flags: " + portgroup.flags;
                str += ", min: " + portgroup.min;
                str += ", max: " + portgroup.max;
                str += ", filter: " + portgroup.filter;
                str += ", pickprompt: " + portgroup.pickprompt;
                str += ", optional: " + portgroup.isoptional();
                str += ", branchgroup: " + portgroup.SupportsBranchGroup();
                logmessage( str ); 
                var ePorts = new Enumerator(portgroup.ports);
                for ( ; ! ePorts.atEnd(); ePorts.moveNext() )
                {
                        var port = ePorts.item();
                        dump_port(port);
                }
        }
}       
function dump_port(port)
{       
        var str = "";
        str += "port name: " + port.name;
        str += ", type: " + port.type;
        str += ", porttype: " + port.porttype;
        str += ", connected: " + port.isconnected;
        if ( port.isconnected)
                str += ", target: " + port.target2; 
        str += ", parent: " + port.parent;
        str += ", index: " + port.index;
        str += ", flags: " + port.flags;
        if ( port.type == "InputPort" )
                str += ", optional: " + port.optional;
        if ( port.type == "OutputPort" )
                str += ", created: " + port.created;
        str += ", branchgroup: " + port.BranchGroup;
        str += ", groupname: " + port.groupname;
        str += ", groupindex: " + port.groupindex;
        str += ", groupinstance: " + port.groupinstance;
        logmessage( str ); 
}

See Also

Operator.PortGroups