Skip to content

Commit 23de5cc

Browse files
authored
Fix Sketch rarray bug when used with push (#994)
1 parent 4108c7d commit 23de5cc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

cadquery/sketch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def rarray(self: T, xs: Real, ys: Real, nx: int, ny: int) -> T:
331331
selection = [Vector()]
332332

333333
return self.push(
334-
(el * l if isinstance(el, Location) else Location(el.Center())) * l
334+
(l * el if isinstance(el, Location) else l * Location(el.Center()))
335335
for l in locs
336336
for el in selection
337337
)

tests/test_sketch.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ def test_distribute():
133133

134134
assert s5._faces.Area() == approx(18 * 0.25)
135135
assert len(s5._faces.Faces()) == 18
136+
assert s5.reset().vertices(">(1,1,0)")._selection[0].toTuple() == approx(
137+
(3.25, 3.25, 0)
138+
)
136139

137140
s6 = Sketch().push([(0, 0), (1, 1)]).parray(2, 0, 90, 3).rect(0.5, 0.5)
138141

0 commit comments

Comments
 (0)