Element

class compas_model.elements.Element(geometry=None, transformation=None, features=None, name=None)

Bases: Data

Base class for all elements in the model.

Parameters:
geometrycompas.geometry.Shape | compas.geometry.Brep | compas.datastructures.Mesh, optional

The complete geometry of the element.

frameNone, default WorldXY

The frame of the element.

nameNone

The name of the element.

Attributes:
graphnodeint

The identifier of the corresponding node in the interaction graph of the parent model.

treenodecompas.datastructures.TreeNode

The node in the hierarchical element tree of the parent model.

framecompas.geometry.Frame

The local coordinate frame of the element.

geometrycompas.datastructures.Mesh | compas.geometry.Brep, readonly

The geometry of the element, computed from the base shape and its features.

aabbcompas.geometry.Box, readonly

The Axis Aligned Bounding Box (AABB) of the element.

obbcompas.geometry.Box, readonly

The Oriented Bounding Box (OBB) of the element.

collision_meshcompas.datastructures.Mesh, readonly

The collision geometry of the element.

featureslist[Feature]

A list of features that define the detailed geometry of the element.

is_dirtybool

Flag to indicate that modelgeometry has to be recomputed.

Methods

add_feature

Add a feature to the list of features of the lement.

add_modifier

Computes the modifier to be applied to the target element.

apply_features

Apply the features to the (base) geometry.

collision

Compute the collision between this element and another element.

compute_aabb

Computes the Axis Aligned Bounding Box (AABB) of the geometry of the element.

compute_collision_mesh

Computes the collision geometry of the geometry of the element.

compute_elementgeometry

Compute the geometry of the element in local coordinates.

compute_modelgeometry

Compute the geometry of the element in model coordinates and taking into account the effect of interactions with connected elements.

compute_modeltransformation

Compute the transformation to model coordinates of this element based on its position in the spatial hierarchy of the model.

compute_obb

Computes the Oriented Bounding Box (OBB) of the geometry of the element.

compute_point

Computes a reference point for the element geometry (e.g. the centroid).

contacts

Compute the contacts between this element and another element.

transform

Transforms the element.

transformed

Creates a transformed copy of the element.

Inherited Methods

ToString

Converts the instance to a string.

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.

sha256

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

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.

validate_data

Validate the data against the object's data schema.