From ea26397b8394ac1f72fafe6b8c61dc1ebaf4bca9 Mon Sep 17 00:00:00 2001 From: hyOzd Date: Sun, 19 Jul 2015 10:08:20 +0300 Subject: [PATCH] added simplify API that calls freecad's removeSplitter() function to clean faces from unwanted edges --- cadquery/CQ.py | 8 ++++++++ cadquery/freecad_impl/shapes.py | 3 +++ 2 files changed, 11 insertions(+) diff --git a/cadquery/CQ.py b/cadquery/CQ.py index 20d190c..77ebc51 100644 --- a/cadquery/CQ.py +++ b/cadquery/CQ.py @@ -2355,3 +2355,11 @@ class Workplane(CQ): return spheres else: return self.union(spheres) + + def simplify(self): + solidRef = self.findSolid(searchStack=True, searchParents=True) + if solidRef: + t = solidRef.simplify() + return self.newObject([t]) + else: + raise ValueError("There is no solid to simplify!") diff --git a/cadquery/freecad_impl/shapes.py b/cadquery/freecad_impl/shapes.py index e0f2ecf..a992210 100644 --- a/cadquery/freecad_impl/shapes.py +++ b/cadquery/freecad_impl/shapes.py @@ -802,6 +802,9 @@ class Solid(Shape): def fuse(self, solidToJoin): return Shape.cast(self.wrapped.fuse(solidToJoin.wrapped)) + def simplify(self): + return Shape.cast(self.wrapped.removeSplitter()) + def fillet(self, radius, edgeList): """ Fillets the specified edges of this solid.