X3DObject.Primitives

X3DObject.Primitives

説明

このオブジェクトを構成する各プリミティブの Primitive オブジェクトを含む PrimitiveCollection を戻します。

C#構文

// get accessor

PrimitiveCollection rtn = X3DObject.Primitives;

1. JScript の例

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 の例

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 の例

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