Skip to content

Commit

Permalink
use a python feature for unsupported operations
Browse files Browse the repository at this point in the history
  • Loading branch information
5263 committed Oct 28, 2013
1 parent 195b8e1 commit fb48816
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/Mod/OpenSCAD/OpenSCADFeatures.py
Expand Up @@ -75,6 +75,9 @@ def claimChildren(self):
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):
Expand Down Expand Up @@ -215,6 +218,19 @@ def getIcon(self):
"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):
Expand Down
24 changes: 20 additions & 4 deletions src/Mod/OpenSCAD/importCSG.py
Expand Up @@ -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'
Expand Down

0 comments on commit fb48816

Please sign in to comment.