LayerManager#

Usage:

LayerManager Class API Wrapper

class LayerManager[source]#

Bases: object

Wrapper for LayerManager class of Moldflow Synergy.

activate_layer(layer)[source]#

Activates a layer.

Parameters:

layer (EntList) – The layer to activate.

Returns:

True if the layer was activated successfully, False otherwise.

Return type:

bool

active(layer)[source]#

Returns whether a layer is the active layer or not

Parameters:

layer (EntList) – The layer to check.

Returns:

True if the layer is active, False otherwise.

Return type:

bool

allow_clipping(layer, checked)[source]#

Sets whether clipping is allowed for a layer.

Parameters:
  • layer (EntList) – The layer to set the clipping for.

  • checked (bool) – True to allow clipping, False otherwise.

Returns:

True if the clipping was set successfully, False otherwise.

Return type:

bool

assign_to_layer(elems, layer)[source]#

Assigns elements to a layer.

Parameters:
  • elems (EntList) – The elements to assign.

  • layer (EntList) – The layer to assign the elements to.

Returns:

The number of elements assigned to the layer.

Return type:

int

create_entity_list()[source]#

Creates a new entity list.

Returns:

The created entity list.

Return type:

EntList

create_layer()[source]#

Creates a new layer.

Returns:

True if the layer was created successfully, False otherwise.

Return type:

bool

create_layer_by_name(name)[source]#

Creates a new layer with the specified name.

Parameters:

name (str) – The name of the new layer.

Returns:

The created layer.

Return type:

EntList

delete_layer(layer, move_ent)[source]#

Deletes a layer.

Parameters:
  • layer (EntList) – The layer to delete.

  • move_ent (bool) – Whether to move entities to the active layer or delete them with the layer.

Returns:

True if the layer was deleted successfully, False otherwise.

Return type:

bool

expand_layer(layer, levels, expand_new_layer, inc_nodes=True, inc_tris=True, inc_tetras=True, inc_beams=True)[source]#

Expands layers by a specified number of “levels” with specified entities

Parameters:
  • layer (EntList) – The layer to expand.

  • levels (int) – The number of levels to expand.

  • expand_new_layer (bool) – Whether to expand into a new layer or not.

  • inc_nodes (bool) – Whether to include nodes in the expansion.

  • inc_tris (bool) – Whether to include triangles in the expansion.

  • inc_tetras (bool) – Whether to include tetras in the expansion.

  • inc_beams (bool) – Whether to include beams in the expansion.

Returns:

The number of elements expanded.

Return type:

int

find_layer_by_name(name)[source]#

Finds a layer by its name.

Parameters:

name (str) – The name of the layer to find.

Returns:

The found layer.

Return type:

EntList

get_activated(layer)[source]#

Returns whether a layer is visible or not

Parameters:

layer (EntList) – The layer to check.

Returns:

True if the layer is visible, False otherwise.

Return type:

bool

get_first()[source]#

Gets the first layer.

Returns:

The first layer.

Return type:

EntList

get_name(layer)[source]#

Gets the name of a layer.

Parameters:

layer (EntList) – The layer to get the name for.

Returns:

The name of the layer.

Return type:

str

get_next(layer)[source]#

Gets the next layer.

Parameters:

layer (EntList) – The current layer.

Returns:

The next layer.

Return type:

EntList

get_number_of_layers()[source]#

Gets the number of layers.

Returns:

The number of layers.

Return type:

int

get_type_visible(layer, entity_type)[source]#

Gets the visibility of a given entity type in layers

Parameters:
  • layer (EntList) – The layer to get the visibility for.

  • entity_type (EntityType | str) – The entity type to get the visibility for.

Returns:

True if the entity type is visible, False otherwise.

Return type:

bool

hide_all_other_layers(layer)[source]#

Hides all layers except the specified layer.

Parameters:

layer (EntList) – The layer to keep visible.

Returns:

True if all other layers were hidden successfully, False otherwise.

Return type:

bool

remove_empty_layers()[source]#

Delete empty layers.

Returns:

