From bb7231ed4d1807b0a536b72f8ef50f30b4497fa9 Mon Sep 17 00:00:00 2001 From: Lorenz Neureuter Date: Thu, 2 Jul 2026 22:49:15 -0400 Subject: [PATCH 1/2] Fix rendering of placed sketches --- cq_editor/cq_utils.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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)}") From 853bdf27f557187a3791424df7d920f7e91323fc Mon Sep 17 00:00:00 2001 From: Lorenz Neureuter Date: Fri, 3 Jul 2026 10:49:17 -0400 Subject: [PATCH 2/2] Add test --- tests/test_cq_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/test_cq_utils.py 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))