working :)

This commit is contained in:
Lurenaud 2023-02-10 13:55:26 +01:00
parent 99780c1cb8
commit 33ee735f83

View File

@ -13,16 +13,7 @@ def dirToFileList(folder):
input = next(os.walk(folder)) input = next(os.walk(folder))
files = input[2] files = input[2]
path = input[0] path = input[0]
currentPath = str(pathlib.Path().resolve())
# print("files: ", files)
# print("currentPath :", currentPath)
# print("path: ", path)
path = path.replace('/', '\\') path = path.replace('/', '\\')
# print("New path: ", path)
filesList = [] filesList = []
for f in files: for f in files:
f = f.replace('/', '\\') f = f.replace('/', '\\')
@ -32,7 +23,8 @@ def dirToFileList(folder):
def runFiles(files): 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 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 drwgFiles = [s for s in files if ".SLDDRW" in s] # get only drawings files
@ -63,7 +55,7 @@ def runFiles(files):
path = path.replace('/', '\\') path = path.replace('/', '\\')
outputFolder = path + "\\export\\" 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) # print(commandstep)
subprocess.run(commandstep, capture_output=True) subprocess.run(commandstep, capture_output=True)
@ -73,7 +65,7 @@ def runFiles(files):
i = i.replace('/', '\\') i = i.replace('/', '\\')
path = path.replace('/', '\\') path = path.replace('/', '\\')
outputFolder = path + "\\export\\" 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) # print(commandPdfDxf)
subprocess.run(commandPdfDxf, capture_output=True) subprocess.run(commandPdfDxf, capture_output=True)
@ -96,6 +88,6 @@ if __name__ == '__main__':
else: else:
runFiles(str(fname).split(';')) runFiles(str(fname).split(';'))
print("Done") input("\nDone\n\n Press enter to quit\n")