From 27a2e52d669196b6944fa53a3932d5412ff25a69 Mon Sep 17 00:00:00 2001 From: Sebastian Hoogen Date: Wed, 14 May 2014 19:11:36 +0200 Subject: [PATCH] + fixes #0001537: python function to apply a placement to a shape --- src/Mod/OpenSCAD/OpenSCADUtils.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Mod/OpenSCAD/OpenSCADUtils.py b/src/Mod/OpenSCAD/OpenSCADUtils.py index 10f8899111ba..238e0d9d2216 100644 --- a/src/Mod/OpenSCAD/OpenSCADUtils.py +++ b/src/Mod/OpenSCAD/OpenSCADUtils.py @@ -555,3 +555,21 @@ def addsubobjs(obj,toremoveset): checkinlistcomplete = True for obj in toremove: obj.Document.removeObject(obj.Name) + +def applyPlacement(shape): + if shape.Placement.isNull(): + return shape + else: + import Part + if shape.ShapeType == 'Solid': + return Part.Solid(shape.childShapes()[0]) + elif shape.ShapeType == 'Face': + return Part.Face(shape.childShapes()) + elif shape.ShapeType == 'Compound': + return Part.Compound(shape.childShapes()) + elif shape.ShapeType == 'Wire': + return Part.Wire(shape.childShapes()) + elif shape.ShapeType == 'Shell': + return Part.Shell(shape.childShapes()) + else: + raise ValueError('Unsupported shape type')