search for OpenSCAD executable when initalizing WB
This commit is contained in:
parent
97f3fd54ce
commit
9f4c547afe
|
@ -32,3 +32,6 @@ openscadfilename = param.GetString('openscadexecutable')
|
|||
openscadbin = openscadfilename and os.path.isfile(openscadfilename)
|
||||
if openscadbin:
|
||||
FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG")
|
||||
FreeCAD.addExportType("OpenSCAD CSG Format (*.csg)","exportCSG")
|
||||
FreeCAD.addExportType("OpenSCAD Format (*.scad)","exportCSG")
|
||||
|
||||
|
|
|
@ -107,9 +107,19 @@ static char * openscadlogo_xpm[] = {
|
|||
param = FreeCAD.ParamGet(\
|
||||
"User parameter:BaseApp/Preferences/Mod/OpenSCAD")
|
||||
openscadfilename = param.GetString('openscadexecutable')
|
||||
if not openscadfilename:
|
||||
|
||||
import OpenSCADUtils
|
||||
openscadfilename = OpenSCADUtils.searchforopenscadexe()
|
||||
if openscadfilename: #automatic search was succsessful
|
||||
FreeCAD.addImportType("OpenSCAD Format (*.scad)","importCSG")
|
||||
param.SetString('openscadexecutable',openscadfilename) #save the result
|
||||
if openscadfilename:
|
||||
commands.extend(['OpenSCAD_AddOpenSCADElement'])
|
||||
toolbarcommands.extend(['OpenSCAD_AddOpenSCADElement'])
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning('OpenSCAD executable not found\n')
|
||||
|
||||
self.appendToolbar("OpenSCADTools",toolbarcommands)
|
||||
self.appendMenu('OpenSCAD',commands)
|
||||
self.appendToolbar('OpenSCAD Part tools',parttoolbarcommands)
|
||||
|
@ -124,5 +134,3 @@ static char * openscadlogo_xpm[] = {
|
|||
|
||||
|
||||
Gui.addWorkbench(OpenSCADWorkbench())
|
||||
App.addExportType("OpenSCAD CSG Format (*.csg)","exportCSG")
|
||||
App.addExportType("OpenSCAD Format (*.scad)","exportCSG")
|
||||
|
|
|
@ -43,14 +43,14 @@ def searchforopenscadexe():
|
|||
testpaths = [os.path.join(os.environ.get('Programfiles(x86)','C:'),\
|
||||
'OpenSCAD\\openscad.exe')]
|
||||
if 'ProgramW6432' in os.environ:
|
||||
testpath.append(os.path.join(os.environ.get('ProgramW6432','C:')\
|
||||
,'OpenSCAD\\openscad.exe')
|
||||
testpaths.append(os.path.join(os.environ.get('ProgramW6432','C:')\
|
||||
,'OpenSCAD\\openscad.exe'))
|
||||
for testpath in testpaths:
|
||||
if os.path.isfile(testpath):
|
||||
return testpath
|
||||
else:
|
||||
p1=subprocess.Popen(['which','openscad'],stdout=subprocess.PIPE)
|
||||
if p1.wait() == 0
|
||||
if p1.wait() == 0:
|
||||
opath=p1.stdout.read().split('\n')[0]
|
||||
return opath
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user