diff --git a/src/build123d/geometry.py b/src/build123d/geometry.py index d8c356c2..ae52dc10 100644 --- a/src/build123d/geometry.py +++ b/src/build123d/geometry.py @@ -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: diff --git a/tests/test_direct_api.py b/tests/test_direct_api.py index fecaa507..abaffea8 100644 --- a/tests/test_direct_api.py +++ b/tests/test_direct_api.py @@ -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": {