Skip to content

compas_cadwork.elements ¤

Classes¤

Beam ¤

Beam(cadwork_id: ElementId)

Beam element.

Methods:¤

circular classmethod ¤
circular(frame: Frame, length: float, diameter: float) -> Beam

Create circular beam.

Parameters:

  • frame (Frame) –

    Local coordinate system of the element.

  • length (float) –

    Length in millimeters (along X-axis).

  • diameter (float) –

    Section diameter in millimeters (along Y/Z-axes).

Returns:

  • Beam

    New beam element.

Raises:

  • ValueError

    If any of the dimensions are not positive.

polygonal classmethod ¤
polygonal(frame: Frame, length: float, section: Polygon) -> Beam

Create polygonal beam.

Parameters:

  • frame (Frame) –

    Local coordinate system of the element.

  • length (float) –

    Length in millimeters (along X-axis).

  • section (Polygon) –

    Polygon defining the section. Note that the Z coordinate of its points must be zero.

Returns:

  • Beam

    New beam element.

Raises:

  • ValueError

    If the Z coordinate of any of the polygon points is not zero, or if the length is not positive.

rectangular classmethod ¤
rectangular(frame: Frame, length: float, width: float, height: float) -> Beam

Create rectangular beam.

Parameters:

  • frame (Frame) –

    Local coordinate system of the element.

  • length (float) –

    Length in millimeters (along X-axis).

  • width (float) –

    Section width in millimeters (along Y-axis).

  • height (float) –

    Section height in millimeters (along Z-axis).

Returns:

  • Beam

    New beam element.

Raises:

  • ValueError

    If any of the dimensions are not positive.

DimensionalElement ¤

DimensionalElement(cadwork_id: ElementId)

Cadwork element with dimensions.

Attributes¤

centerline property ¤
centerline: Line

Line connecting the two points that define the element.

height property writable ¤
height: float

Height in millimeters (along Z-axis).

length property writable ¤
length: float

Length in millimeters (along X-axis).

material property writable ¤
material: Material

Element material.

width property writable ¤
width: float

Width in millimeters (along Y-axis).

Element ¤

Element(cadwork_id: ElementId)

Generic Cadwork element.

Note

Avoid calling directly, use Project.element() instead to get the proper element class instance.

Parameters:

  • cadwork_id (ElementId) –

    Cadwork element ID.

Attributes¤

attribute_keys class-attribute ¤
attribute_keys: _ElementAttributeKeys = _ElementAttributeKeys()

User attribute keys (i.e., names).

attributes cached property ¤
attributes: _ElementAttributeValues

User attribute values.

children cached property ¤
children: _ElementChildren

Element children.

comment property writable ¤
comment: str | None

Element comment.

data cached property ¤
data: _ElementData

Additional data.

group property writable ¤
group: str | None

Group (or subgroup) name.

Note

Maps to the appropriate attribute depending on the element grouping type configuration for the project.

guid property ¤
guid: UUID

Cadwork element GUID.

id instance-attribute ¤
id: Final[ElementId] = cadwork_id

Cadwork element ID.

Note

This identifier may change when the program is restarted. Do NOT rely on it as a unique ID, use Element.guid instead.

ifc_element_type property writable ¤
ifc_element_type: IfcElementType

IFC element type.

ifc_guid property ¤
ifc_guid: IfcUUID

IFC GUID.

ifc_predefined_type property writable ¤
ifc_predefined_type: IfcPredefinedType

IFC predefined type.

name property writable ¤
name: str | None

Element name.

type property ¤
type: T

Element type.

Methods:¤

delete ¤
delete() -> None

Delete element.

Note

Once called, this element instance becomes unusable.

ElementType ¤

Cadwork element type.

Methods:¤

from_cadwork classmethod ¤
from_cadwork(raw_type: element_type) -> ElementType

Get value from Cadwork element type.

Parameters:

  • raw_type (element_type) –

    Cadwork element type.

Returns:

Raises:

  • ValueError

    If cannot determine the correct mapping type.

Floor ¤

Floor(cadwork_id: ElementId)

Floor element.

IfcElementType ¤

IFC element type.

Methods:¤

from_cadwork classmethod ¤
from_cadwork(raw_type: ifc_2x3_element_type) -> IfcElementType

Get value from Cadwork IFC2x3 element type.

Parameters:

  • raw_type (ifc_2x3_element_type) –

    Cadwork IFC2x3 element type.

Returns:

Raises:

  • ValueError

    If cannot determine the correct mapping type.

to_cadwork ¤
to_cadwork() -> ifc_2x3_element_type

Convert value to Cadwork IFC2x3 element type.

Returns:

  • ifc_2x3_element_type

    Cadwork IFC2x3 element type.

IfcPredefinedType ¤

IFC predefined type.

Methods:¤

from_cadwork classmethod ¤
from_cadwork(raw_type: ifc_predefined_type) -> IfcPredefinedType

Get value from Cadwork IFC predefined type.

Parameters:

  • raw_type (ifc_predefined_type) –

    Cadwork IFC predefined type.

Returns:

Raises:

  • ValueError

    If cannot determine the correct mapping type.

to_cadwork ¤
to_cadwork() -> ifc_predefined_type

Convert value to Cadwork IFC predefined type.

Returns:

  • ifc_predefined_type

    Cadwork IFC predefined type.

Opening ¤

Opening(cadwork_id: ElementId)

Opening element.

OrientedElement ¤

OrientedElement(cadwork_id: ElementId)

Cadwork element with a frame (position and rotation).

Attributes¤

frame property ¤
frame: Frame

Reference frame.

Methods:¤

duplicate ¤
duplicate(vector: Vector) -> Self

Duplicate element by the given vector.

Parameters:

  • vector (Vector) –

    The vector by which to duplicate the element.

Returns:

  • Self

    New element.

translate ¤
translate(vector: Vector) -> None

Translate element by the given vector.

Parameters:

  • vector (Vector) –

    The vector by which to translate the element.

Panel ¤

Panel(cadwork_id: ElementId)

Panel element.

Methods:¤

polygonal classmethod ¤
polygonal(frame: Frame, outline: Polygon, thickness: float) -> Self

Create polygonal element.

Parameters:

  • frame (Frame) –

    Local coordinate system of the element.

  • outline (Polygon) –

    Polygon defining the outline. Note that the Z coordinate of its points must be zero.

  • thickness (float) –

    Thickness in millimeters (along Z-axis).

Returns:

  • Self

    New element.

Raises:

  • ValueError

    If the Z coordinate of any of the polygon points is not zero, or if the thickness is not positive.

rectangular classmethod ¤
rectangular(frame: Frame, length: float, width: float, thickness: float) -> Self

Create rectangular element.

Parameters:

  • frame (Frame) –

    Local coordinate system of the element.

  • length (float) –

    Length in millimeters (along X-axis).

  • width (float) –

    Width in millimeters (along Y-axis).

  • thickness (float) –

    Thickness in millimeters (along Z-axis).

Returns:

  • Self

    New element.

Raises:

  • ValueError

    If any of the dimensions are not positive.

Roof ¤

Roof(cadwork_id: ElementId)

Roof element.

Wall ¤

Wall(cadwork_id: ElementId)

Wall element.