From f9344fd2de625f1beb41a92887c855e637e64118 Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Fri, 24 Feb 2023 10:31:39 -0600 Subject: [PATCH] OpenSCAD: Remove old workaround code Fixes #8621 --- src/Mod/OpenSCAD/OpenSCADUtils.py | 20 -------------------- src/Mod/OpenSCAD/importCSG.py | 12 ++---------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/Mod/OpenSCAD/OpenSCADUtils.py b/src/Mod/OpenSCAD/OpenSCADUtils.py index b6eb534dae..0acf13f1c0 100644 --- a/src/Mod/OpenSCAD/OpenSCADUtils.py +++ b/src/Mod/OpenSCAD/OpenSCADUtils.py @@ -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 diff --git a/src/Mod/OpenSCAD/importCSG.py b/src/Mod/OpenSCAD/importCSG.py index d91e3c5ee0..1e9a05068c 100644 --- a/src/Mod/OpenSCAD/importCSG.py +++ b/src/Mod/OpenSCAD/importCSG.py @@ -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)