diff --git a/src/build123d/build_common.py b/src/build123d/build_common.py index 5f66275..a52ff90 100644 --- a/src/build123d/build_common.py +++ b/src/build123d/build_common.py @@ -366,9 +366,11 @@ class LocationList: @property def locations(self) -> list[Location]: """Current local locations globalized with current workplanes""" + context = WorkplaneList._get_context() + workplanes = context.workplanes if context else [Plane.XY] global_locations = [ plane.to_location() * local_location - for plane in WorkplaneList._get_context().workplanes + for plane in workplanes for local_location in self.local_locations ] return global_locations diff --git a/src/build123d/geometry.py b/src/build123d/geometry.py index 8e75534..caaaa3a 100644 --- a/src/build123d/geometry.py +++ b/src/build123d/geometry.py @@ -1217,20 +1217,29 @@ class Pos(Location): """Position by Vertex""" @overload - def __init__(self, x: float = 0, y: float = 0, z: float = 0): + def __init__(self, X: float = 0, Y: float = 0, Z: float = 0): """Position by X, Y, Z""" - def __init__(self, *args): + def __init__(self, *args, **kwargs): + position = [0,0,0] # VectorLike if len(args) == 1 and isinstance(args[0], (tuple, Vector)): - super().__init__(args[0]) + position = list(args[0]) # Vertex elif len(args) == 1 and isinstance(args[0], Iterable): - super().__init__(*list(args[0])) + position = list(args[0]) # Values elif 1 <= len(args) <= 3 and all([isinstance(v, (float, int)) for v in args]): position = list(args) + [0] * (3 - len(args)) - super().__init__(tuple(position)) + + if "X" in kwargs: + position[0] = kwargs["X"] + if "Y" in kwargs: + position[1] = kwargs["Y"] + if "Z" in kwargs: + position[2] = kwargs["Z"] + + super().__init__(tuple(position)) class Rot(Location): diff --git a/src/build123d/topology.py b/src/build123d/topology.py index 22ed39e..921a4d0 100644 --- a/src/build123d/topology.py +++ b/src/build123d/topology.py @@ -1097,7 +1097,7 @@ class Shape(NodeMixin): joints: dict[str, Joint] = None, parent: Compound = None, children: list[Shape] = None, - is_alg: bool = False, + is_alg: bool = True, ): self.wrapped = downcast(obj) if obj else None self.for_construction = False @@ -3263,7 +3263,7 @@ class AlgebraMixin: f"Cannot combine objects of different dimensionality: {self._dim} and {objs[0]._dim}" ) - if self._dim == 0: # Cover addition of empty BuildPart with another object + if not self.wrapped: # Cover addition of empty BuildPart with another object if mode == Mode.ADD: if len(objs) == 1: compound = copy.deepcopy(objs[0])