OpenSCAD use Part::Prism

This commit is contained in:
Sebastian Hoogen
2013-09-23 09:36:45 +02:00
committed by Yorik van Havre
parent 34cce64edc
commit cf2d437c73
3 changed files with 38 additions and 23 deletions

View File

@@ -141,6 +141,16 @@ def process_object(csg,ob):
if mm == 1 : csg.write("}\n")
else : # Cannot convert to rotate extrude so best effort is polyhedron
csg.write('%s\n' % shape2polyhedron(ob.Shape))
elif ob.TypeId == "Part::Prism":
import math
f = str(ob.Polygon)
# r = str(ob.Length/2.0/math.sin(math.pi/ob.Polygon))
r = str(ob.Length) #length seems to be the outer radius
h = str(ob.Height)
mm = check_multmatrix(csg,ob,0,0,-float(h)/2)
csg.write("cylinder($fn = "+f+", "+fafs+", h = "+h+", r1 = "+r+\
", r2 = "+r+", center = "+center(mm)+");\n")
if mm == 1: csg.write("}\n")
elif ob.TypeId == "Part::Extrusion" :
print "Extrusion"