ElementTree

class compas_model.models.ElementTree(name=None)

Bases: Tree

Class representing the hierarchy of elements in a model through a tree.

Parameters:
modelcompas_model.model.Model

The parent model of the element tree.

namestr, optional

The name of the tree.

Attributes:
modelcompas_model.model.Model

The parent model of the tree.

groupslist[GroupNode], read-only

The groups contained in the tree.

elementslist[Element], read-only

The elements contained in the tree

Methods

find_element_node

Find the node containing the element.

Inherited Methods

ToString

Converts the instance to a string.

add

Add a node to the tree.

compute_aabb

Compute the axis-aligned bounding box of the datastructure.

compute_obb

Compute the oriented bounding box of the datastructure.

copy

Make an independent copy of the data object.

from_json

Construct an object of this type from a JSON file.

from_jsonstring

Construct an object of this type from a JSON string.

get_hierarchy_string

Return string representation for the spatial hierarchy of the tree.

get_node_by_name

Get a node by its name.

get_nodes_by_name

Get all nodes by their name.

remove

Remove a node from the tree.

rotate

Rotate the datastructure.

rotated

Returns a rotated copy of this geometry.

scale

Scale the datastructure.

scaled

Returns a scaled copy of this geometry.

sha256

Compute a hash of the data for comparison during version control using the sha256 algorithm.

to_graph

Convert the tree to a graph.

to_json

Convert an object to its native data representation and save it to a JSON file.

to_jsonstring

Convert an object to its native data representation and save it to a JSON string.

transform

Transforms the data structure.

transform_numpy

Transforms the data structure.

transformed

Returns a transformed copy of this data structure.

transformed_numpy

Returns a transformed copy of this data structure.

translate

Translate the datastructure.

translated

Returns a translated copy of this geometry.

traverse

Traverse the tree from the root node.

validate_data

Validate the data against the object's data schema.