CreateModel
 
 
 

CreateModel

Description

Creates a new Model in the Scene. If you do not explicitly specify what objects (including other models) that the new model will contain (via the InputObj parameter), then any objects that are currently selected become children of the created node.

You can also specify which node to parent the new model under (via the InputObj parameter).

This command is the scripting equivalent of selecting Create > Model > New Model from the Model toolbar. It is similar in syntax and behavior to the SICreateModel command, except that it selects the new model.

Note: This command uses output arguments. C# and some scripting languages (such as JScript, PerlScript and Python) don't support arguments passed by reference so you need to use the best workaround for your situation:

For scripting languages this command returns an ISIVTCollection which you can use to get the output arguments.

For C# you can use the XSIApplication.ExecuteCommand method to call this command. ExecuteCommand packs the output arguments into a C# System.Object containing an Array of the output arguments (see Calling Commands from C#).

Scripting Syntax

CreateModel( [InputObj], [Name], [Parent], [Value] );

Parameters

Parameter Type Description
InputObj String List of objects (including other models) to be reparented under the new model.

Default Value: Current selection

Name String Name of the model
Parent String Object or model to use as the parent of the new model
Value Model Returns the model

Examples

VBScript Example

'---------------------------------------------------------
' This example demonstrates how to use the CreateModel 
' command.
'---------------------------------------------------------
NewScene , false
' First create a node off of the scene root.
dim Root_NodeObj
CreateModel , "Root_Node", , Root_NodeObj
Application.LogMessage "Created " & Root_NodeObj
DeselectAll
' Now create a sub-node, and make it the child of a new node. Notice that since 
' "Sub-node" is selected when "Another_Root" is created, it becomes a child.
dim Sub_NodeObj, Another_RootObj
CreateModel , "Sub-node", , Sub_NodeObj
Application.LogMessage "Created " & Sub_NodeObj
SelectObj "Sub-node"
CreateModel , "Another_Root", , Another_RootObj
Application.LogMessage "Created " & Another_RootObj
DeselectAll
' Now make another node, with parent "Another_Root", and child "Root_Node".
' Notice that now, "Another_Root" is the only top-level model, with children
' "Mid_Root" and "Sub-node", and "Mid_Root" has child "Root_Node"
dim Mid_RootObj
CreateModel "Root_Node", "Mid_Root", "Another_Root", Mid_RootObj
Application.LogMessage "Created " & Mid_RootObj
DeselectAll
'---------------------------------------------------------
' Output from this script:
'---------------------------------------------------------
'INFO : Created Root_Node
'INFO : Created Sub-node
'INFO : Created Another_Root
'INFO : Created Mid_Root

See Also

SICreateModel