From 9b87ceae30e2bd54054cd99039737016bb65c27c Mon Sep 17 00:00:00 2001 From: Roger Maitland Date: Mon, 9 Feb 2026 10:42:09 -0500 Subject: [PATCH] Elminate base class move/rotate when values are zero --- src/build123d/objects_part.py | 8 ++++++-- src/build123d/objects_sketch.py | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/build123d/objects_part.py b/src/build123d/objects_part.py index bd0b238..b062f70 100644 --- a/src/build123d/objects_part.py +++ b/src/build123d/objects_part.py @@ -87,14 +87,18 @@ class BasePartObject(Part): rotate = Rotation(*rotation) if isinstance(rotation, tuple) else rotation self.rotation = rotate if context is None: - new_solids = [part.moved(rotate)] + new_solids = [part.moved(rotate)] if rotate != Rotation() else [part] else: self.mode = mode if not LocationList._get_context(): raise RuntimeError("No valid context found") new_solids = [ - part.moved(location * rotate) + ( + part.moved(location * rotate) + if rotate != Rotation() or location != Location() + else part + ) for location in LocationList._get_context().locations ] if isinstance(context, BuildPart): diff --git a/src/build123d/objects_sketch.py b/src/build123d/objects_sketch.py index 8a3538c..556ca89 100644 --- a/src/build123d/objects_sketch.py +++ b/src/build123d/objects_sketch.py @@ -88,16 +88,20 @@ class BaseSketchObject(Sketch): context: BuildSketch | None = BuildSketch._get_context(self, log=False) if context is None: - new_faces = obj.moved(Rotation(0, 0, rotation)).faces() + new_faces = ( + obj.moved(Rotation(0, 0, rotation)).faces() + if rotation != 0 + else obj.faces() + ) else: self.rotation = rotation self.mode = mode - obj = obj.moved(Rotation(0, 0, rotation)) + obj = obj.moved(Rotation(0, 0, rotation)) if rotation != 0 else obj new_faces = ShapeList( - face.moved(location) + face.moved(location) if location != Location() else face for face in obj.faces() for location in LocationList._get_context().local_locations ) @@ -550,7 +554,7 @@ class Text(BaseSketchObject): "Arial Black". Alternatively, a specific font file can be specified with font_path. Use `available_fonts()` to list available font names for `font` and FontStyles. - Note: on Windows, fonts must be installed with "Install for all users" to be found + Note: on Windows, fonts must be installed with "Install for all users" to be found by name. Not all fonts have every FontStyle available, however ITALIC and BOLDITALIC will