LayerManager Class

class NXOpen.Layer.LayerManager

Bases: object

Represents an object that manages layers

To obtain an instance of this class, refer to NXOpen.BasePart

New in version NX3.0.0.

Properties

Property Description
WorkLayer Returns or sets the work layer.

Methods

Method Description
ApplyMoveToLayerToOwningParts Move the selected objects to the specified layer in their Owning Parts.
ChangeStates Changes the states of the specified layers in the part.
CopyObjects Copies objects to the specified layer
GetAllObjectsOnLayer Returns all objects on the specified layer.
GetState Gets the state of the specified layer.
GetStates Gets the states for all layers in the part.
GetVisibilitiesInView Gets the visibility of all layers in a specified view.
MoveDisplayableObjects Moves displayable objects to the specified layer.
ResetViewVisibilityToGlobal Resets a view’s layer visibility to the global states.
SetObjectsVisibilityOnLayer Sets specified layer(s) visibility in a specified view.
SetState Sets the state of the specified layer.
SetStates Sets the states for all layers in the part.

Property Detail

WorkLayer

LayerManager.WorkLayer

Returns or sets the work layer.

If you change the work layer, the old work layer is changed to Selectable. The part must be the displayed part.

-------------------------------------

Getter Method

Signature WorkLayer

Returns:Layer number of the work layer
Return type:int

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Setter Method

Signature WorkLayer

Parameters:newWorkLayer (int) – Layer number for the new work layer

New in version NX3.0.0.

License requirements: None.

Method Detail

ApplyMoveToLayerToOwningParts

LayerManager.ApplyMoveToLayerToOwningParts

Move the selected objects to the specified layer in their Owning Parts.

This only works when a single layer has been selected on the Layer Settings dialog.

The owning parts will be fully loaded if they are not already.

Objects of class NXOpen.CAE.CAEEdge, NXOpen.CAE.CAEFace, NXOpen.CAE.CAEVertex, NXOpen.Edge, NXOpen.Face or NXOpen.View may not be moved.

Signature ApplyMoveToLayerToOwningParts(newLayer, objectArray)

Parameters:
  • newLayer (int) – The layer in the owning parts to move the objects to
  • objectArray (list of NXOpen.DisplayableObject) – The objects to be moved

New in version NX7.5.0.

License requirements: solid_modeling (“SOLIDS MODELING”) OR drafting (“DRAFTING”)

ChangeStates

LayerManager.ChangeStates

Overloaded method ChangeStates

  • ChangeStates(stateArray, fitAll)
  • ChangeStates(stateArray)

-------------------------------------

Changes the states of the specified layers in the part. Note: there must be exactly one work layer. If you change the work layer, you must specify a new work layer. If you set the work layer, the old work layer will be changed to Selectable, unless you specify otherwise. The part must be the displayed part.

Signature ChangeStates(stateArray, fitAll)

Parameters:
  • stateArray (list of NXOpen.Layer.StateInfo) – Indicates the new states for the layers.
  • fitAll (bool) – Whether to refit the view to what is visible after the layer states have been changed

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Changes the states of the specified layers in the part. Note: there must be exactly one work layer. If you change the work layer, you must specify a new work layer. If you set the work layer, the old work layer will be changed to Selectable, unless you specify otherwise. The part must be the displayed part.

Signature ChangeStates(stateArray)

Parameters:stateArray (list of NXOpen.Layer.StateInfo) – Indicates the new states for the layers.

New in version NX3.0.0.

License requirements: None.

-------------------------------------

CopyObjects

LayerManager.CopyObjects

Copies objects to the specified layer

Objects of class NXOpen.Assemblies.Component, NXOpen.DatumAxis, NXOpen.DatumPlane NXOpen.Edge, NXOpen.Face, NXOpen.Features.Feature or NXOpen.View, may not be copied.

Objects of type UF_cs2_vertex_type may not be copied.

The part must be the work part.

Signature CopyObjects(newLayer, objectArray)

Parameters:
  • newLayer (int) – The layer to move the objects to
  • objectArray (list of NXOpen.NXObject) – The objects to be copied

New in version NX4.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”) OR drafting (“DRAFTING”)

GetAllObjectsOnLayer

LayerManager.GetAllObjectsOnLayer

Returns all objects on the specified layer.

This includes objects which are not counted as objects on the layer by the “Layer Settings” dialog.

The part must be the displayed part.

Signature GetAllObjectsOnLayer(layer)

Parameters:layer (int) –
Returns:All the objects on the specified layer
Return type:list of NXOpen.NXObject

New in version NX3.0.0.

License requirements: None.

GetState

LayerManager.GetState

