Primitives (X3DObject)

Description

Returns a PrimitiveCollection containing one Primitive object for each primitive making up this object.

C# Syntax

    // get accessor
    PrimitiveCollection rtn = X3DObject.Primitives;

Examples

1. JScript Example

    var oCone = Application.ActiveSceneRoot.AddGeometry( "Cone", "MeshSurface" );
    var oPrims = oCone.Primitives;

    Application.LogMessage( oPrims.Type );
    Application.LogMessage( "Number of primitives : " + oPrims.Count );

    for ( var i=0 ; i<oPrims.Count ; i++ ) {
       oPrim = oPrims.Item(i);
       Application.LogMessage( "Primitive " + i + " " + oPrim.FullName );
    }

    // Expected results:
    //INFO : Number of primitives : 2
    //INFO : Primitive 0 cone.cone
    //INFO : Primitive 1 cone.polymsh

2. Python Example

    root = Application.ActiveSceneRoot
    obj = root.AddGeometry( "Torus", "NurbsSurface", "Magic" )
    prims = obj.Primitives

    Application.LogMessage( Application.ClassName(prims) )
    Application.LogMessage( "Number of primitives : " + str(prims.Count) )

    idx = 0
    for p in prims :
       Application.LogMessage( "Primitive " + str(idx) + " " + p.FullName );
       idx = idx + 1

    # Expected results:
    #INFO : PrimitiveCollection
    #INFO : Number of primitives : 2
    #INFO : Primitive 0 Magic.torus
    #INFO : Primitive 1 Magic.surfmsh

3. VBScript Example

    set oRoot = Application.ActiveProject.ActiveScene.Root
    set oPrims = oRoot.Primitives
    Application.LogMessage TypeName(oPrims)
    Application.LogMessage "Number of primitives : " & oPrims.Count
    for each oPrim in oPrims
       Application.LogMessage oPrim.Name
    next

    ' Expected results:
    'INFO : PrimitiveCollection
    'INFO : Number of primitives : 0

Autodesk Softimage v7.5