CreateLayer
 
 
 

CreateLayer

Description

Creates a new layer and add the selection to it.

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

CreateLayer( [PresetObj], [Name], [InputObjs], [Value] );

Parameters

Parameter Type Description
PresetObj String or a preset object (for example, an object obtained from SIGetPreset) Layer preset to use

Default Value: "Default_New_Layer"

Possible Values:

Description:

Default_New_Layer Default new layer
Name String Name of the new layer
InputObjs String List of objects to move to the layer

Default Value: Selected objects

Value Layer Returns the new layer

Examples

1. VBScript Example

CreateLayer , "LayerA",,oLayer
SetCurrentLayer oLayer

2. VBScript Example

' Get initial settings
checkCurrLayer
' Make a new layer (it is *not* automatically set as current)
SICreateLayer , "LayerA",oLayer
checkCurrLayer
' Now explicitly set the new layer as current and check again
SetCurrentLayer oLayer
checkCurrLayer
' Make another new layer (it *is* automatically set as current)
CreateLayer , "LayerB",,oLayer
SetCurrentLayer oLayer
checkCurrLayer
function checkCurrLayer()
        ' What is the current layer?
        GetCurrentLayer oCurrLayer
        LogMessage "Current layer is....." & oCurrLayer
end function
'OUTPUT OF ABOVE SCRIPT IS:
'INFO : "Current layer is.....Layers.Layer_Default"
'INFO : "Current layer is.....Layers.Layer_Default"
'INFO : "Current layer is.....Layers.LayerA"
'INFO : "Current layer is.....Layers.LayerB"

3. VBScript Example

Dim oLayer, oGroup
' Create two nulls 
GetPrim "Null"
GetPrim "Null"
' Add them to a new group
Set oGroup = CreateGroup( "NullsGroup", "null*" )
' Move the group to a new layer and make it the current layer
CreateLayer , "LayerNulls", oGroup, oLayer 
SetCurrentLayer oLayer

See Also

SICreateLayer SICreateLayer2 SICreateLayerFromSelection SICreateLayerFromSelection2