Gets the state of the specified layer.

The part must be the displayed part.

Signature GetState(layer)

Parameters:layer (int) –
Returns:
Return type:NXOpen.Layer.State

New in version NX3.0.0.

License requirements: None.

GetStates

LayerManager.GetStates

Gets the states for all layers in the part.

The part must be the displayed part.

Signature GetStates()

Returns:Indicates the states for all layers in the part.
Return type:NXOpen.Layer.StateCollection

New in version NX3.0.0.

License requirements: None.

GetVisibilitiesInView

LayerManager.GetVisibilitiesInView

Gets the visibility of all layers in a specified view.

The part must be the displayed part.

Signature GetVisibilitiesInView(view)

Parameters:view (NXOpen.View) – The view object being queried
Returns:The current states for the layers.

The returned states can only be LayerState.Visible and LayerState.Hidden. state_array[i] is for layer i+1 :rtype: list of NXOpen.Layer.StateInfo

New in version NX4.0.3.

License requirements: None.

MoveDisplayableObjects

LayerManager.MoveDisplayableObjects

Moves displayable objects to the specified layer.

The specified part may be the displayed part or the work part. If it is the work part but not the displayed part, then none of the objects to be moved may be currently displayed.

This method is the preferred way to change the layer of one or more objects, because NXOpen.DisplayableObject.Layer() does not correct the display of the objects and does not work as expected for sketches and components, because it does not move the members of the sketch or component.

Objects of class NXOpen.CAE.CAEEdge, NXOpen.CAE.CAEFace, NXOpen.CAE.CAEVertex, NXOpen.Edge, NXOpen.Face or NXOpen.View may not be moved.

Signature MoveDisplayableObjects(newLayer, objectArray)

Parameters:
  • newLayer (int) – The layer to move the objects to
  • objectArray (list of NXOpen.DisplayableObject) – The objects to be moved

New in version NX5.0.0.

License requirements: solid_modeling (“SOLIDS MODELING”) OR drafting (“DRAFTING”)

ResetViewVisibilityToGlobal

LayerManager.ResetViewVisibilityToGlobal

Resets a view’s layer visibility to the global states.

The part must be the displayed part.

Signature ResetViewVisibilityToGlobal(view)

Parameters:view (NXOpen.View) – The view object

New in version NX4.0.0.

License requirements: None.

SetObjectsVisibilityOnLayer

LayerManager.SetObjectsVisibilityOnLayer

Sets specified layer(s) visibility in a specified view.

The part must be the displayed part.

Signature SetObjectsVisibilityOnLayer(view, stateArray, doUpdate)

Parameters:
  • view (NXOpen.View) – The view object being modified
  • stateArray (list of NXOpen.Layer.StateInfo) – The new states for the layers. The given states may only be LayerState.Visible and LayerState.Hidden.
  • doUpdate (bool) – Whether to update the view(s) after the layer states have been changed

New in version NX4.0.0.

License requirements: None.

SetState

LayerManager.SetState

Overloaded method SetState

  • SetState(layer, state)
  • SetState(layer, state, fitAll)

-------------------------------------

Sets the state of the specified layer. The specified layer must not be the work layer. If you are changing the state of the layer to Work, the old work layer will be changed to Selectable. The part must be the displayed part.

Signature SetState(layer, state)

Parameters:

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Sets the state of the specified layer. The specified layer must not be the work layer. If you are changing the state of the layer to Work, the old work layer will be changed to Selectable. The part must be the displayed part.

Signature SetState(layer, state, fitAll)

Parameters:
  • layer (int) –
  • state (NXOpen.Layer.State) –
  • fitAll (bool) – Whether to refit the view to what is visible after the layer state has been changed

New in version NX3.0.0.

License requirements: None.

-------------------------------------

SetStates

LayerManager.SetStates

Overloaded method SetStates

  • SetStates(stateCollection, fitAll)
  • SetStates(stateCollection)

-------------------------------------

Sets the states for all layers in the part. The part must be the displayed part. Note: there must be exactly one work layer.

Signature SetStates(stateCollection, fitAll)

Parameters:
  • stateCollection (NXOpen.Layer.StateCollection) – The states for all layers in the part.
  • fitAll (bool) – Whether to refit the view to what is visible after the layer states have been changed

New in version NX3.0.0.

License requirements: None.

-------------------------------------

Sets the states for all layers in the part. The part must be the displayed part. Note: there must be exactly one work layer.

Signature SetStates(stateCollection)

Parameters:stateCollection (NXOpen.Layer.StateCollection) – The states for all layers in the part.

New in version NX3.0.0.

License requirements: None.

-------------------------------------