Commit 944959a6 authored by Sebastian Hoogen's avatar Sebastian Hoogen
Browse files

OpenSCAD fix parsing bug for square statement

parent 7b44c7af
......@@ -199,6 +199,8 @@ class AddSCADTask:
FreeCAD.Console.PrintError(unicode(translate('OpenSCAD','Running OpenSCAD failed'))+u'\n')
class AddOpenSCADElement:
def IsActive(self):
return not FreeCADGui.Control.activeDialog()
def Activated(self):
panel = AddSCADTask()
FreeCADGui.Control.showDialog(panel)
......
......@@ -539,7 +539,10 @@ def p_linear_extrude_with_twist(p):
print "Linear Extrude With Twist"
h = float(p[3]['height'])
print "Twist : ",p[3]
t = float(p[3]['twist'])
if 'twist' in p[3]:
t = float(p[3]['twist'])
else:
t = 0
if (len(p[6]) > 1) :
obj = fuse(p[6],"Linear Extrude Union")
else :
......@@ -862,7 +865,7 @@ def p_square_action(p) :
mysquare = doc.addObject('Part::Plane',p[1])
mysquare.Length=x
mysquare.Width=y
if p[9]=='true' :
if p[3]['center']=='true' :
center(mysquare,x,y,0)
p[0] = [mysquare]
......
......@@ -11,14 +11,15 @@ def replaceobj(parent,oldchild,newchild):
setattr(parent,propname,newchild)
print propname, parent.getPropertyByName(propname)
#else: print propname,propvalue
parent.touch()
def replaceobjfromselection(objs):
assert(len(objs)==3)
if objs[0] in objs[1].InList: parent, oldchild, newchild = objs
if objs[2] in objs[0].InList: oldchild, newchild, parent = objs
elif objs[0] in objs[1].InList: parent, oldchild, newchild = objs
elif objs[0] in objs[2].InList: parent, newchild, oldchild = objs
elif objs[1] in objs[0].InList: oldchild, parent, newchild = objs
elif objs[1] in objs[2].InList: newchild, parent, oldchild = objs
elif objs[2] in objs[0].InList: oldchild, newchild, parent = objs
elif objs[2] in objs[1].InList: newchild, oldchild, parent = objs
else: assert(False)
replaceobj(parent,oldchild,newchild)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment