Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cadquery/sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,14 @@ def _startPoint(self) -> Vector:
if not self._edges:
raise ValueError("No free edges available")

e = self._edges[0]
# find the first edge matching current edge mode
e = self._edges[-1]
mode = e.forConstruction

for el in self._edges:
if el.forConstruction == mode:
e = el
break

return e.startPoint()

Expand Down
19 changes: 19 additions & 0 deletions tests/test_sketch.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,3 +973,22 @@ def test_missing_selection(s1):
# cannot tag without selection
with raises(ValueError):
s1.tag("name")


def test_mixed_close():

# check that closing of mixed mode edges works correctly
s = (
Sketch()
.arc((0, 0), 30, 0, 120, tag="e0", forConstruction=True)
.edges(tag="e0")
.distribute(1, rotate=False)
.segment((0, 0), (10, 2))
.segment((10, -2))
.close()
.assemble()
.reset() # reset the implicit selection coming from distribute
)

# the underlying face should be valid
assert s.val().isValid()