Skip to content

Commit

Permalink
Fixing Location * GridLocations
Browse files Browse the repository at this point in the history
  • Loading branch information
gumyr committed Nov 26, 2023
1 parent fe860c4 commit 2a747b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/build123d/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,8 +1171,8 @@ def __mul__(self, other: Location) -> Location:
other.wrapped, TopLoc_Location
): # Shape
result = other.moved(self)
elif isinstance(other, (list, tuple)) and all(
[isinstance(o, Location) for o in other]
elif isinstance(other, Iterable) and all(
isinstance(o, Location) for o in other
):
result = [Location(self.wrapped * loc.wrapped) for loc in other]
else:
Expand Down
5 changes: 5 additions & 0 deletions tests/test_direct_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,11 @@ def test_neg(self):
self.assertVectorAlmostEquals(n_loc.position, (1, 2, 3), 5)
self.assertVectorAlmostEquals(n_loc.orientation, (180, -35, -127), 5)

def test_mult_iterable(self):
locs = Location((1, 2, 0)) * GridLocations(4, 4, 2, 1)
self.assertVectorAlmostEquals(locs[0].position, (-1, 2, 0), 5)
self.assertVectorAlmostEquals(locs[1].position, (3, 2, 0), 5)

def test_as_json(self):
data_dict = {
"part1": {
Expand Down

0 comments on commit 2a747b3

Please sign in to comment.