## GetPrim

### Description

Creates raw primitives. For geometrical objects it creates implicit geometrical objects. It is also possible to create other types of primitives: cameras, lights, nulls, control objects, lattices, geometry shaders. The created primitive will be selected.
GetPrim creates a primitive. The name GetPrim comes from the Softimage menu Get-Primitive-.
Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference. Normally you can get the output arguments via either XSIApplication.ExecuteCommand method (C#) or the ISIVTCollection (scripting languages), but this command already returns a value.
The only available workaround in this case is to create a VBScript custom command which returns both the output arguments and the return value in one array. For details, see What Happens when the Function Already Returns a Value?.

### Scripting Syntax

    oReturn = GetPrim( PresetObj, [Name], [Parent], [Primitive] );

### Return Value

Returns the 3D object (usually an X3DObject object) created for the primitive.

### Parameters

Parameter | Type | Description
--- | --- | ---
PresetObj | String or a preset object (see SIGetPreset) | The name of a primitive preset. See Implicit Primitives and Geometry Primitives for a list of supported preset names.
Name | String | Name of the new primitive.
Parent | String | Name of an existing object to use as the parent of the new primitive.
Primitive | Primitive | Returns the implicit primitive.

### Examples

#### VBScript Example

    'This example creates two primitives

    newscene

    dim preset, object, primitive

    'Create an implicit sphere. Name it.

    set object = GetPrim( "Sphere", "MySphere" , , primitive )

    'Logged information:

    'INFO : "Sphere information"

    'INFO : "X3DObject, MySphere"

    'INFO : "Primitive, Sphere"

    LogMessage "Sphere information"

    LogMessage TypeName( object ) & ", " & object.name

    LogMessage TypeName( primitive ) & ", " & primitive.name

    'Create an implicit cone. Name it and make it child of MySphere

    set object = GetPrim( "Cone", "MyCone" ,"MySphere" , primitive )

    'Logged information:

    'INFO : "Cone information"

    'INFO : "X3DObject, MyCone"

    'INFO : "Primitive, Cone"

    LogMessage "Cone information"

    LogMessage TypeName( object ) & ", " & object.name

    LogMessage TypeName( primitive ) & ", " & primitive.name

    ' Create primitive using preset selected by user (Will pop UI for selection)

    set preset = SIGetPreset( "Primitives" )

    set object = GetPrim( preset, , , primitive )

    'Logged information, here we selected a square.

    'INFO : "Your primitive's information"

    'INFO : "X3DObject, square"

    'INFO : "Primitive, Square"

    LogMessage "Your primitive's information"

    LogMessage TypeName( object ) & ", " & object.name

    LogMessage TypeName( primitive ) & ", " & primitive.name

### See Also

CreatePrim SIGetPrim