From 9da3ea3c9f8cd178f6cbc5144875214ec02d4b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Yavuz=20=C3=96ZDERYA?= Date: Tue, 1 Sep 2015 21:34:20 +0300 Subject: [PATCH 1/2] refactor clean() to support objects other than Solid --- cadquery/CQ.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cadquery/CQ.py b/cadquery/CQ.py index 4596949..7504b16 100644 --- a/cadquery/CQ.py +++ b/cadquery/CQ.py @@ -2409,9 +2409,8 @@ class Workplane(CQ): `clean` may fail to produce a clean output in some cases such as spherical faces. """ - solidRef = self.findSolid(searchStack=True, searchParents=True) - if solidRef: - t = solidRef.clean() - return self.newObject([t]) - else: - raise ValueError("There is no solid to clean!") + try: + cleanObjects = [obj.clean() for obj in self.objects] + except AttributeError: + raise AttributeError("%s object doesn't support `clean()` method!" % obj.ShapeType()) + return self.newObject(cleanObjects) From 0aba11650589f311f743c636bb758d858aa8b22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hasan=20Yavuz=20=C3=96ZDERYA?= Date: Tue, 1 Sep 2015 21:56:22 +0300 Subject: [PATCH 2/2] added dummy `clean()` methods for Wire and Compound types --- cadquery/freecad_impl/shapes.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cadquery/freecad_impl/shapes.py b/cadquery/freecad_impl/shapes.py index f5bad41..9b149fd 100644 --- a/cadquery/freecad_impl/shapes.py +++ b/cadquery/freecad_impl/shapes.py @@ -481,6 +481,9 @@ class Wire(Shape): """ return Wire(FreeCADPart.makeHelix(pitch, height, radius, angle)) + def clean(self): + """This method is not implemented yet.""" + return self class Face(Shape): def __init__(self, obj): @@ -882,3 +885,7 @@ class Compound(Shape): def tessellate(self, tolerance): return self.wrapped.tessellate(tolerance) + + def clean(self): + """This method is not implemented yet.""" + return self