cleaning
This commit is contained in:
parent
6f72497a24
commit
d51d611905
23
gui.py
23
gui.py
@ -1,16 +1,23 @@
|
|||||||
import PySimpleGUI as sg
|
import PySimpleGUI as sg
|
||||||
import sys
|
import subprocess
|
||||||
|
import sys, os
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) > 1:
|
||||||
fname = sg.Window('My Script',
|
cmd = "python scripts/run.py " + str(sys.argv[1] )
|
||||||
[[sg.Text('Document to open')],
|
print(cmd)
|
||||||
[sg.In(), sg.FileBrowse()],
|
p = subprocess.Popen(cmd, shell=True)
|
||||||
[sg.Open(), sg.Cancel()]]).read(close=True)[1][0]
|
|
||||||
else:
|
else:
|
||||||
fname = sys.argv[1]
|
fname = sg.Window('Files exporter',
|
||||||
|
[[sg.Text('Folder to export')],
|
||||||
|
[sg.In(), sg.FolderBrowse()],
|
||||||
|
[sg.Open(), sg.Cancel()]]).read(close=True)[1][0]
|
||||||
|
|
||||||
if not fname:
|
if not fname:
|
||||||
sg.popup("Cancel", "No filename supplied")
|
sg.popup("Cancel", "No filename supplied")
|
||||||
raise SystemExit("Cancelling: no filename supplied")
|
raise SystemExit("Cancelling: no filename supplied")
|
||||||
else:
|
else:
|
||||||
sg.popup('The filename you chose was', fname)
|
# sg.popup('The filename you chose was', fname)
|
||||||
|
print(fname)
|
||||||
|
cmd = "python scripts/run.py " + str(fname)
|
||||||
|
print(cmd)
|
||||||
|
p = subprocess.Popen(cmd, shell=True)
|
||||||
|
19
runSimple.py
19
runSimple.py
@ -1,19 +0,0 @@
|
|||||||
# example: .\run.py path\Part1
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import pathlib
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
# folder input
|
|
||||||
if(sys.argv[1]):
|
|
||||||
pass
|
|
||||||
|
|
||||||
files = sys.argv[1:] # take files given in input
|
|
||||||
currentPath = str(pathlib.Path().resolve())
|
|
||||||
|
|
||||||
for i in files:
|
|
||||||
input = str(i)
|
|
||||||
commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + "\export-step.ps1 " + input
|
|
||||||
commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + "\export-pdf-dxf.ps1 " + input
|
|
||||||
subprocess.run(commandstep)
|
|
||||||
subprocess.run(commandPdfDxf)
|
|
BIN
sample_parts/Part1 - Copy - Copy.SLDPRT
Normal file
BIN
sample_parts/Part1 - Copy - Copy.SLDPRT
Normal file
Binary file not shown.
BIN
sample_parts/Part1 - Copy.SLDDRW
Normal file
BIN
sample_parts/Part1 - Copy.SLDDRW
Normal file
Binary file not shown.
BIN
sample_parts/Part1 - Copy.SLDPRT
Normal file
BIN
sample_parts/Part1 - Copy.SLDPRT
Normal file
Binary file not shown.
@ -45,13 +45,13 @@ if not os.path.exists(outputFolder):
|
|||||||
# part files
|
# part files
|
||||||
for i in track(partWithoutExention, description="Exporting step files..."):
|
for i in track(partWithoutExention, description="Exporting step files..."):
|
||||||
input = str(i)
|
input = str(i)
|
||||||
commandstep = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\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..."):
|
||||||
input = str(i)
|
input = str(i)
|
||||||
commandPdfDxf = "PowerShell -NoProfile -ExecutionPolicy Bypass -File " + currentPath + '\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)
|
||||||
subprocess.run(commandPdfDxf, capture_output=True)
|
subprocess.run(commandPdfDxf, capture_output=True)
|
Loading…
Reference in New Issue
Block a user