True if the empty layers were deleted successfully, False otherwise.

Return type:

bool

set_layer_name(layer, name)[source]#

Sets the name of a layer.

Parameters:
  • layer (EntList) – The layer to set the name for.

  • name (str) – The new name for the layer.

Returns:

True if the name was set successfully, False otherwise.

Return type:

bool

set_type_color(layer, entity_type, default, red, blue, green)[source]#

Sets color of a given entity type in layers

Parameters:
  • layer (EntList) – The layer to set the color for.

  • entity_type (EntityType | str) – The entity type to set the color for.

  • default (bool) – Whether to set the default color or not.

  • red (int) – The red component of the color (0-255).

  • blue (int) – The blue component of the color (0-255).

  • green (int) – The green component of the color (0-255).

Returns:

The integer identifier for the color

Return type:

int

set_type_display_option(layer, entity_type, option)[source]#

Sets display option of a given entity type in layers

Parameters:
  • layer (EntList) – The layer to set the display option for.

  • entity_type (EntityType | str) – The entity type to set the display option for.

  • option (DisplayOption | str) – The display option to set.

Display Option

Triangle

Beam Elements

Tert Elements

Node

Surface

Region

STL Facet

Curve

Solid

X

X

X

X

X

X

Solid + Element Edges

X

X

X

Transparent

X

X

X

X

X

X

Transparent + Element Edges

X

X

X

Shrunken

X

X

X

Axis Line Only

X

X

Point

X

Triad

X

Net

X

X

X

Solid + Net

X

X

X

Transparent + Net

X

X

X

Returns:

True if the display option was set successfully, False otherwise.

Return type:

bool

set_type_show_glyphs(layer, entity_type, show)[source]#

Sets the visibility of glyphs for a given entity type in layers

Parameters:
  • layer (EntList) – The layer to set the glyphs visibility for.

  • entity_type (EntityType | str) – The entity type to set the glyphs visibility for.

  • show (bool) – Whether to set the type as visible or not.

Returns:

True if the glyphs visibility was set successfully, False otherwise.

Return type:

bool

set_type_show_labels(layer, entity_type, show)[source]#

Sets the visibility of labels for a given entity type in layers

Parameters:
  • layer (EntList) – The layer to set the label visibility for.

  • entity_type (EntityType | str) – The entity type to set the label visibility for.

  • show (bool) – Whether to set the type as visible or not.

Returns:

True if the label visibility was set successfully, False otherwise.

Return type:

bool

set_type_visible(layer, entity_type, visible)[source]#

Sets visibility of a given entity type in layers

Parameters:
  • layer (EntList) – The layer to set the visibility for.

  • entity_type (EntityType | str) – The entity type to set the visibility for.

  • visible (bool) – Whether to set the type as visible or not.

Returns:

True if the visibility was set successfully, False otherwise.

Return type:

bool

show_all_layers()[source]#

Shows all layers.

Returns:

True if all layers were shown successfully, False otherwise.

Return type:

bool

show_glyphs(layer, show)[source]#

Shows or hides glyphs for a layer.

Parameters:
  • layer (EntList) – The layer to show or hide labels for.

  • show (bool) – True to show glyphs, False to hide them.

Returns:

True if the glyphs were shown or hidden successfully, False otherwise.

Return type:

bool

show_labels(layer, show)[source]#

Shows or hides labels for a layer.

Parameters:
  • layer (EntList) – The layer to show or hide labels for.

  • show (bool) – True to show labels, False to hide them.

Returns:

True if the labels were shown or hidden successfully, False otherwise.

Return type:

bool

show_layers(layers, show)[source]#

Shows or hides specified layers.

Parameters:
  • layers (EntList) – The layers to show or hide.

  • show (bool) – True to show the layers, False to hide them.

Returns:

True if the layers were shown or hidden successfully, False otherwise.

Return type:

bool

toggle_layer(layer)[source]#

Toggles the visibility of a layer.

Parameters:

layer (EntList) – The layer to toggle.

Returns:

True if the layer was toggled successfully, False otherwise.

Return type:

bool