alias_api.AlLayer
- class alias_api.AlLayer
Bases:
AlObjectInterface to Alias layer objects.
Layers provide a way of organizing the models to improve the workflow. The layers have attributes such as visibility, pickability etc, which apply to all the dag nodes which refer to them. The AlDagNode has methods to get AlLayer and set to a new AlLayer.
Each AlLayer has a unique identifying number and a name. By default, the layer gets a unique name based on its number, however, the user is free to change it any name. The user given layer names do not have to be unique.
Default Layer:
There is always a default layer in the AlUniverse with a number 0. The attributes of this default layer can never be changed. Any object of a class derived from AlDagNode class can be assigned to an AlLayer.
Creation Layer:
Any new AlDagNode is automatically assigned to the layer which is made a creation layer. Any existing layer can be made a creation layer, including the default layer, to put the new nodes in that layer automatically. When a layer is made a creation layer, its attributes such as invisibility, temporarily become ineffective and it gets the same attributes as the default layer. These attributes become effective again, as soon as some another layer is made a creation layer.
An AlDagNode can be transferred from one layer to another. An AlDagNode can exist on only one layer at a time. When an AlDagNode is assigned to a non-default layer, all its children are automatically assigned to that layer and all the parents are automatically assigned to the default layer. In addition, all the instances of the AlDagNode are also assigned to the same layer. However, the siblings of that AlDagNode remain uneffected.
All the attributes in an AlLayer can be obtained and set with the methods in this class. By default, all the layers have a corresponding menu in the Alias interface and are visible in the layer bar in the Alias interface. However, through visible_in_layer_bar() methods, a partial list of layers with which one chooses to work can be made visible. The change in visibility in the layer bar does not change the other attributes of the Allayer.
All the existing layers in an AlUniverse can be accessed through methods in AlUniverse. The layer functionality can be temporarily disabled through the static method set_layers_enabled() in the AlUniverse class. When the layer functionality is disabled or turned off, all the layers attributes temporarily become similar to the default layer. However, the layer references of the AlDagNode are not changed.
Symmetric layers are also supported in the API. Methods available allow the developer to turn symmetric layers on, find out if a layer is symmetric, set/query the origin and normal parameters of the symmetric plane and create the symmetric geometry. Symmetric layers are specified by a normal and a point(origin). Note: creation of symmetric geometry is performed by the AlDagNode class.
The complete layers interface is available in Open Model as well.
- assign_child(*args, **kwargs)
Overloaded function.
assign_child(self: alias_api.AlLayer, child_layer_number: typing.SupportsInt) -> int
Assign an Alias layer as child of the current layer.
If this layer is not a folder layer, the operation will fail to assign the child layer.
- param child_layer_number
the ID of the child layer which is to be assigned to the layer
- type child_layer_number
int
- return
The status code result of the operation.
- rype
int(AlStatusCode)
assign_child(self: alias_api.AlLayer, child_layer: alias_api.AlLayer) -> int
Assign an Alias layer as child of the current layer.
If this layer is not a folder layer, the operation will fail to assign the child layer.
- param child_layer
the child layer to assign to the layer
- type child_layer
AlLayer
- return
The status code result of the operation.
- rype
int(AlStatusCode)
- assign_parent(self: alias_api.AlLayer, layer_id: SupportsInt) int
Assign an Alias layer as the parent of the current layer.
- Parameters
layer_id (int) – the parent layer id to assign to the layer
- Returns
The status code result of the operation.
- Rype
int(AlStatusCode)
- assign_selection(self: alias_api.AlLayer, assign_top_nodes: bool = False) int
Assign the current selection to the Alias layer.
- Parameters
assign_top_nodes (bool) – True will get the top-level parent node of each of the selected nodes and set the layer of the top-level node to cascade down to all child nodes.
- Returns
The status code result of the operation.
- Rype
int(AlStatusCode)
- assign_sibling_on_left(self: alias_api.AlLayer, layer_id: SupportsInt) int
Assign an Alias layer as the sibling on the left of the current layer.
- Parameters
layer_id (int) – the sibling layer id to assign to the layer
- Returns
The status code result of the operation.
- Rype
int(AlStatusCode)
- assign_sibling_on_right(self: alias_api.AlLayer, layer_id: SupportsInt) int
Assign an Alias layer as the sibling on the right of the current layer.
- Parameters
layer_id (int) – the sibling layer id to assign to the layer
- Returns
The status code result of the operation.
- Rype
int(AlStatusCode)
- child_layer(self: alias_api.AlLayer) alias_api.AlLayer
Return the child layer below this layer in the graph of Alias AlLayer objects.
- copy_wrapper(self: alias_api.AlLayer) alias_api.AlObject
Return an exact duplicate of this AlLayer wrapper.
- create(*args, **kwargs)
Overloaded function.
create(self: alias_api.AlLayer, name: str) -> int
Create a new layer.
- param name
The name of the new layer.
- type name
str
- return
The status code result Success - the layer was created Failure - the layer was not created because either the maximum number of layers were already created
or the layer functionality is turned off.
AlreadyCreated - object has already been created
- rtype
int(AlStatusCode)
create(self: alias_api.AlLayer, number: typing.SupportsInt) -> int
Create a new layer with the given number.
- param number
The number of the new layer.
- type number
int
- return
A tuple (status, number) where status - the status code result of the operation
Success - the layer was created Failure - the layer was not created because either the maximum number of layers were already created
or the layer functionality is turned off.
AlreadyCreated - object has already been created
number - the Id of the created layer
- rtype
tuple
- create_folder(self: alias_api.AlLayer, name: str) int
Create a new layer folder.
- Parameters
name (str) – The name of the new layer folder.
- Returns
The status code result Success - the layer folder was created Failure - the layer folder was not created because either the maximum number of layers were already created
or the layer functionality is turned off.
AlreadyCreated - object has already been created
- Return type
int(AlStatusCode)
- delete_object(self: alias_api.AlLayer) int
Delete the layer in the Alias Universe.
- property draw_instances
Get or set the draw instances flag on the layer.
- export_content_to_file(self: alias_api.AlLayer, path: str) int
Export the content of the layer to the given file path.
- get_assigned_nodes(self: alias_api.AlLayer) list[AlDagNode]
Return the list of AlDagNodes that are assigned to this AlLayer.
- Returns
The list of dag nodes
- Return type
list<AlDagNode>
- property invisible
Get or set the AlLayer visibility.
- is_assigned(self: alias_api.AlLayer, node: AlDagNode) bool
Return True if the node is assigned to the layer, else False.
- is_empty(self: alias_api.AlLayer) bool
Return True if the Alias layer doesn’t contain any geometry, False otherwise.
- is_folder(self: alias_api.AlLayer) int
Return True if the AlLayer is a layer folder, False otherwise.
- is_picked(self: alias_api.AlLayer) int
Return True if the layer is picked. False is returned if the layer is not picked or if the object is invalid.
- property name
Get or set the AlLayer name.
- next_layer(self: alias_api.AlLayer) alias_api.AlLayer
Return the layer following this layer in the graph of Alias AlLayer objects.
- property number
Get the AlLayer number.
- parent_layer(self: alias_api.AlLayer) alias_api.AlLayer
Return the parent layer above this layer in the graph of Alias AlLayer objects, None if there is no parent layer.
- pick(self: alias_api.AlLayer) int
Picks the layer.
- Returns
The status code result Success - the pick was successfully Failure - the pick operation failed because layers have been disabled InvalidObject - the object is not valid
- Return type
int(AlStatusCode)
- pick_nodes(self: alias_api.AlLayer, leaf_nodes_only: bool = True) int
- )
Pick all the nodes assigned to the Alias layer.
- param leaf_nodes_only
True will pick only the leaf nodes, False will pick the top-most level nodes assigned to the layer (not including their children).
- type leaf_nodes_only
bool
- return
The status code result of the operation.
- rtype
int(AlStatusCode)
- prev_layer(self: alias_api.AlLayer) alias_api.AlLayer
Return the layer previous to this layer in the graph of Alias AlLayer objects.
- set_symmetric_normal(self: alias_api.AlLayer, x: SupportsFloat, y: SupportsFloat, z: SupportsFloat) int
Sets the normal of the symmetric plane.
- Parameters
x (float) – the x coordinate of the normal of the symmetric plane
y (float) – the y coordinate of the normal of the symmetric plane
z (float) – the z coordinate of the normal of the symmetric plane
- Returns
the status code result of the operation Success - the method succeeded Failure - the method failed InvalidObject - the layer is invalid or is not symmetric
- Return type
int(AlStatusCode)
- set_symmetric_origin(self: alias_api.AlLayer, x: SupportsFloat, y: SupportsFloat, z: SupportsFloat) int
Set the location of the origin of the symmetric layer.
- Parameters
x (float) – the x coordinate of the symmetric layer’s origin
y (float) – the y coordinate of the symmetric layer’s origin
z (float) – the z coordinate of the symmetric layer’s origin
- Returns
the status code result of the operation Success - the method succeeded Failure - the method failed InvalidObject - the layer is invalid or is not symmetric
- Return type
int(AlStatusCode)
- property symmetric
Get or set the symmetric flag on the layer.
- symmetric_normal(self: alias_api.AlLayer) tuple[int, float, float, float]
Return the symmetric normal of the layer.
- Returns
A tuple (status, x, y, z) where status - the status code result of the operation
Success - the method succeeded Failure - the method failed InvalidObject - the layer is invalid or is not symmetric
x - the x coordinate of the normal y - the y coordinate of the normal z - the z coordinate of the normal
- Return type
tuple
- symmetric_origin(self: alias_api.AlLayer) tuple[int, float, float, float]
Return the location of the origin of the symmetric layer.
- Returns
A tuple (status, x, y, z) where status - the status code result of the operation
Success - the method succeeded Failure - the method failed InvalidObject - the layer is invalid or is not symmetric
x - the x coordinate of the layer’s origin y - the y coordinate of the layer’s origin z - the z coordinate of the layer’s origin
- Return type
tuple
- type(self: alias_api.AlLayer) alias_api.AlObjectType
Return the AlLayer type identifier.
- unpick(self: alias_api.AlLayer) int
Unpicks the layer.
- Returns
The status code result Success - the unpick was successfully Failure - the unpick operation failed because layers have been disabled InvalidObject - the object is not valid
- Return type
int(AlStatusCode)