From 20c94bbb3f45df3a70e7f40568339a3bcc3d3800 Mon Sep 17 00:00:00 2001 From: Nejc Jurkovic Date: Thu, 13 Jun 2024 12:02:59 +0200 Subject: [PATCH] Add option to remove_inner_edges() from a specific sketch --- examples/shape/cylinder.py | 4 ++++ src/classy_blocks/construct/shapes/round.py | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/shape/cylinder.py b/examples/shape/cylinder.py index 7e2839c..50b573a 100644 --- a/examples/shape/cylinder.py +++ b/examples/shape/cylinder.py @@ -17,6 +17,10 @@ cylinder.set_end_patch("outlet") cylinder.set_outer_patch("walls") +# if curved core edges get in the way (when moving vertices, optimization, ...), +# remove them with this method: +cylinder.remove_inner_edges(start=False, end=True) + bl_thickness = 0.05 core_size = 0.2 diff --git a/src/classy_blocks/construct/shapes/round.py b/src/classy_blocks/construct/shapes/round.py index e71de55..f034df8 100644 --- a/src/classy_blocks/construct/shapes/round.py +++ b/src/classy_blocks/construct/shapes/round.py @@ -71,12 +71,17 @@ def set_outer_patch(self, name: str) -> None: for operation in self.shell: operation.set_patch(self.outer_patch, name) - def remove_inner_edges(self) -> None: + def remove_inner_edges(self, start: bool = True, end: bool = True) -> None: """Removes spline edges from cylinders. This needs to be done in cases where any of the start/end plane points will move (due to optimization or manual adjustments).""" - for face in (*self.sketch_1.core, *self.sketch_2.core): - face.remove_edges() + if start: + for face in self.sketch_1.core: + face.remove_edges() + + if end: + for face in self.sketch_2.core: + face.remove_edges() class RoundHollowShape(RoundSolidShape):