diff --git a/scripts/export.py b/scripts/export.py index 2756575..bddc29f 100644 --- a/scripts/export.py +++ b/scripts/export.py @@ -13,16 +13,7 @@ def dirToFileList(folder): input = next(os.walk(folder)) files = input[2] path = input[0] - - currentPath = str(pathlib.Path().resolve()) - - # print("files: ", files) - # print("currentPath :", currentPath) - # print("path: ", path) - path = path.replace('/', '\\') - # print("New path: ", path) - filesList = [] for f in files: f = f.replace('/', '\\') @@ -32,7 +23,8 @@ def dirToFileList(folder): def runFiles(files): - currentPath = str(pathlib.Path().resolve()) + currentPath = os.path.dirname(os.path.realpath(__file__)) + # print("Current path script" + currentPath) partFiles = [s for s in files if ".SLDPRT" in s] # get only parts files drwgFiles = [s for s in files if ".SLDDRW" in s] # get only drawings files @@ -63,7 +55,7 @@ def runFiles(files): path = path.replace('/', '\\') outputFolder = path + "\\export\\" - commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-step.ps1 "' + i + '" "' + outputFolder + input + '"' + commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\export-step.ps1 "' + i + '" "' + outputFolder + input + '"' # print(commandstep) subprocess.run(commandstep, capture_output=True) @@ -73,7 +65,7 @@ def runFiles(files): i = i.replace('/', '\\') path = path.replace('/', '\\') outputFolder = path + "\\export\\" - commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-pdf-dxf.ps1 "' + i + '" "' + outputFolder + input + '"' + commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\export-pdf-dxf.ps1 "' + i + '" "' + outputFolder + input + '"' # print(commandPdfDxf) subprocess.run(commandPdfDxf, capture_output=True) @@ -96,6 +88,6 @@ if __name__ == '__main__': else: runFiles(str(fname).split(';')) - print("Done") + input("\nDone\n\n Press enter to quit\n")