AddPrimitive (X3DObject)
Description
Creates and adds a new primitive as a child of the current X3DObject. The term 'primitive' in this sense means the basic (implicit) shape without details of the geometry. This means that you can use this method to create Implicit Shapes, but X3DObject.AddGeometry is needed to create Geometric Shapes.
Scripting Syntax
X3DObject.AddPrimitive( Preset, [Name] )
C# Syntax
X3DObject X3DObject.AddPrimitive( Object in_primPreset, String in_name );Parameters
|
Parameter |
Type |
Description |
|
Preset |
Any preset in the Alphabetical Listing of All Primitive Presets (for example, "Sphere", "Camera", "Wave", etc.) |
|
|
Name |
Name of child |
Return Value
X3DObject or a more specific interface (for example, Camera)
Examples
1. JScript Example
NewScene( null, false ); var oRoot = Application.ActiveProject.ActiveScene.Root; var oCam = oRoot.AddPrimitive( "Camera" ); Application.LogMessage( Application.ClassName(oCam) ); var oArc = oRoot.AddPrimitive( "Arc" ); Application.LogMessage( Application.ClassName(oArc) ); var oSph = oRoot.AddPrimitive( "Sphere" ); Application.LogMessage( Application.ClassName(oSph) ); var oNull = oRoot.AddPrimitive( "Null" ); Application.LogMessage( Application.ClassName(oNull) ); // Expected results: //INFO : Camera //INFO : X3DObject //INFO : X3DObject //INFO : Null
2. VBScript Example
NewScene , false set oRoot = Application.ActiveProject.ActiveScene.Root set oNewPrim = oRoot.AddPrimitive( "Spot" ) Application.LogMessage Application.ClassName(oNewPrim) ' Expected results: 'INFO : Light
See Also
Autodesk Softimage v7.5