diff --git a/src/Mod/OpenSCAD/OpenSCADCommands.py b/src/Mod/OpenSCAD/OpenSCADCommands.py index 778e310a7..5b8edd434 100644 --- a/src/Mod/OpenSCAD/OpenSCADCommands.py +++ b/src/Mod/OpenSCAD/OpenSCADCommands.py @@ -211,7 +211,7 @@ class AddSCADTask: return True def addelement(self): - scadstr=unicode(self.form.textEdit.toPlainText()) + scadstr=unicode(self.form.textEdit.toPlainText()).encode('utf8') asmesh=self.form.checkboxmesh.checkState() import OpenSCADUtils, os extension= 'stl' if asmesh else 'csg' diff --git a/src/Mod/OpenSCAD/OpenSCADFeatures.py b/src/Mod/OpenSCAD/OpenSCADFeatures.py index 44fcd5416..ec71a1425 100644 --- a/src/Mod/OpenSCAD/OpenSCADFeatures.py +++ b/src/Mod/OpenSCAD/OpenSCADFeatures.py @@ -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): diff --git a/src/Mod/OpenSCAD/OpenSCADUtils.py b/src/Mod/OpenSCAD/OpenSCADUtils.py index e395b5620..7c1437e95 100644 --- a/src/Mod/OpenSCAD/OpenSCADUtils.py +++ b/src/Mod/OpenSCAD/OpenSCADUtils.py @@ -109,9 +109,9 @@ def callopenscad(inputfilename,outputfilename=None,outputext='csg',keepname=Fals else: outputfilename=os.path.join(dir1,'output-%d.%s' % \ (int(time.time()*100) % 1000000,outputext)) - check_output2([osfilename,'-o',outputfilename, inputfilename],\ - stderr=subprocess.STDOUT) - return outputfilename + check_output2([osfilename,'-o',outputfilename, inputfilename],\ + stderr=subprocess.STDOUT) + return outputfilename def callopenscadstring(scadstr,outputext='csg'): '''create a tempfile and call the open scad binary diff --git a/src/Mod/OpenSCAD/importCSG.py b/src/Mod/OpenSCAD/importCSG.py index 8b973ac4c..c08d5aeff 100644 --- a/src/Mod/OpenSCAD/importCSG.py +++ b/src/Mod/OpenSCAD/importCSG.py @@ -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'