From 70e0c14da8a5f400437ca339ecd9c5d8a24b7cfe Mon Sep 17 00:00:00 2001 From: Roger Maitland Date: Tue, 16 May 2023 09:07:03 -0400 Subject: [PATCH] Moved extrude until previous/first to extrude_until method --- src/build123d/operations_part.py | 6 +----- src/build123d/topology.py | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/build123d/operations_part.py b/src/build123d/operations_part.py index 6cbcf96..6137b59 100644 --- a/src/build123d/operations_part.py +++ b/src/build123d/operations_part.py @@ -110,15 +110,11 @@ def extrude( for face in to_extrude_faces ] - flip_direction = 1 if until is not None: if target is None and context is None: raise ValueError("A target object must be provided") if target is None: target = context.part - if until in [Until.PREVIOUS, Until.FIRST]: - flip_direction = -1 - until = Until.NEXT if until == Until.PREVIOUS else Until.LAST logger.info( "%d face(s) to extrude on %d face plane(s)", @@ -141,7 +137,7 @@ def extrude( Solid.extrude_until( section=face, target_object=target, - direction=plane.z_dir * direction * flip_direction, + direction=plane.z_dir * direction, until=until, ) ) diff --git a/src/build123d/topology.py b/src/build123d/topology.py index 34bee6b..0ba2c1c 100644 --- a/src/build123d/topology.py +++ b/src/build123d/topology.py @@ -5326,6 +5326,9 @@ class Solid(Shape, Mixin3D): Union[Compound, Solid]: extruded Face """ direction = Vector(direction) + if until in [Until.PREVIOUS, Until.FIRST]: + direction *= -1 + until = Until.NEXT if until == Until.PREVIOUS else Until.LAST max_dimension = ( Compound.make_compound([section, target_object]).bounding_box().diagonal