Skip to content

Generic Elements¤

The generic element classes distinguish geometry by representation rather than by an AEC-specific role:

  • MeshElement preserves Mesh geometry.
  • BrepElement preserves native BRep geometry and creates a mesh only when a surface or collision mesh is explicitly requested.
  • PrimitiveElement stores a parametric COMPAS shape and evaluates it to a Mesh. It does not implicitly require or select a BRep backend.

This separation makes collision, contact, section, and visualization dispatch predictable. Mesh and BRep representations are not mixed implicitly.

compas_model.elements.generic ¤

Classes¤

BrepElement ¤

BrepElement(
    geometry: Brep,
    transformation: Transformation | None = None,
    features: list[Feature] | None = None,
    material: Material | None = None,
    name: str | None = None,
)

A context-free element represented by a native COMPAS BRep.

The class keeps the BRep representation intact. Surface meshes are created only when :attr:surface_mesh or :attr:collision_mesh is requested.

Parameters:

  • geometry (Brep) –

    The BRep in element-local coordinates.

  • transformation (Transformation | None, default: None ) –

    The transformation from element-local to parent coordinates.

  • features (list[Feature] | None, default: None ) –

    Features applied when explicitly requested.

  • material (Material | None, default: None ) –

    The element material.

  • name (str | None, default: None ) –

    The element name.

MeshElement ¤

MeshElement(
    geometry: Mesh,
    transformation: Transformation | None = None,
    features: list[Feature] | None = None,
    material: Material | None = None,
    name: str | None = None,
)

A context-free element represented by a COMPAS mesh.

Parameters:

  • geometry (Mesh) –

    The mesh in element-local coordinates.

  • transformation (Transformation | None, default: None ) –

    The transformation from element-local to parent coordinates.

  • features (list[Feature] | None, default: None ) –

    Features applied when explicitly requested.

  • material (Material | None, default: None ) –

    The element material.

  • name (str | None, default: None ) –

    The element name.

PrimitiveElement ¤

PrimitiveElement(
    primitive: Shape,
    transformation: Transformation | None = None,
    features: list[Feature] | None = None,
    material: Material | None = None,
    name: str | None = None,
)

A context-free element represented parametrically by a COMPAS shape.

Primitive elements evaluate to a mesh. This makes collision, contact, and visualization dispatch deterministic without requiring a BRep backend.

Parameters:

  • primitive (Shape) –

    A COMPAS shape supporting conversion to a mesh.

  • transformation (Transformation | None, default: None ) –

    The transformation from element-local to parent coordinates.

  • features (list[Feature] | None, default: None ) –

    Mesh features applied when explicitly requested.

  • material (Material | None, default: None ) –

    The element material.

  • name (str | None, default: None ) –

    The element name.