Skip to content

compas_cadwork.datamodel ¤

Classes¤

AnchorPoint dataclass ¤

AnchorPoint(location: Point, distance: float, direction: Vector)

Anchor point of a cadwork measurement. There may me 2 or more anchor points in a measurement.

Attributes:

  • location (Point) –

    The location of the anchor point in 3d space.

  • distance (float) –

    The distance of the anchor point from the measurement line.

  • direction (Vector) –

    The direction of the anchor point from the measurement line.

Dimension ¤

Dimension(id)

Represents a cadwork dimension

Element dataclass ¤

Element(id: int)

Represents a cadwork Element

Parameters:

  • id (int) –

    The ID of the Element

Attributes:

  • name (str) –

    The name of the Element

  • frame (Frame) –

    The local coordinate system of the Element

  • width (float) –

    The width of the Element

  • height (float) –

    The height of the Element

  • length (float) –

    The length of the Element

  • group (str) –

    The group the Element belongs to. Either group or subgroup depending on the current grouping type.

  • ifc_base64_guid (str) –

    The base64 IFC GUID of the Element

  • cadwork_guid (str) –

    The cadwork GUID of the Element

  • centerline (Line) –

    The centerline of the Element.

  • midpoint (Point) –

    The midpoint of the Element's centerline.

  • ifc_guid (str) –

    The IFC GUID of the Element. See also: ifc_base64_guid.

  • is_beam (bool) –

    Whether the Element is a beam

  • is_wall (bool) –

    Whether the Element is a framed wall i.e. container for all other elements in the building group.

  • is_drilling (bool) –

    Whether the Element is a drilling hole

  • is_roof (bool) –

    Whether the Element is a framed roof i.e. container for all other elements in the building group.

  • is_floor (bool) –

    Whether the Element is a framed floor i.e. container for all other elements in the building group.

Methods:¤

from_selection classmethod ¤
from_selection() -> Generator[Element]

Returns a generator containing Element objects for all currently activated Elements

Returns:

  • Generator[Element]

    A generator containing Element objects for all currently activated Elements

get_elements_in_contact ¤
get_elements_in_contact() -> list[Element]

Returns a list of elements in contact with the current element

get_instruction_id ¤
get_instruction_id() -> str | None

Returns the instruction ID of the Element

Returns:

  • (str, optional)

    The instruction ID of the Element

remove ¤
remove()

Removes the Element from the cadwork file

remove_attribute ¤
remove_attribute(attribute_number: int, value: str | None = None)

Removes an attribute from the Element

Parameters:

  • attribute_number (int) –

    The number of the attribute (1-10)

  • value (str, default: None ) –

    The attribute value to remove from the user attribute list.

set_attribute ¤
set_attribute(attribute_number: int, name_or_value: str, value: str | None = None)

Sets an attribute on the Element

Parameters:

  • attribute_number (int) –

    The number of the attribute (1-10)

  • name_or_value (str) –

    If value is provided, this is the name of the attribute. Otherwise, this is the user attribute value.

  • value (str, default: None ) –

    The value of the attribute

set_is_instruction ¤
set_is_instruction(value: bool, instruction_id: str | None = None)

Sets the is_instruction attribute on the Element

Parameters:

  • value (bool) –

    If True, this Element will be flagged as an instruction element by setting the appropriate attribute. If False, the attribute will be removed.

  • instruction_id (str, default: None ) –

    The ID of the instruction. This is required when setting is_instruction to True.

translate ¤
translate(vector: Vector) -> None

Translates the Element by the given vector.

Parameters:

  • vector (Vector) –

    The vector by which to translate the Element

ElementGroup dataclass ¤

ElementGroup(name: str, elements: list | None = None, wall_frame_element: Element | None = None)

Represents a cadwork Element Group

Parameters:

  • name (str) –

    The name of the Element Group

  • elements (list, default: None ) –

    A list of Elements belonging to the Element Group

Attributes:

  • name (str) –

    The name of the Element Group

  • elements (list) –

    A list of Elements belonging to the Element Group

  • wall_frame_element ((Element, optional)) –

    The containing Element (often a wall element) which contains all other elements in the group. If any.

  • ifc_guid (str) –

    The IFC GUID of the container element, often used to represent the whole group. See also: ifc_base64_guid

Methods:¤

add_element ¤
add_element(element: Element) -> None

Adds an Element to the Element Group

Parameters:

  • element (Element) –

    The Element to add to the Element Group

ElementGroupingType ¤

CADWork Element Grouping Type

Attributes:

  • GROUP

    Elements are grouped using group as the main grouping type.

  • SUBGROUP

    Elements are grouped using subgroup as the main grouping type.

  • NONE

    Not setting is available.

Methods:¤

to_cadwork ¤
to_cadwork()

Converts the ElementGroupingType to a cadwork compatible value.

Returns:

  • int

    The cadwork compatible value of the ElementGroupingType