OpenSCAD: import surfaces

This commit is contained in:
Sebastian Hoogen 2014-02-18 10:53:12 +01:00 committed by Yorik van Havre
parent 8b2134705a
commit 7a7fd33672
2 changed files with 12 additions and 1 deletions

View File

@ -502,4 +502,4 @@ def makeSurfaceVolume(filename):
f4=Part.Face(Part.Wire([plane.Edges[3],l2.Edges[0],s.uIso(1).toShape(),l4.Edges[0]]))
f5=s.toShape().Faces[0]
solid=Part.Solid(Part.Shell([f0,f1,f2,f3,f4,f5]))
return solid,(len(coords[0])-1)/2.0,(len(choords)-1)/2.0
return solid,(len(coords[0])-1)/2.0,(len(coords)-1)/2.0

View File

@ -335,6 +335,7 @@ def p_operation(p):
| linear_extrude_with_twist
| rotate_extrude_file
| import_file1
| surface_action
| projection_action
| hull_action
| minkowski_action
@ -629,6 +630,16 @@ def p_import_file1(p):
p[0] = [process_import_file(filen,ext,p[3]['layer'])]
if printverbose: print "End Import File"
def p_surface_action(p):
'surface_action : surface LPAREN keywordargument_list RPAREN SEMICOL'
if printverbose: print "Surface"
obj = doc.addObject("Part::Feature",'surface')
obj.Shape,xoff,yoff=makeSurfaceVolume(p[3]['file'])
if p[3]['center']=='true' :
center(obj,xoff,yoff,0.0)
p[0] = [obj]
if printverbose: print "End surface"
def process_import_file(fname,ext,layer):
if printverbose: print "Importing : "+fname+"."+ext+" Layer : "+layer
if ext.lower() in reverseimporttypes()['Mesh']: