diff --git a/cq_editor/cq_utils.py b/cq_editor/cq_utils.py index 852c5d97..361bd854 100644 --- a/cq_editor/cq_utils.py +++ b/cq_editor/cq_utils.py @@ -59,10 +59,7 @@ def to_compound( elif isinstance(obj, list) and isinstance(obj[0], TopoDS_Shape): vals.extend(cq.Shape.cast(o) for o in obj) elif isinstance(obj, cq.Sketch): - if obj._faces: - vals.append(obj._faces) - else: - vals.extend(obj._edges) + vals.extend(obj) else: raise ValueError(f"Invalid type {type(obj)}") diff --git a/tests/test_cq_utils.py b/tests/test_cq_utils.py new file mode 100644 index 00000000..25601ea9 --- /dev/null +++ b/tests/test_cq_utils.py @@ -0,0 +1,13 @@ +import cadquery as cq +import pytest + +from cq_editor.cq_utils import to_compound + + +def test_to_compound_applies_sketch_placement(): + sk = cq.Sketch().rect(1, 1) + placed = cq.Workplane("XZ").placeSketch(sk).val() + f = to_compound(placed).face() + + assert f.Area() == pytest.approx(1) + assert f.normalAt().toTuple() == pytest.approx((0, -1, 0))