X3DObject.AddPrimitive
 
 
 

X3DObject.AddPrimitive

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.

C# Syntax

X3DObject X3DObject.AddPrimitive( Object in_primPreset, String in_name );

Scripting Syntax

oReturn = X3DObject.AddPrimitive( Preset, [Name] );

Return Value

X3DObject or a more specific interface (for example, Camera)

Parameters

Parameter Type Description
Preset String Any preset in the Alphabetical Listing of All Primitive Presets (for example, "Sphere", "Camera", "Wave", etc.)
Name String Name of child

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

GetPrim CreatePrim X3DObject.AddGeometry