Skip to content

Commit c4a16ef

Browse files
authored
Merge pull request #362 from cwapi3d/feature/docs-for-subtraction-clarification
Integrated issue #360 response to docstrings for subtract
2 parents a09302f + 387d2a2 commit c4a16ef

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cwapi3d"
3-
version = "32.443.9"
3+
version = "32.443.10"
44
authors = [{ name = "Cadwork", email = "it@cadwork.ca" }]
55
requires-python = ">= 3.12"
66
description = 'Python bindings for CwAPI3D'

src/element_controller/__init__.pyi

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,18 @@ def rotate_elements(element_id_list: list[ElementId], origin: point_3d, rotation
435435
"""
436436

437437
def subtract_elements(hard_elements: list[ElementId], soft_elements: list[ElementId]) -> list[ElementId]:
438-
"""Subtracts a list of "soft" elements from a list of "hard" elements.
438+
"""Subtracts the volume of `hard_elements` from `soft_elements` (boolean
439+
difference). Soft elements are cut in place and keep their IDs.
439440
440441
Parameters:
441-
hard_elements: The list of "hard" elements.
442-
soft_elements: The list of "soft" elements.
442+
hard_elements (list[ElementId]): The cutter elements. Not modified.
443+
soft_elements (list[ElementId]): The elements to be cut. Modified
444+
in place.
443445
444446
Returns:
445-
The list of resulting elements.
447+
list[ElementId]: Additional element IDs produced when a soft
448+
element is split into multiple disconnected pieces by the
449+
subtraction. Does not include the IDs from `soft_elements`.
446450
"""
447451

448452
def check_element_id(element_id: ElementId) -> bool:
@@ -1179,15 +1183,19 @@ def add_elements_to_detail(element_id_list: list[ElementId], detail: int) -> Non
11791183
"""
11801184

11811185
def subtract_elements_with_undo(hard_element_id_list: list[ElementId], soft_element_id_list: list[ElementId], with_undo: bool) -> list[ElementId]:
1182-
"""Subtracts a list of "soft" elements from a list of "hard" elements with undo functionality.
1186+
"""Subtracts the volume of `hard_elements` from `soft_elements` (boolean difference)
1187+
with undo functionality. Soft elements are cut in place and keep their IDs.
11831188
11841189
Parameters:
1185-
hard_element_id_list: The list of "hard" elements.
1186-
soft_element_id_list: The list of "soft" elements.
1187-
with_undo: Indicate whether the operation should be added to the undo stack.
1190+
hard_element_id_list (list[ElementId]): The cutter elements. Not modified.
1191+
soft_element_id_list (list[ElementId]): The elements to be cut. Modified
1192+
in place.
1193+
with_undo (bool): Indicate whether the operation should be added to the undo stack.
11881194
11891195
Returns:
1190-
The list of elements resulting from the subtraction.
1196+
list[ElementId]: Additional element IDs produced when a soft
1197+
element is split into multiple disconnected pieces by the
1198+
subtraction. Does not include the IDs from `soft_elements`.
11911199
"""
11921200

11931201
def create_linear_optimization(element_id_list: list[ElementId], optimization_number: int, total_length: float, start_cut: float, end_cut: float, saw_kerf: float, is_production_list: bool) -> ElementId:

0 commit comments

Comments
 (0)