use a python feature for unsupported operations
This commit is contained in:
parent
195b8e1b35
commit
fb48816817
|
@ -75,6 +75,9 @@ class ViewProviderTree:
|
|||
objs.extend(self.Object.Objects)
|
||||
if hasattr(self.Object,"Components"):
|
||||
objs.extend(self.Object.Components)
|
||||
if hasattr(self.Object,"Children"):
|
||||
objs.extend(self.Object.Children)
|
||||
|
||||
return objs
|
||||
|
||||
def getIcon(self):
|
||||
|
@ -215,6 +218,19 @@ static char * openscadlogo_xpm[] = {
|
|||
"4444444444444444"};
|
||||
"""
|
||||
|
||||
class OpenSCADPlaceholder:
|
||||
def __init__(self,obj,children=None,arguments=None):
|
||||
obj.addProperty("App::PropertyLinkList",'Children','OpenSCAD',"Base Objects")
|
||||
obj.addProperty("App::PropertyString",'Arguments','OpenSCAD',"Arguments")
|
||||
obj.Proxy = self
|
||||
if children:
|
||||
obj.Children = children
|
||||
if arguments:
|
||||
obj.Arguments = arguments
|
||||
|
||||
def execute(self,fp):
|
||||
import Part
|
||||
fp.Shape = Part.Compound([]) #empty Shape
|
||||
|
||||
class MatrixTransform:
|
||||
def __init__(self, obj,matrix=None,child=None):
|
||||
|
|
|
@ -341,16 +341,32 @@ def p_operation(p):
|
|||
| projection_action
|
||||
'''
|
||||
p[0] = p[1]
|
||||
|
||||
|
||||
|
||||
def p_not_supported(p):
|
||||
'''
|
||||
not_supported : hull LPAREN RPAREN OBRACE block_list EBRACE
|
||||
not_supported : hull LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE
|
||||
| minkowski LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE
|
||||
| glide LPAREN RPAREN OBRACE block_list EBRACE
|
||||
| glide LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE
|
||||
'''
|
||||
if gui:
|
||||
if gui and not FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
||||
GetBool('usePlaceholderForUnsupported'):
|
||||
from PyQt4 import QtGui
|
||||
QtGui.QMessageBox.critical(None, unicode(translate('OpenSCAD',"Unsupported Function"))+" : "+p[1],unicode(translate('OpenSCAD',"Press OK")))
|
||||
else:
|
||||
from OpenSCADFeatures import OpenSCADPlaceholder
|
||||
newobj=doc.addObject("Part::FeaturePython",p[1])
|
||||
OpenSCADPlaceholder(newobj,p[6],str(p[3]))
|
||||
if gui:
|
||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/OpenSCAD").\
|
||||
GetBool('useViewProviderTree'):
|
||||
from OpenSCADFeatures import ViewProviderTree
|
||||
ViewProviderTree(newobj.ViewObject)
|
||||
else:
|
||||
newobj.ViewObject.Proxy = 0
|
||||
#don't hide the children
|
||||
p[0] = [newobj]
|
||||
|
||||
|
||||
def p_size_vector(p):
|
||||
'size_vector : OSQUARE NUMBER COMMA NUMBER COMMA NUMBER ESQUARE'
|
||||
|
|
Loading…
Reference in New Issue
Block a user