@@ -111,26 +111,6 @@ def searchforopenscadexe():
|
||||
return opath
|
||||
|
||||
|
||||
def workaroundforissue128needed():
|
||||
'''sets the import path depending on the OpenSCAD Version
|
||||
for versions <= 2012.06.23 to the current working dir
|
||||
for versions above to the inputfile dir
|
||||
see https://github.com/openscad/openscad/issues/128'''
|
||||
vdate = getopenscadversion().split('-')[0]
|
||||
vdate = vdate.split(' ')[2].split('.')
|
||||
if len(vdate) == 1: # probably YYYYMMDD format (i.e. git version)
|
||||
vdate = vdate[0]
|
||||
year, mon = int("".join(vdate[0:4])), int("".join(vdate[4:6]))
|
||||
else: # YYYY.MM(.DD?) (latest release)
|
||||
year, mon = int(vdate[0]), int(vdate[1])
|
||||
return (year < 2012 or (year == 2012 and (mon < 6 or (mon == 6 and \
|
||||
(len(vdate) < 3 or int(vdate[2]) <= 23)))))
|
||||
#ifdate=int(vdate[0])+(int(vdate[1])-1)/12.0
|
||||
#if len(vdate)>2:
|
||||
# fdate+=int((vdate[2])-1)/12.0/31.0
|
||||
#return fdate < 2012.4759
|
||||
|
||||
|
||||
def getopenscadversion(osfilename=None):
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
@@ -129,11 +129,7 @@ def open(filename):
|
||||
doc = FreeCAD.newDocument(docname)
|
||||
if filename.lower().endswith('.scad'):
|
||||
tmpfile = callopenscad(filename)
|
||||
if workaroundforissue128needed():
|
||||
pathName = '' # https://github.com/openscad/openscad/issues/128
|
||||
#pathName = os.getcwd() # https://github.com/openscad/openscad/issues/128
|
||||
else:
|
||||
pathName = os.path.dirname(os.path.normpath(filename))
|
||||
pathName = os.path.dirname(os.path.normpath(filename))
|
||||
processcsg(tmpfile)
|
||||
try:
|
||||
os.unlink(tmpfile)
|
||||
@@ -159,11 +155,7 @@ def insert(filename, docname):
|
||||
#importgroup = doc.addObject("App::DocumentObjectGroup",groupname)
|
||||
if filename.lower().endswith('.scad'):
|
||||
tmpfile = callopenscad(filename)
|
||||
if workaroundforissue128needed():
|
||||
pathName = '' # https://github.com/openscad/openscad/issues/128
|
||||
#pathName = os.getcwd() # https://github.com/openscad/openscad/issues/128
|
||||
else:
|
||||
pathName = os.path.dirname(os.path.normpath(filename))
|
||||
pathName = os.path.dirname(os.path.normpath(filename))
|
||||
processcsg(tmpfile)
|
||||
try:
|
||||
os.unlink(tmpfile)
|
||||
|
||||
Reference in New Issue
Block a user