From c1f5582da82f1858ce21cea57af4464b5ad8d48c Mon Sep 17 00:00:00 2001 From: Sebastian Hoogen Date: Mon, 9 Jun 2014 22:06:33 +0200 Subject: [PATCH] support for Part::Loft in exportDRAWEXE --- src/Mod/OpenSCAD/exportDRAWEXE.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Mod/OpenSCAD/exportDRAWEXE.py b/src/Mod/OpenSCAD/exportDRAWEXE.py index e4d1a4600..bfe7d62d2 100644 --- a/src/Mod/OpenSCAD/exportDRAWEXE.py +++ b/src/Mod/OpenSCAD/exportDRAWEXE.py @@ -118,7 +118,7 @@ def saveSweep(csg,ob,filename): elif sh.ShapeType == 'Face': sh = sh.OuterWire else: - raise ValueError + raise ValueError('Unrecognized Shape Type') hasplacement = saveShape(csg,filename,sh,sectionname,None) # placement with shape csg.write('addsweep %s %s\n' % (sectionname," ".join(addoptions))) csg.write('buildsweep %s %s\n' % (ob.Name," ".join(buildoptions))) @@ -284,7 +284,33 @@ def process_object(csg,ob,filename): f2s(ob.Height.Value))) elif ob.TypeId == "Part::Sweep" and True: saveSweep(csg,ob,filename) - + elif ob.TypeId == "Part::Loft": + sectionnames=[] + for i,subobj in enumerate(ob.Sections): + sh = subobj.Shape + if not sh.isNull(): + if sh.ShapeType == 'Compound': + sh = sh.Shape.childShapes()[0] + if sh.ShapeType == 'Face': + sh = sh.OuterWire + elif sh.ShapeType == 'Edge': + import Part + sh = Part.Wire([sh]) + elif sh.ShapeType == 'Wire': + import Part + sh = Part.Wire(sh) + elif sh.ShapeType == 'Vertex': + pass + else: + raise ValueError('Unsuitabel Shape Type') + sectionname = '%s-%02d-section' % (ob.Name,i) + hasplacement = saveShape(csg,filename, sh,sectionname,None) + # placement with shape + sectionnames.append(sectionname) + if ob.Closed: + sectionnames.append(sectionnames[0]) + csg.write('thrusections %s %d %d %s\n' % (ob.Name,int(ob.Solid),\ + int(ob.Ruled), ' '.join(sectionnames))) elif isDeform(ob): #non-uniform scaling m=ob.Matrix process_object(csg,ob.Base,filename)