disable print in importCSG to reduce distraction
This commit is contained in:
parent
e157152c96
commit
8589894691
|
@ -31,12 +31,14 @@ __title__="FreeCAD OpenSCAD Workbench - CSG importer Version 0.05d"
|
||||||
__author__ = "Keith Sloan <keith@sloan-home.co.uk>"
|
__author__ = "Keith Sloan <keith@sloan-home.co.uk>"
|
||||||
__url__ = ["http://www.sloan-home.co.uk/ImportCSG"]
|
__url__ = ["http://www.sloan-home.co.uk/ImportCSG"]
|
||||||
|
|
||||||
|
printverbose = False
|
||||||
|
|
||||||
import FreeCAD, os, sys
|
import FreeCAD, os, sys
|
||||||
if FreeCAD.GuiUp:
|
if FreeCAD.GuiUp:
|
||||||
import FreeCADGui
|
import FreeCADGui
|
||||||
gui = True
|
gui = True
|
||||||
else:
|
else:
|
||||||
print "FreeCAD Gui not present."
|
if printverbose: print "FreeCAD Gui not present."
|
||||||
gui = False
|
gui = False
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,29 +119,29 @@ def insert(filename,docname):
|
||||||
def processcsg(filename):
|
def processcsg(filename):
|
||||||
global doc
|
global doc
|
||||||
|
|
||||||
print 'ImportCSG Version 0.5d'
|
if printverbose: print 'ImportCSG Version 0.5d'
|
||||||
# Build the lexer
|
# Build the lexer
|
||||||
print 'Start Lex'
|
if printverbose: print 'Start Lex'
|
||||||
lex.lex(module=tokrules)
|
lex.lex(module=tokrules)
|
||||||
print 'End Lex'
|
if printverbose: print 'End Lex'
|
||||||
|
|
||||||
# Build the parser
|
# Build the parser
|
||||||
print 'Load Parser'
|
if printverbose: print 'Load Parser'
|
||||||
# No debug out otherwise Linux has protection exception
|
# No debug out otherwise Linux has protection exception
|
||||||
parser = yacc.yacc(debug=0)
|
parser = yacc.yacc(debug=0)
|
||||||
print 'Parser Loaded'
|
if printverbose: print 'Parser Loaded'
|
||||||
# Give the lexer some input
|
# Give the lexer some input
|
||||||
#f=open('test.scad', 'r')
|
#f=open('test.scad', 'r')
|
||||||
f = pythonopen(filename, 'r')
|
f = pythonopen(filename, 'r')
|
||||||
#lexer.input(f.read())
|
#lexer.input(f.read())
|
||||||
|
|
||||||
print 'Start Parser'
|
if printverbose: print 'Start Parser'
|
||||||
# Swap statements to enable Parser debugging
|
# Swap statements to enable Parser debugging
|
||||||
#result = parser.parse(f.read(),debug=1)
|
#result = parser.parse(f.read(),debug=1)
|
||||||
result = parser.parse(f.read())
|
result = parser.parse(f.read())
|
||||||
print 'End Parser'
|
if printverbose: print 'End Parser'
|
||||||
print result
|
if printverbose: print result
|
||||||
FreeCAD.Console.PrintMessage('End processing CSG file')
|
FreeCAD.Console.PrintMessage('End processing CSG file\n')
|
||||||
doc.recompute()
|
doc.recompute()
|
||||||
|
|
||||||
def p_block_list_(p):
|
def p_block_list_(p):
|
||||||
|
@ -149,23 +151,23 @@ def p_block_list_(p):
|
||||||
| statementwithmod
|
| statementwithmod
|
||||||
| block_list statementwithmod
|
| block_list statementwithmod
|
||||||
'''
|
'''
|
||||||
print "Block List"
|
if printverbose: print "Block List"
|
||||||
print p[1]
|
if printverbose: print p[1]
|
||||||
if(len(p) > 2) :
|
if(len(p) > 2) :
|
||||||
print p[2]
|
if printverbose: print p[2]
|
||||||
p[0] = p[1] + p[2]
|
p[0] = p[1] + p[2]
|
||||||
else :
|
else :
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
print "End Block List"
|
if printverbose: print "End Block List"
|
||||||
|
|
||||||
def p_render_action(p):
|
def p_render_action(p):
|
||||||
'render_action : render LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
'render_action : render LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
||||||
print "Render (ignored)"
|
if printverbose: print "Render (ignored)"
|
||||||
p[0] = p[6]
|
p[0] = p[6]
|
||||||
|
|
||||||
def p_group_action1(p):
|
def p_group_action1(p):
|
||||||
'group_action1 : group LPAREN RPAREN OBRACE block_list EBRACE'
|
'group_action1 : group LPAREN RPAREN OBRACE block_list EBRACE'
|
||||||
print "Group"
|
if printverbose: print "Group"
|
||||||
# Test if need for implicit fuse
|
# Test if need for implicit fuse
|
||||||
if (len(p[5]) > 1) :
|
if (len(p[5]) > 1) :
|
||||||
p[0] = [fuse(p[5],"Group")]
|
p[0] = [fuse(p[5],"Group")]
|
||||||
|
@ -174,7 +176,7 @@ def p_group_action1(p):
|
||||||
|
|
||||||
def p_group_action2(p) :
|
def p_group_action2(p) :
|
||||||
'group_action2 : group LPAREN RPAREN SEMICOL'
|
'group_action2 : group LPAREN RPAREN SEMICOL'
|
||||||
print "Group2"
|
if printverbose: print "Group2"
|
||||||
p[0] = []
|
p[0] = []
|
||||||
|
|
||||||
def p_boolean(p) :
|
def p_boolean(p) :
|
||||||
|
@ -240,7 +242,7 @@ def p_part(p):
|
||||||
def p_2d_point(p):
|
def p_2d_point(p):
|
||||||
'2d_point : OSQUARE NUMBER COMMA NUMBER ESQUARE'
|
'2d_point : OSQUARE NUMBER COMMA NUMBER ESQUARE'
|
||||||
global points_list
|
global points_list
|
||||||
print "2d Point"
|
if printverbose: print "2d Point"
|
||||||
p[0] = [float(p[2]),float(p[4])]
|
p[0] = [float(p[2]),float(p[4])]
|
||||||
|
|
||||||
def p_points_list_2d(p):
|
def p_points_list_2d(p):
|
||||||
|
@ -250,20 +252,22 @@ def p_points_list_2d(p):
|
||||||
| points_list_2d 2d_point
|
| points_list_2d 2d_point
|
||||||
'''
|
'''
|
||||||
if p[2] == ',' :
|
if p[2] == ',' :
|
||||||
|
if printverbose:
|
||||||
print "Start List"
|
print "Start List"
|
||||||
print p[1]
|
print p[1]
|
||||||
p[0] = [p[1]]
|
p[0] = [p[1]]
|
||||||
else :
|
else :
|
||||||
|
if printverbose:
|
||||||
print p[1]
|
print p[1]
|
||||||
print p[2]
|
print p[2]
|
||||||
p[1].append(p[2])
|
p[1].append(p[2])
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
print p[0]
|
if printverbose: print p[0]
|
||||||
|
|
||||||
def p_3d_point(p):
|
def p_3d_point(p):
|
||||||
'3d_point : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
'3d_point : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
||||||
global points_list
|
global points_list
|
||||||
print "3d point"
|
if printverbose: print "3d point"
|
||||||
p[0] = [p[2],p[4],p[6]]
|
p[0] = [p[2],p[4],p[6]]
|
||||||
|
|
||||||
def p_points_list_3d(p):
|
def p_points_list_3d(p):
|
||||||
|
@ -273,15 +277,15 @@ def p_points_list_3d(p):
|
||||||
| points_list_3d 3d_point
|
| points_list_3d 3d_point
|
||||||
'''
|
'''
|
||||||
if p[2] == ',' :
|
if p[2] == ',' :
|
||||||
print "Start List"
|
if printverbose: print "Start List"
|
||||||
print p[1]
|
if printverbose: print p[1]
|
||||||
p[0] = [p[1]]
|
p[0] = [p[1]]
|
||||||
else :
|
else :
|
||||||
print p[1]
|
if printverbose: print p[1]
|
||||||
print p[2]
|
if printverbose: print p[2]
|
||||||
p[1].append(p[2])
|
p[1].append(p[2])
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
print p[0]
|
if printverbose: print p[0]
|
||||||
|
|
||||||
def p_path_points(p):
|
def p_path_points(p):
|
||||||
'''
|
'''
|
||||||
|
@ -289,24 +293,24 @@ def p_path_points(p):
|
||||||
| path_points NUMBER COMMA
|
| path_points NUMBER COMMA
|
||||||
| path_points NUMBER
|
| path_points NUMBER
|
||||||
'''
|
'''
|
||||||
print "Path point"
|
if printverbose: print "Path point"
|
||||||
if p[2] == ',' :
|
if p[2] == ',' :
|
||||||
print 'Start list'
|
if printverbose: print 'Start list'
|
||||||
print p[1]
|
if printverbose: print p[1]
|
||||||
p[0] = [int(p[1])]
|
p[0] = [int(p[1])]
|
||||||
else :
|
else :
|
||||||
print p[1]
|
if printverbose: print p[1]
|
||||||
print len(p[1])
|
if printverbose: print len(p[1])
|
||||||
print p[2]
|
if printverbose: print p[2]
|
||||||
p[1].append(int(p[2]))
|
p[1].append(int(p[2]))
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
print p[0]
|
if printverbose: print p[0]
|
||||||
|
|
||||||
|
|
||||||
def p_path_list(p):
|
def p_path_list(p):
|
||||||
'path_list : OSQUARE path_points ESQUARE'
|
'path_list : OSQUARE path_points ESQUARE'
|
||||||
print 'Path List '
|
if printverbose: print 'Path List '
|
||||||
print p[2]
|
if printverbose: print p[2]
|
||||||
p[0] = p[2]
|
p[0] = p[2]
|
||||||
|
|
||||||
def p_path_set(p) :
|
def p_path_set(p) :
|
||||||
|
@ -314,14 +318,14 @@ def p_path_set(p) :
|
||||||
path_set : path_list
|
path_set : path_list
|
||||||
| path_set COMMA path_list
|
| path_set COMMA path_list
|
||||||
'''
|
'''
|
||||||
print 'Path Set'
|
if printverbose: print 'Path Set'
|
||||||
print len(p)
|
if printverbose: print len(p)
|
||||||
if len(p) == 2 :
|
if len(p) == 2 :
|
||||||
p[0] = [p[1]]
|
p[0] = [p[1]]
|
||||||
else :
|
else :
|
||||||
p[1].append(p[3])
|
p[1].append(p[3])
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
print p[0]
|
if printverbose: print p[0]
|
||||||
|
|
||||||
def p_operation(p):
|
def p_operation(p):
|
||||||
'''
|
'''
|
||||||
|
@ -348,7 +352,7 @@ def p_not_supported(p):
|
||||||
|
|
||||||
def p_size_vector(p):
|
def p_size_vector(p):
|
||||||
'size_vector : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
'size_vector : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
||||||
print "size vector"
|
if printverbose: print "size vector"
|
||||||
p[0] = [p[2],p[4],p[6]]
|
p[0] = [p[2],p[4],p[6]]
|
||||||
|
|
||||||
def p_keywordargument(p):
|
def p_keywordargument(p):
|
||||||
|
@ -360,7 +364,7 @@ def p_keywordargument(p):
|
||||||
| ID EQ stripped_string
|
| ID EQ stripped_string
|
||||||
'''
|
'''
|
||||||
p[0] = (p[1],p[3])
|
p[0] = (p[1],p[3])
|
||||||
print p[0]
|
if printverbose: print p[0]
|
||||||
|
|
||||||
def p_keywordargument_list(p):
|
def p_keywordargument_list(p):
|
||||||
'''
|
'''
|
||||||
|
@ -376,7 +380,7 @@ def p_keywordargument_list(p):
|
||||||
def p_color_action(p):
|
def p_color_action(p):
|
||||||
'color_action : color LPAREN vector RPAREN OBRACE block_list EBRACE'
|
'color_action : color LPAREN vector RPAREN OBRACE block_list EBRACE'
|
||||||
import math
|
import math
|
||||||
print "Color"
|
if printverbose: print "Color"
|
||||||
color = tuple([float(f) for f in p[3][:3]]) #RGB
|
color = tuple([float(f) for f in p[3][:3]]) #RGB
|
||||||
transp = 100 - int(math.floor(100*float(p[3][3]))) #Alpha
|
transp = 100 - int(math.floor(100*float(p[3][3]))) #Alpha
|
||||||
if gui:
|
if gui:
|
||||||
|
@ -387,25 +391,25 @@ def p_color_action(p):
|
||||||
|
|
||||||
# Error rule for syntax errors
|
# Error rule for syntax errors
|
||||||
def p_error(p):
|
def p_error(p):
|
||||||
print "Syntax error in input!"
|
if printverbose: print "Syntax error in input!"
|
||||||
print p
|
if printverbose: print p
|
||||||
|
|
||||||
def fuse(lst,name):
|
def fuse(lst,name):
|
||||||
global doc
|
global doc
|
||||||
print "Fuse"
|
if printverbose: print "Fuse"
|
||||||
print lst
|
if printverbose: print lst
|
||||||
if len(lst) == 1:
|
if len(lst) == 1:
|
||||||
return lst[0]
|
return lst[0]
|
||||||
# Is this Multi Fuse
|
# Is this Multi Fuse
|
||||||
elif len(lst) > 2:
|
elif len(lst) > 2:
|
||||||
print "Multi Fuse"
|
if printverbose: print "Multi Fuse"
|
||||||
myfuse = doc.addObject('Part::MultiFuse',name)
|
myfuse = doc.addObject('Part::MultiFuse',name)
|
||||||
myfuse.Shapes = lst
|
myfuse.Shapes = lst
|
||||||
if gui:
|
if gui:
|
||||||
for subobj in myfuse.Shapes:
|
for subobj in myfuse.Shapes:
|
||||||
subobj.ViewObject.hide()
|
subobj.ViewObject.hide()
|
||||||
else:
|
else:
|
||||||
print "Single Fuse"
|
if printverbose: print "Single Fuse"
|
||||||
myfuse = doc.addObject('Part::Fuse',name)
|
myfuse = doc.addObject('Part::Fuse',name)
|
||||||
myfuse.Base = lst[0]
|
myfuse.Base = lst[0]
|
||||||
myfuse.Tool = lst[1]
|
myfuse.Tool = lst[1]
|
||||||
|
@ -416,18 +420,18 @@ def fuse(lst,name):
|
||||||
|
|
||||||
def p_union_action(p):
|
def p_union_action(p):
|
||||||
'union_action : union LPAREN RPAREN OBRACE block_list EBRACE'
|
'union_action : union LPAREN RPAREN OBRACE block_list EBRACE'
|
||||||
print "union"
|
if printverbose: print "union"
|
||||||
newpart = fuse(p[5],p[1])
|
newpart = fuse(p[5],p[1])
|
||||||
print "Push Union Result"
|
if printverbose: print "Push Union Result"
|
||||||
p[0] = [newpart]
|
p[0] = [newpart]
|
||||||
print "End Union"
|
if printverbose: print "End Union"
|
||||||
|
|
||||||
def p_difference_action(p):
|
def p_difference_action(p):
|
||||||
'difference_action : difference LPAREN RPAREN OBRACE block_list EBRACE'
|
'difference_action : difference LPAREN RPAREN OBRACE block_list EBRACE'
|
||||||
|
|
||||||
print "difference"
|
if printverbose: print "difference"
|
||||||
print len(p[5])
|
if printverbose: print len(p[5])
|
||||||
print p[5]
|
if printverbose: print p[5]
|
||||||
if (len(p[5]) == 1 ): #single object
|
if (len(p[5]) == 1 ): #single object
|
||||||
p[0] = p[5]
|
p[0] = p[5]
|
||||||
else:
|
else:
|
||||||
|
@ -436,31 +440,31 @@ def p_difference_action(p):
|
||||||
mycut.Base = p[5][0]
|
mycut.Base = p[5][0]
|
||||||
# Can only Cut two objects do we need to fuse extras
|
# Can only Cut two objects do we need to fuse extras
|
||||||
if (len(p[5]) > 2 ):
|
if (len(p[5]) > 2 ):
|
||||||
print "Need to Fuse Extra First"
|
if printverbose: print "Need to Fuse Extra First"
|
||||||
mycut.Tool = fuse(p[5][1:],'union')
|
mycut.Tool = fuse(p[5][1:],'union')
|
||||||
else :
|
else :
|
||||||
mycut.Tool = p[5][1]
|
mycut.Tool = p[5][1]
|
||||||
if gui:
|
if gui:
|
||||||
mycut.Base.ViewObject.hide()
|
mycut.Base.ViewObject.hide()
|
||||||
mycut.Tool.ViewObject.hide()
|
mycut.Tool.ViewObject.hide()
|
||||||
print "Push Resulting Cut"
|
if printverbose: print "Push Resulting Cut"
|
||||||
p[0] = [mycut]
|
p[0] = [mycut]
|
||||||
print "End Cut"
|
if printverbose: print "End Cut"
|
||||||
|
|
||||||
def p_intersection_action(p):
|
def p_intersection_action(p):
|
||||||
'intersection_action : intersection LPAREN RPAREN OBRACE block_list EBRACE'
|
'intersection_action : intersection LPAREN RPAREN OBRACE block_list EBRACE'
|
||||||
|
|
||||||
print "intersection"
|
if printverbose: print "intersection"
|
||||||
# Is this Multi Common
|
# Is this Multi Common
|
||||||
if (len(p[5]) > 2):
|
if (len(p[5]) > 2):
|
||||||
print "Multi Common"
|
if printverbose: print "Multi Common"
|
||||||
mycommon = doc.addObject('Part::MultiCommon',p[1])
|
mycommon = doc.addObject('Part::MultiCommon',p[1])
|
||||||
mycommon.Shapes = p[5]
|
mycommon.Shapes = p[5]
|
||||||
if gui:
|
if gui:
|
||||||
for subobj in mycommon.Shapes:
|
for subobj in mycommon.Shapes:
|
||||||
subobj.ViewObject.hide()
|
subobj.ViewObject.hide()
|
||||||
else :
|
else :
|
||||||
print "Single Common"
|
if printverbose: print "Single Common"
|
||||||
mycommon = doc.addObject('Part::Common',p[1])
|
mycommon = doc.addObject('Part::Common',p[1])
|
||||||
mycommon.Base = p[5][0]
|
mycommon.Base = p[5][0]
|
||||||
mycommon.Tool = p[5][1]
|
mycommon.Tool = p[5][1]
|
||||||
|
@ -469,7 +473,7 @@ def p_intersection_action(p):
|
||||||
mycommon.Tool.ViewObject.hide()
|
mycommon.Tool.ViewObject.hide()
|
||||||
|
|
||||||
p[0] = [mycommon]
|
p[0] = [mycommon]
|
||||||
print "End Intersection"
|
if printverbose: print "End Intersection"
|
||||||
|
|
||||||
def process_rotate_extrude(obj):
|
def process_rotate_extrude(obj):
|
||||||
myrev = doc.addObject("Part::Revolution","RotateExtrude")
|
myrev = doc.addObject("Part::Revolution","RotateExtrude")
|
||||||
|
@ -494,21 +498,21 @@ def process_rotate_extrude(obj):
|
||||||
|
|
||||||
def p_rotate_extrude_action(p):
|
def p_rotate_extrude_action(p):
|
||||||
'rotate_extrude_action : rotate_extrude LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
'rotate_extrude_action : rotate_extrude LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
||||||
print "Rotate Extrude"
|
if printverbose: print "Rotate Extrude"
|
||||||
if (len(p[6]) > 1) :
|
if (len(p[6]) > 1) :
|
||||||
part = fuse(p[6],"Rotate Extrude Union")
|
part = fuse(p[6],"Rotate Extrude Union")
|
||||||
else :
|
else :
|
||||||
part = p[6][0]
|
part = p[6][0]
|
||||||
p[0] = [process_rotate_extrude(part)]
|
p[0] = [process_rotate_extrude(part)]
|
||||||
print "End Rotate Extrude"
|
if printverbose: print "End Rotate Extrude"
|
||||||
|
|
||||||
def p_rotate_extrude_file(p):
|
def p_rotate_extrude_file(p):
|
||||||
'rotate_extrude_file : rotate_extrude LPAREN keywordargument_list RPAREN SEMICOL'
|
'rotate_extrude_file : rotate_extrude LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
print "Rotate Extrude File"
|
if printverbose: print "Rotate Extrude File"
|
||||||
filen,ext =p[3]['file'] .rsplit('.',1)
|
filen,ext =p[3]['file'] .rsplit('.',1)
|
||||||
obj = process_import_file(filen,ext,p[3]['layer'])
|
obj = process_import_file(filen,ext,p[3]['layer'])
|
||||||
p[0] = [process_rotate_extrude(obj)]
|
p[0] = [process_rotate_extrude(obj)]
|
||||||
print "End Rotate Extrude File"
|
if printverbose: print "End Rotate Extrude File"
|
||||||
|
|
||||||
def process_linear_extrude(obj,h) :
|
def process_linear_extrude(obj,h) :
|
||||||
mylinear = doc.addObject("Part::Extrusion","LinearExtrude")
|
mylinear = doc.addObject("Part::Extrusion","LinearExtrude")
|
||||||
|
@ -549,9 +553,9 @@ def process_linear_extrude_with_twist(base,height,twist) :
|
||||||
|
|
||||||
def p_linear_extrude_with_twist(p):
|
def p_linear_extrude_with_twist(p):
|
||||||
'linear_extrude_with_twist : linear_extrude LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
'linear_extrude_with_twist : linear_extrude LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
||||||
print "Linear Extrude With Twist"
|
if printverbose: print "Linear Extrude With Twist"
|
||||||
h = float(p[3]['height'])
|
h = float(p[3]['height'])
|
||||||
print "Twist : ",p[3]
|
if printverbose: print "Twist : ",p[3]
|
||||||
if 'twist' in p[3]:
|
if 'twist' in p[3]:
|
||||||
t = float(p[3]['twist'])
|
t = float(p[3]['twist'])
|
||||||
else:
|
else:
|
||||||
|
@ -566,23 +570,23 @@ def p_linear_extrude_with_twist(p):
|
||||||
p[0] = [process_linear_extrude(obj,h)]
|
p[0] = [process_linear_extrude(obj,h)]
|
||||||
if p[3]['center']=='true' :
|
if p[3]['center']=='true' :
|
||||||
center(obj,0,0,h)
|
center(obj,0,0,h)
|
||||||
print "End Linear Extrude with twist"
|
if printverbose: print "End Linear Extrude with twist"
|
||||||
|
|
||||||
def p_import_file1(p):
|
def p_import_file1(p):
|
||||||
'import_file1 : import LPAREN keywordargument_list RPAREN SEMICOL'
|
'import_file1 : import LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
print "Import File"
|
if printverbose: print "Import File"
|
||||||
filen,ext =p[3]['file'].rsplit('.',1)
|
filen,ext =p[3]['file'].rsplit('.',1)
|
||||||
p[0] = [process_import_file(filen,ext,p[3]['layer'])]
|
p[0] = [process_import_file(filen,ext,p[3]['layer'])]
|
||||||
print "End Import File"
|
if printverbose: print "End Import File"
|
||||||
|
|
||||||
def process_import_file(fname,ext,layer):
|
def process_import_file(fname,ext,layer):
|
||||||
print "Importing : "+fname+"."+ext+" Layer : "+layer
|
if printverbose: print "Importing : "+fname+"."+ext+" Layer : "+layer
|
||||||
if ext.lower() in reverseimporttypes()['Mesh']:
|
if ext.lower() in reverseimporttypes()['Mesh']:
|
||||||
obj=process_mesh_file(fname,ext)
|
obj=process_mesh_file(fname,ext)
|
||||||
elif ext=='dxf' :
|
elif ext=='dxf' :
|
||||||
obj=processDXF(fname,layer)
|
obj=processDXF(fname,layer)
|
||||||
else :
|
else :
|
||||||
print "Unsupported file extension"
|
if printverbose: print "Unsupported file extension"
|
||||||
return(obj)
|
return(obj)
|
||||||
|
|
||||||
def process_mesh_file(fname,ext):
|
def process_mesh_file(fname,ext):
|
||||||
|
@ -612,20 +616,20 @@ def process_mesh_file(fname,ext):
|
||||||
def processDXF(fname,layer):
|
def processDXF(fname,layer):
|
||||||
global doc
|
global doc
|
||||||
global pathName
|
global pathName
|
||||||
print "Process DXF file"
|
if printverbose: print "Process DXF file"
|
||||||
print "File Name : "+fname
|
if printverbose: print "File Name : "+fname
|
||||||
print "Layer : "+layer
|
if printverbose: print "Layer : "+layer
|
||||||
print "PathName : "+pathName
|
if printverbose: print "PathName : "+pathName
|
||||||
dxfname = fname+'.dxf'
|
dxfname = fname+'.dxf'
|
||||||
filename = os.path.join(pathName,dxfname)
|
filename = os.path.join(pathName,dxfname)
|
||||||
print "DXF Full path : "+filename
|
if printverbose: print "DXF Full path : "+filename
|
||||||
#featname='import_dxf_%s_%s'%(objname,layera)
|
#featname='import_dxf_%s_%s'%(objname,layera)
|
||||||
# reusing an allready imported object does not work if the
|
# reusing an allready imported object does not work if the
|
||||||
#shape in not yet calculated
|
#shape in not yet calculated
|
||||||
import importDXF
|
import importDXF
|
||||||
global dxfcache
|
global dxfcache
|
||||||
layers=dxfcache.get(id(doc),[])
|
layers=dxfcache.get(id(doc),[])
|
||||||
print "Layers : "+str(layers)
|
if printverbose: print "Layers : "+str(layers)
|
||||||
if layers:
|
if layers:
|
||||||
try:
|
try:
|
||||||
groupobj=[go for go in layers if (not layer) or go.Label == layer]
|
groupobj=[go for go in layers if (not layer) or go.Label == layer]
|
||||||
|
@ -634,7 +638,7 @@ def processDXF(fname,layer):
|
||||||
else:
|
else:
|
||||||
groupobj= None
|
groupobj= None
|
||||||
if not groupobj:
|
if not groupobj:
|
||||||
print "Importing Layer"
|
if printverbose: print "Importing Layer"
|
||||||
layers = importDXF.processdxf(doc,filename) or importDXF.layers
|
layers = importDXF.processdxf(doc,filename) or importDXF.layers
|
||||||
dxfcache[id(doc)] = layers[:]
|
dxfcache[id(doc)] = layers[:]
|
||||||
for l in layers:
|
for l in layers:
|
||||||
|
@ -645,7 +649,7 @@ def processDXF(fname,layer):
|
||||||
groupobj=[go for go in layers if (not layer) or go.Label == layer]
|
groupobj=[go for go in layers if (not layer) or go.Label == layer]
|
||||||
edges=[]
|
edges=[]
|
||||||
if not groupobj:
|
if not groupobj:
|
||||||
print 'import of layer %s failed' % layer
|
if printverbose: print 'import of layer %s failed' % layer
|
||||||
for shapeobj in groupobj[0].Group:
|
for shapeobj in groupobj[0].Group:
|
||||||
edges.extend(shapeobj.Shape.Edges)
|
edges.extend(shapeobj.Shape.Edges)
|
||||||
f=edgestofaces(edges)
|
f=edgestofaces(edges)
|
||||||
|
@ -654,22 +658,22 @@ def processDXF(fname,layer):
|
||||||
#ImportObject(obj,groupobj[0]) #This object is not mutable from the GUI
|
#ImportObject(obj,groupobj[0]) #This object is not mutable from the GUI
|
||||||
#ViewProviderTree(obj.ViewObject)
|
#ViewProviderTree(obj.ViewObject)
|
||||||
obj.Shape=f
|
obj.Shape=f
|
||||||
print "DXF Diagnostics"
|
if printverbose: print "DXF Diagnostics"
|
||||||
print obj.Shape.ShapeType
|
if printverbose: print obj.Shape.ShapeType
|
||||||
print "Closed : "+str(f.isClosed())
|
if printverbose: print "Closed : "+str(f.isClosed())
|
||||||
print f.check()
|
if printverbose: print f.check()
|
||||||
print [w.isClosed() for w in obj.Shape.Wires]
|
if printverbose: print [w.isClosed() for w in obj.Shape.Wires]
|
||||||
return(obj)
|
return(obj)
|
||||||
|
|
||||||
def processSTL(fname):
|
def processSTL(fname):
|
||||||
print "Process STL file"
|
if printverbose: print "Process STL file"
|
||||||
|
|
||||||
def p_multmatrix_action(p):
|
def p_multmatrix_action(p):
|
||||||
'multmatrix_action : multmatrix LPAREN matrix RPAREN OBRACE block_list EBRACE'
|
'multmatrix_action : multmatrix LPAREN matrix RPAREN OBRACE block_list EBRACE'
|
||||||
print "MultMatrix"
|
if printverbose: print "MultMatrix"
|
||||||
transform_matrix = FreeCAD.Matrix()
|
transform_matrix = FreeCAD.Matrix()
|
||||||
print "Multmatrix"
|
if printverbose: print "Multmatrix"
|
||||||
print p[3]
|
if printverbose: print p[3]
|
||||||
transform_matrix.A11 = round(float(p[3][0][0]),12)
|
transform_matrix.A11 = round(float(p[3][0][0]),12)
|
||||||
transform_matrix.A12 = round(float(p[3][0][1]),12)
|
transform_matrix.A12 = round(float(p[3][0][1]),12)
|
||||||
transform_matrix.A13 = round(float(p[3][0][2]),12)
|
transform_matrix.A13 = round(float(p[3][0][2]),12)
|
||||||
|
@ -682,8 +686,8 @@ def p_multmatrix_action(p):
|
||||||
transform_matrix.A32 = round(float(p[3][2][1]),12)
|
transform_matrix.A32 = round(float(p[3][2][1]),12)
|
||||||
transform_matrix.A33 = round(float(p[3][2][2]),12)
|
transform_matrix.A33 = round(float(p[3][2][2]),12)
|
||||||
transform_matrix.A34 = round(float(p[3][2][3]),12)
|
transform_matrix.A34 = round(float(p[3][2][3]),12)
|
||||||
print transform_matrix
|
if printverbose: print transform_matrix
|
||||||
print "Apply Multmatrix"
|
if printverbose: print "Apply Multmatrix"
|
||||||
# If more than one object on the stack for multmatrix fuse first
|
# If more than one object on the stack for multmatrix fuse first
|
||||||
if (len(p[6]) > 1) :
|
if (len(p[6]) > 1) :
|
||||||
part = fuse(p[6],"Matrix Union")
|
part = fuse(p[6],"Matrix Union")
|
||||||
|
@ -693,7 +697,7 @@ def p_multmatrix_action(p):
|
||||||
# part = new_part.copy()
|
# part = new_part.copy()
|
||||||
# part.transformShape(transform_matrix)
|
# part.transformShape(transform_matrix)
|
||||||
if (isspecialorthogonaldeterminant(fcsubmatrix(transform_matrix))) :
|
if (isspecialorthogonaldeterminant(fcsubmatrix(transform_matrix))) :
|
||||||
print "Orthogonal"
|
if printverbose: print "Orthogonal"
|
||||||
part.Placement=FreeCAD.Placement(transform_matrix).multiply(part.Placement)
|
part.Placement=FreeCAD.Placement(transform_matrix).multiply(part.Placement)
|
||||||
new_part = part
|
new_part = part
|
||||||
elif FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
elif FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
||||||
|
@ -710,7 +714,7 @@ def p_multmatrix_action(p):
|
||||||
new_part.ViewObject.Proxy = 0
|
new_part.ViewObject.Proxy = 0
|
||||||
part.ViewObject.hide()
|
part.ViewObject.hide()
|
||||||
else :
|
else :
|
||||||
print "Transform Geometry"
|
if printverbose: print "Transform Geometry"
|
||||||
# Need to recompute to stop transformGeometry causing a crash
|
# Need to recompute to stop transformGeometry causing a crash
|
||||||
doc.recompute()
|
doc.recompute()
|
||||||
new_part = doc.addObject("Part::Feature","Matrix Deformation")
|
new_part = doc.addObject("Part::Feature","Matrix Deformation")
|
||||||
|
@ -728,16 +732,16 @@ def p_multmatrix_action(p):
|
||||||
p[0] = [newobj]
|
p[0] = [newobj]
|
||||||
else :
|
else :
|
||||||
p[0] = [new_part]
|
p[0] = [new_part]
|
||||||
print "Multmatrix applied"
|
if printverbose: print "Multmatrix applied"
|
||||||
|
|
||||||
def p_matrix(p):
|
def p_matrix(p):
|
||||||
'matrix : OSQUARE vector COMMA vector COMMA vector COMMA vector ESQUARE'
|
'matrix : OSQUARE vector COMMA vector COMMA vector COMMA vector ESQUARE'
|
||||||
print "Matrix"
|
if printverbose: print "Matrix"
|
||||||
p[0] = [p[2],p[4],p[6],p[8]]
|
p[0] = [p[2],p[4],p[6],p[8]]
|
||||||
|
|
||||||
def p_vector(p):
|
def p_vector(p):
|
||||||
'vector : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
'vector : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
||||||
print "Vector"
|
if printverbose: print "Vector"
|
||||||
p[0] = [p[2],p[4],p[6],p[8]]
|
p[0] = [p[2],p[4],p[6],p[8]]
|
||||||
|
|
||||||
def center(obj,x,y,z):
|
def center(obj,x,y,z):
|
||||||
|
@ -747,18 +751,18 @@ def center(obj,x,y,z):
|
||||||
|
|
||||||
def p_sphere_action(p):
|
def p_sphere_action(p):
|
||||||
'sphere_action : sphere LPAREN keywordargument_list RPAREN SEMICOL'
|
'sphere_action : sphere LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
print "Sphere : ",p[3]
|
if printverbose: print "Sphere : ",p[3]
|
||||||
r = float(p[3]['r'])
|
r = float(p[3]['r'])
|
||||||
mysphere = doc.addObject("Part::Sphere",p[1])
|
mysphere = doc.addObject("Part::Sphere",p[1])
|
||||||
mysphere.Radius = r
|
mysphere.Radius = r
|
||||||
print "Push Sphere"
|
if printverbose: print "Push Sphere"
|
||||||
p[0] = [mysphere]
|
p[0] = [mysphere]
|
||||||
print "End Sphere"
|
if printverbose: print "End Sphere"
|
||||||
|
|
||||||
def myPolygon(n,r1):
|
def myPolygon(n,r1):
|
||||||
# Adapted from Draft::_Polygon
|
# Adapted from Draft::_Polygon
|
||||||
import math
|
import math
|
||||||
print "My Polygon"
|
if printverbose: print "My Polygon"
|
||||||
angle = math.pi*2/n
|
angle = math.pi*2/n
|
||||||
nodes = [FreeCAD.Vector(r1,0,0)]
|
nodes = [FreeCAD.Vector(r1,0,0)]
|
||||||
for i in range(n-1) :
|
for i in range(n-1) :
|
||||||
|
@ -773,15 +777,15 @@ def myPolygon(n,r1):
|
||||||
|
|
||||||
def p_cylinder_action(p):
|
def p_cylinder_action(p):
|
||||||
'cylinder_action : cylinder LPAREN keywordargument_list RPAREN SEMICOL'
|
'cylinder_action : cylinder LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
print "Cylinder"
|
if printverbose: print "Cylinder"
|
||||||
tocenter = p[3]['center']
|
tocenter = p[3]['center']
|
||||||
h = float(p[3]['h'])
|
h = float(p[3]['h'])
|
||||||
r1 = float(p[3]['r1'])
|
r1 = float(p[3]['r1'])
|
||||||
r2 = float(p[3]['r2'])
|
r2 = float(p[3]['r2'])
|
||||||
n = int(p[3]['$fn'])
|
n = int(p[3]['$fn'])
|
||||||
print p[3]
|
if printverbose: print p[3]
|
||||||
if ( r1 == r2 ):
|
if ( r1 == r2 ):
|
||||||
print "Make Cylinder"
|
if printverbose: print "Make Cylinder"
|
||||||
fnmax = FreeCAD.ParamGet(\
|
fnmax = FreeCAD.ParamGet(\
|
||||||
"User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
"User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
||||||
GetInt('useMaxFN')
|
GetInt('useMaxFN')
|
||||||
|
@ -790,7 +794,7 @@ def p_cylinder_action(p):
|
||||||
mycyl.Height = h
|
mycyl.Height = h
|
||||||
mycyl.Radius = r1
|
mycyl.Radius = r1
|
||||||
else :
|
else :
|
||||||
print "Make Prism"
|
if printverbose: print "Make Prism"
|
||||||
mycyl=doc.addObject("Part::Extrusion","prism")
|
mycyl=doc.addObject("Part::Extrusion","prism")
|
||||||
mycyl.Dir = (0,0,h)
|
mycyl.Dir = (0,0,h)
|
||||||
try :
|
try :
|
||||||
|
@ -800,7 +804,7 @@ def p_cylinder_action(p):
|
||||||
# If Draft can't import (probably due to lack of Pivy on Mac and
|
# If Draft can't import (probably due to lack of Pivy on Mac and
|
||||||
# Linux builds of FreeCAD), this is a fallback.
|
# Linux builds of FreeCAD), this is a fallback.
|
||||||
# or old level of FreeCAD
|
# or old level of FreeCAD
|
||||||
print "Draft makePolygon Failed, falling back on manual polygon"
|
if printverbose: print "Draft makePolygon Failed, falling back on manual polygon"
|
||||||
mycyl.Base = myPolygon(n,r1)
|
mycyl.Base = myPolygon(n,r1)
|
||||||
|
|
||||||
else :
|
else :
|
||||||
|
@ -810,12 +814,12 @@ def p_cylinder_action(p):
|
||||||
# mycyl.Solid = True
|
# mycyl.Solid = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print "Make Cone"
|
if printverbose: print "Make Cone"
|
||||||
mycyl=doc.addObject("Part::Cone",p[1])
|
mycyl=doc.addObject("Part::Cone",p[1])
|
||||||
mycyl.Height = h
|
mycyl.Height = h
|
||||||
mycyl.Radius1 = r1
|
mycyl.Radius1 = r1
|
||||||
mycyl.Radius2 = r2
|
mycyl.Radius2 = r2
|
||||||
print "Center = ",tocenter
|
if printverbose: print "Center = ",tocenter
|
||||||
if tocenter=='true' :
|
if tocenter=='true' :
|
||||||
center(mycyl,0,0,h)
|
center(mycyl,0,0,h)
|
||||||
if False :
|
if False :
|
||||||
|
@ -833,13 +837,13 @@ def p_cylinder_action(p):
|
||||||
p[0] = [newobj]
|
p[0] = [newobj]
|
||||||
else :
|
else :
|
||||||
p[0] = [mycyl]
|
p[0] = [mycyl]
|
||||||
print "End Cylinder"
|
if printverbose: print "End Cylinder"
|
||||||
|
|
||||||
def p_cube_action(p):
|
def p_cube_action(p):
|
||||||
'cube_action : cube LPAREN keywordargument_list RPAREN SEMICOL'
|
'cube_action : cube LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
global doc
|
global doc
|
||||||
l,w,h = [float(str1) for str1 in p[3]['size']]
|
l,w,h = [float(str1) for str1 in p[3]['size']]
|
||||||
print "cube : ",p[3]
|
if printverbose: print "cube : ",p[3]
|
||||||
mycube=doc.addObject('Part::Box',p[1])
|
mycube=doc.addObject('Part::Box',p[1])
|
||||||
mycube.Length=l
|
mycube.Length=l
|
||||||
mycube.Width=w
|
mycube.Width=w
|
||||||
|
@ -847,11 +851,11 @@ def p_cube_action(p):
|
||||||
if p[3]['center']=='true' :
|
if p[3]['center']=='true' :
|
||||||
center(mycube,l,w,h);
|
center(mycube,l,w,h);
|
||||||
p[0] = [mycube]
|
p[0] = [mycube]
|
||||||
print "End Cube"
|
if printverbose: print "End Cube"
|
||||||
|
|
||||||
def p_circle_action(p) :
|
def p_circle_action(p) :
|
||||||
'circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL'
|
'circle_action : circle LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
print "Circle : "+str(p[3])
|
if printverbose: print "Circle : "+str(p[3])
|
||||||
r = float(p[3]['r'])
|
r = float(p[3]['r'])
|
||||||
n = int(p[3]['$fn'])
|
n = int(p[3]['$fn'])
|
||||||
fnmax = FreeCAD.ParamGet(\
|
fnmax = FreeCAD.ParamGet(\
|
||||||
|
@ -866,12 +870,12 @@ def p_circle_action(p) :
|
||||||
#mycircle.Radius = r
|
#mycircle.Radius = r
|
||||||
else :
|
else :
|
||||||
mycircle = Draft.makePolygon(n,r)
|
mycircle = Draft.makePolygon(n,r)
|
||||||
print "Push Circle"
|
if printverbose: print "Push Circle"
|
||||||
p[0] = [mycircle]
|
p[0] = [mycircle]
|
||||||
|
|
||||||
def p_square_action(p) :
|
def p_square_action(p) :
|
||||||
'square_action : square LPAREN keywordargument_list RPAREN SEMICOL'
|
'square_action : square LPAREN keywordargument_list RPAREN SEMICOL'
|
||||||
print "Square"
|
if printverbose: print "Square"
|
||||||
size = p[3]['size']
|
size = p[3]['size']
|
||||||
x = float(size[0])
|
x = float(size[0])
|
||||||
y = float(size[1])
|
y = float(size[1])
|
||||||
|
@ -885,45 +889,45 @@ def p_square_action(p) :
|
||||||
def convert_points_list_to_vector(l):
|
def convert_points_list_to_vector(l):
|
||||||
v = []
|
v = []
|
||||||
for i in l :
|
for i in l :
|
||||||
print i
|
if printverbose: print i
|
||||||
v.append(FreeCAD.Vector(i[0],i[1]))
|
v.append(FreeCAD.Vector(i[0],i[1]))
|
||||||
print v
|
if printverbose: print v
|
||||||
return(v)
|
return(v)
|
||||||
|
|
||||||
|
|
||||||
def p_polygon_action_nopath(p) :
|
def p_polygon_action_nopath(p) :
|
||||||
'polygon_action_nopath : polygon LPAREN points EQ OSQUARE points_list_2d ESQUARE COMMA paths EQ undef COMMA keywordargument_list RPAREN SEMICOL'
|
'polygon_action_nopath : polygon LPAREN points EQ OSQUARE points_list_2d ESQUARE COMMA paths EQ undef COMMA keywordargument_list RPAREN SEMICOL'
|
||||||
print "Polygon"
|
if printverbose: print "Polygon"
|
||||||
print p[6]
|
if printverbose: print p[6]
|
||||||
v = convert_points_list_to_vector(p[6])
|
v = convert_points_list_to_vector(p[6])
|
||||||
mypolygon = doc.addObject('Part::Feature',p[1])
|
mypolygon = doc.addObject('Part::Feature',p[1])
|
||||||
print "Make Parts"
|
if printverbose: print "Make Parts"
|
||||||
# Close Polygon
|
# Close Polygon
|
||||||
v.append(v[0])
|
v.append(v[0])
|
||||||
parts = Part.makePolygon(v)
|
parts = Part.makePolygon(v)
|
||||||
print "update object"
|
if printverbose: print "update object"
|
||||||
mypolygon.Shape = Part.Face(parts)
|
mypolygon.Shape = Part.Face(parts)
|
||||||
p[0] = [mypolygon]
|
p[0] = [mypolygon]
|
||||||
|
|
||||||
def p_polygon_action_plus_path(p) :
|
def p_polygon_action_plus_path(p) :
|
||||||
'polygon_action_plus_path : polygon LPAREN points EQ OSQUARE points_list_2d ESQUARE COMMA paths EQ OSQUARE path_set ESQUARE COMMA keywordargument_list RPAREN SEMICOL'
|
'polygon_action_plus_path : polygon LPAREN points EQ OSQUARE points_list_2d ESQUARE COMMA paths EQ OSQUARE path_set ESQUARE COMMA keywordargument_list RPAREN SEMICOL'
|
||||||
print "Polygon with Path"
|
if printverbose: print "Polygon with Path"
|
||||||
print p[6]
|
if printverbose: print p[6]
|
||||||
v = convert_points_list_to_vector(p[6])
|
v = convert_points_list_to_vector(p[6])
|
||||||
print "Path Set List"
|
if printverbose: print "Path Set List"
|
||||||
print p[12]
|
if printverbose: print p[12]
|
||||||
for i in p[12] :
|
for i in p[12] :
|
||||||
print i
|
if printverbose: print i
|
||||||
mypolygon = doc.addObject('Part::Feature','wire')
|
mypolygon = doc.addObject('Part::Feature','wire')
|
||||||
path_list = []
|
path_list = []
|
||||||
for j in i :
|
for j in i :
|
||||||
j = int(j)
|
j = int(j)
|
||||||
print j
|
if printverbose: print j
|
||||||
path_list.append(v[j])
|
path_list.append(v[j])
|
||||||
# Close path
|
# Close path
|
||||||
path_list.append(v[int(i[0])])
|
path_list.append(v[int(i[0])])
|
||||||
print 'Path List'
|
if printverbose: print 'Path List'
|
||||||
print path_list
|
if printverbose: print path_list
|
||||||
wire = Part.makePolygon(path_list)
|
wire = Part.makePolygon(path_list)
|
||||||
mypolygon.Shape = Part.Face(wire)
|
mypolygon.Shape = Part.Face(wire)
|
||||||
p[0] = [mypolygon]
|
p[0] = [mypolygon]
|
||||||
|
@ -936,18 +940,19 @@ def make_face(v1,v2,v3):
|
||||||
|
|
||||||
def p_polyhedron_action(p) :
|
def p_polyhedron_action(p) :
|
||||||
'polyhedron_action : polyhedron LPAREN points EQ OSQUARE points_list_3d ESQUARE COMMA triangles EQ OSQUARE points_list_3d ESQUARE COMMA keywordargument_list RPAREN SEMICOL'
|
'polyhedron_action : polyhedron LPAREN points EQ OSQUARE points_list_3d ESQUARE COMMA triangles EQ OSQUARE points_list_3d ESQUARE COMMA keywordargument_list RPAREN SEMICOL'
|
||||||
print "Polyhedron Points"
|
if printverbose: print "Polyhedron Points"
|
||||||
v = []
|
v = []
|
||||||
for i in p[6] :
|
for i in p[6] :
|
||||||
print i
|
if printverbose: print i
|
||||||
v.append(FreeCAD.Vector(float(i[0]),float(i[1]),float(i[2])))
|
v.append(FreeCAD.Vector(float(i[0]),float(i[1]),float(i[2])))
|
||||||
|
if printverbose:
|
||||||
print v
|
print v
|
||||||
print "Polyhedron triangles"
|
print "Polyhedron triangles"
|
||||||
print p[12]
|
print p[12]
|
||||||
faces_list = []
|
faces_list = []
|
||||||
mypolyhed = doc.addObject('Part::Feature',p[1])
|
mypolyhed = doc.addObject('Part::Feature',p[1])
|
||||||
for i in p[12] :
|
for i in p[12] :
|
||||||
print i
|
if printverbose: print i
|
||||||
f = make_face(v[int(i[0])],v[int(i[1])],v[int(i[2])])
|
f = make_face(v[int(i[0])],v[int(i[1])],v[int(i[2])])
|
||||||
faces_list.append(f)
|
faces_list.append(f)
|
||||||
shell=Part.makeShell(faces_list)
|
shell=Part.makeShell(faces_list)
|
||||||
|
@ -959,7 +964,7 @@ def p_polyhedron_action(p) :
|
||||||
|
|
||||||
def p_projection_action(p) :
|
def p_projection_action(p) :
|
||||||
'projection_action : projection LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
'projection_action : projection LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE'
|
||||||
print 'Projection'
|
if printverbose: print 'Projection'
|
||||||
if gui:
|
if gui:
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
QtGui.QMessageBox.critical(None, unicode(translate('OpenSCAD',"Projection Not yet Coded waiting for Peter Li")),unicode(translate('OpenSCAD'," Press OK")))
|
QtGui.QMessageBox.critical(None, unicode(translate('OpenSCAD',"Projection Not yet Coded waiting for Peter Li")),unicode(translate('OpenSCAD'," Press OK")))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user