Skip to content

Commit a8a775c

Browse files
committed
mypy fix
1 parent 5e95846 commit a8a775c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

cadquery/sketch.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def parray(self: T, r: Real, a1: Real, da: Real, n: int, rotate: bool = True) ->
362362
if self._selection:
363363
selection: Sequence[Union[Shape, Location, Vector]] = self._selection
364364
else:
365-
selection = [Location()]
365+
selection = [Vector()]
366366

367367
return self.push(
368368
(
@@ -373,7 +373,10 @@ def parray(self: T, r: Real, a1: Real, da: Real, n: int, rotate: bool = True) ->
373373
)
374374
)
375375
for i, l in enumerate(locs)
376-
for el in selection
376+
for el in [
377+
el if isinstance(el, Location) else Location(el.Center())
378+
for el in selection
379+
]
377380
)
378381

379382
def distribute(
@@ -384,7 +387,7 @@ def distribute(
384387
"""
385388

386389
if not self._selection:
387-
raise ValueError("Nothing selected to distirbute over")
390+
raise ValueError("Nothing selected to distribute over")
388391

389392
params = [start + i * (stop - start) / n for i in range(n + 1)]
390393

tests/test_sketch.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,24 @@ def test_distribute():
189189
(-0.5352148612481344, -4.475046932971669, 0.0)
190190
)
191191

192+
s13 = (
193+
Sketch()
194+
.push([(-4, 1)])
195+
.circle(0.1)
196+
.reset()
197+
.faces()
198+
.parray(2, 10, 50, 3)
199+
.rect(1.0, 0.5, 40, "a", "rects")
200+
)
201+
202+
assert len(s13._faces.Faces()) == 4
203+
204+
s13.reset().vertices(">(-1,0,0)", tag="rects")
205+
206+
assert s13._selection[0].toTuple() == approx(
207+
(-3.3330260270865173, 3.1810426396582487, 0.0)
208+
)
209+
192210

193211
def test_each():
194212

0 commit comments

Comments
 (0)