compas_cadwork.utilities
¤
Classes¤
IFCExportSettings
dataclass
deprecated
¤
IFCExportSettings(grouping_type: ElementGroupingType = NONE, export_cover_geometry: bool = False, translate_local_frame: bool = False)
Deprecated
Subject to removal, avoid using
Represents settings for the ifc export.
Attributes:
-
grouping_type(:class:`ElementGroupingType`, optional) –Which element grouping type should be considered when exporting (e.g. group, subgroup)
-
export_cover_geometry((bool, optional)) –True if cover geometry should be exported, False otherwise.
-
translate_local_frame((bool, optional)) –If True, the local frame of the elements will be translated on export to the global frame set with
utility_controller.set_global_origin.
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
-
API Reference
utilities ClassesIFCExporter Attributessettings
Attributes¤
export_cover_geometry
class-attribute
instance-attribute
¤
export_cover_geometry: bool = False
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
grouping_type
class-attribute
instance-attribute
¤
grouping_type: ElementGroupingType = NONE
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
translate_local_frame
class-attribute
instance-attribute
¤
translate_local_frame: bool = False
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Methods:¤
get_ifc_options
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
IFCExporter
deprecated
¤
IFCExporter(settings: IFCExportSettings | None = None)
Deprecated
Subject to removal, avoid using
Used to export elements to ifc files.
Sets the required global settings for the export and restores them after the export.
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Attributes¤
settings
instance-attribute
¤
settings = settings or IFCExportSettings()
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Methods:¤
cleanup
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Restores any global settings that were changed during the export.
export_elements_to_ifc
¤
initialize
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Sets any global settings that are required for the export.
Functions:¤
activate_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Activates the given elements in the cadwork viewport.
Parameters:
-
elements(list(:class:`compas_cadwork.datamodel.Element` or int)) –List of elements or element ids to activate.
disable_autorefresh
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Disables the automatic refresh of the cadwork viewport.
enable_autorefresh
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Enables the automatic refresh of the cadwork viewport.
force_refresh
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Forces a refresh of the cadwork viewport.
get_active_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns the currently selected elements in the cadwork viewport.
Returns:
-
list(:class:`compas_cadwork.datamodel.Element`)–List of currently selected elements.
get_all_element_ids
¤
get_all_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns all element ids of the currently open cadwork document.
Parameters:
-
include_instructions(bool, default:False) –If True, also include instruction elements in the result.
Returns:
-
generator(:class:`compas_cadwork.datamodel.Element`)–Generator of elements.
get_all_elements_with_attrib
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns a generator containing all elements with the given user attribute set to the given value.
Parameters:
-
attrib_number(int) –The user attribute number to filter by.
-
attrib_value(str, default:None) –The value the user attribute should have.
Returns:
-
generator(:class:`compas_cadwork.datamodel.Element`)–Generator of elements
get_bounding_box_from_cadwork_object
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns the 8 vertices of an elements bounding box.
Parameters:
-
element(int or :class:`compas_cadwork.datamodel.Element`) –The element id or Element object.
Returns:
-
list(:class:`compas.geometry.Point`)–
get_element_groups
¤
get_element_groups(is_wall_frame: bool = True) -> dict[str, ElementGroup]
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns a dictionary mapping names of the available building subgroups to their elements.
Parameters:
-
is_wall_frame(bool, default:True) –If True, only wall groups which contain a wall frame elements are returned, otherwise all groups are returned.
Returns:
-
dict(str, :class:`~compas_cadwork.datamodel.ElementGroup`)–Dictionary of building group names mapped to an instance of ElementGroup.
get_element_groups_from_selection
¤
get_element_groups_from_selection(is_wall_frame: bool = True) -> dict[str, ElementGroup]
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Return a dictionary of ElementGroups built from the currently selected elements.
get_filename
¤
get_filename() -> str
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns the name of the currently open cadwork document.
get_plugin_home
¤
get_plugin_home() -> str
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns the home root directory of the currently running plugin
get_user_point
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Prompts the user to select a cadwork point in the viewport and returns the coordinates of the selected point.
Returns:
-
class:`~compas.geometry.Point`–
hide_all_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Hides all elements in the cadwork viewport.
hide_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Hides the given elements in the cadwork viewport.
Parameters:
-
elements(list(:class:`compas_cadwork.datamodel.Element` or int)) –List of elements or element ids to hide.
is_cadwork_window_in_dark_mode
¤
is_cadwork_window_in_dark_mode() -> bool
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Returns true if cadwork is in dark_mode and false if not.
lock_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Locks the given elements in the cadwork viewport.
Parameters:
-
elements(list(:class:`compas_cadwork.datamodel.Element` or int)) –List of elements or element ids to lock.
remove_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Removes the given elements from the cadwork document.
Parameters:
-
elements(list(:class:`compas_cadwork.datamodel.Element` or int)) –List of elements or element ids to remove.
save_project_file
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Saves the current cadwork project file.
show_all_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Shows all elements in the cadwork viewport.
unlock_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
Unlocks the given elements in the cadwork viewport.
Parameters:
-
elements(list(:class:`compas_cadwork.datamodel.Element` or int)) –List of elements or element ids to unlock.
zoom_active_elements
¤
| Software compatibility: | ||
|---|---|---|
| ✅ Cadwork 2024 | ✅ Cadwork 2025 | ✅ Cadwork 2026 |
zoom active elements
Parameters:
-
Returns–None