v8.0 (2010)
Creates a new layer and adds the selection to it but does not
make the layer current.
This command is similar to the SICreateLayerFromSelection
command except that it does not use output arguments so it is safe
to use with languages that don't support passing arguments by
reference, such as JScript and Python.
oReturn = SICreateLayerFromSelection2( [PresetObj], [Name], [InputObjs], [LayerGroupName] ); |
Returns the Layer.
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"
|
||||
Name | String | Name of the new layer | ||||
InputObjs | String | List of objects to move to
the layer
Default Value: Selected objects |
||||
LayerGroupName | String | Name of the layer group that will contain the new layer
Default Value: If not specified, the group containing the current layer will be used. |
# # This example shows how to use the current selection # to create a new layer and set that layer to current # app = Application app.NewScene(None, False) app.CreatePrim("Cylinder", "MeshSurface") app.CreatePrim("Sphere", "MeshSurface") app.ToggleSelection("cylinder", None, True) # Now create the layer from the selection, put it into a new layer group and make it current oNewLayer = app.SICreateLayerFromSelection2(None, "LayerA", None, "GroupA") app.SetCurrentLayer(oNewLayer) |
/* This example demonstrates how to create a new layer and set it to be the current layer */ // Setup NewScene( null, false ); CreatePrim("Cylinder", "MeshSurface", null, null); CreatePrim("Sphere", "MeshSurface", null, null); ToggleSelection("cylinder", null, true); // Get initial settings checkCurrLayer(); // Make a new layer into a new layer group (it is *not* automatically set as current) var oNewLayer = SICreateLayerFromSelection2( null, "LayerA", null, "GroupA" ); checkCurrLayer(); // Now explicitly set the new layer as current and check again SetCurrentLayer( oNewLayer ); checkCurrLayer(); function checkCurrLayer() { // What is the current layer? var oCurrLayer = GetCurrentLayer()(0); Application.LogMessage( "Current layer is....." + oCurrLayer.FullName ); Application.LogMessage( "Current layer is in layer group....." + oCurrLayer.LayerGroupName.Value ); } // Expected result: //INFO : Current layer is.....Layers.Layer_Default //INFO : Current layer is in layer group.....Group_Default //INFO : Current layer is.....Layers.Layer_Default //INFO : Current layer is in layer group.....Group_Default //INFO : Current layer is.....Layers.LayerA //INFO : Current layer is in layer group.....GroupA |
# # This example demonstrates how to # create a layer from a group # app = Application app.NewScene( "", 0 ) # Create two nulls app.GetPrim( "Null" ) app.GetPrim( "Null" ) # Add them to a new group oGroup = app.CreateGroup( "NullsGroup", "null*" ) # Move the group to a new layer into a new layer group oNewLayer = app.SICreateLayerFromSelection2( "", "LayerNulls", "", "Group_Nulls" ) app.SetCurrentLayer( oNewLayer ) |