SICreateModel

Categories

file

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 similar in syntax and behavior to the CreateModel command, except that it does not change the selection.

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

SICreateModel( [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

Python Example

#---------------------------------------------------------
# This example demonstrates how to use the SICreateModel 
# command in Python.
#---------------------------------------------------------
app = Application
app.NewScene( "", 0 )
# First create a node off of the scene root.
ivtInfo = app.SICreateModel( "", "Root_Node" )
Root_NodeObj = ivtInfo.Value( "Value" )
app.LogMessage( "Created " + Root_NodeObj.Name )
# Now create a sub-node, and make it the child of a 
# third node. Notice that since "Sub-node" is selected 
# when "Another_Root" is created, it becomes a child.
ivtInfo = app.SICreateModel( "", "Sub-node" )
Sub_NodeObj = ivtInfo.Value( "Value" )
app.LogMessage( "Created " + Sub_NodeObj.Name )
app.SelectObj( "Sub-node" )
ivtInfo = app.SICreateModel( "", "Another_Root" )
Another_RootObj = ivtInfo.Value( "Value" )
app.LogMessage( "Created " + Another_RootObj.Name )
app.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"
ivtInfo = app.SICreateModel( "Root_Node", "Mid_Root", "Another_Root" )
Mid_RootObj = ivtInfo.Value( "Value" )
app.LogMessage( "Created " + Mid_RootObj.Name )
app.DeselectAll()
#---------------------------------------------------------
# Output from this script:
#---------------------------------------------------------
#INFO : Created Root_Node
#INFO : Created Sub-node
#INFO : Created Another_Root
#INFO : Created Mid_Root

See Also

SICreateModel