fix printing

This commit is contained in:
Lurenaud 2023-02-06 19:18:30 +01:00
parent d51d611905
commit 6b3e202777

View File

@ -5,6 +5,7 @@ import sys
import pathlib import pathlib
import subprocess import subprocess
from rich.progress import track from rich.progress import track
from rich import print
# folder input # folder input
input = next(os.walk(sys.argv[1])) input = next(os.walk(sys.argv[1]))
@ -20,8 +21,8 @@ currentPath = str(pathlib.Path().resolve())
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
# print("Parts: ", partFiles) print("\nParts: \n", partFiles)
# print("Drawings: ", drwgFiles) print("\nDrawings: \n", drwgFiles, "\n")
partWithoutExention = [os.path.splitext(x)[0] for x in partFiles] # remove extension partWithoutExention = [os.path.splitext(x)[0] for x in partFiles] # remove extension
drwgWithoutExtension = [os.path.splitext(x)[0] for x in drwgFiles] # remove extension drwgWithoutExtension = [os.path.splitext(x)[0] for x in drwgFiles] # remove extension
@ -40,17 +41,17 @@ outputFolder = str(path) + "\\export\\"
# create export directory # create export directory
if not os.path.exists(outputFolder): if not os.path.exists(outputFolder):
os.makedirs(outputFolder) os.makedirs(outputFolder)
print("Export folder created") print("\nExport folder created\n")
# part files # part files
for i in track(partWithoutExention, description="Exporting step files..."): for i in track(partWithoutExention, description="Exporting step files...", total=len(partWithoutExention)):
input = str(i) input = str(i)
commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-step.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"' commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-step.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"'
# print(commandstep) # print(commandstep)
subprocess.run(commandstep, capture_output=True) subprocess.run(commandstep, capture_output=True)
# drawings files # drawings files
for i in track(drwgWithoutExtension, description="Exporting PDF and DXF..."): for i in track(drwgWithoutExtension, description="Exporting PDF and DXF...", total = len(drwgWithoutExtension)):
input = str(i) input = str(i)
commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-pdf-dxf.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"' commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\scripts\export-pdf-dxf.ps1 "' + path + "\\" + input + '" "' + outputFolder + input + '"'
# print(commandPdfDxf) # print(commandPdfDxf)