diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2ee73ea --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,35 @@ +{ + // Verwendet IntelliSense zum Ermitteln möglicher Attribute. + // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. + // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python-Debugger: Aktuelle Datei mit Argumenten", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "args": "${command:pickArgs}" + }, + { + "name": "Python: Aktuelle Datei", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true + }, + { + "name": "use filename and default", + "type": "debugpy", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "justMyCode": true, + "args": [ + "--filename ST_6300_Steuerungstestlayout1_neueBloecke.dxf" + ], + } + ] +} \ No newline at end of file diff --git a/bin/getpositions.bat b/bin/getpositions.bat new file mode 100644 index 0000000..d17e900 --- /dev/null +++ b/bin/getpositions.bat @@ -0,0 +1,4 @@ +@echo off +CALL manage_interpreter.bat activate_interpreter +python %PROJECT_LIB%\getpositions.py +CALL manage_interpreter.bat deactivate_interpreter diff --git a/lib/getpositions.py b/lib/getpositions.py index bb1e089..2a5b71b 100644 --- a/lib/getpositions.py +++ b/lib/getpositions.py @@ -2,6 +2,7 @@ import argparse import configparser import ezdxf import os +import sys """ Dieses Programm: @@ -50,11 +51,11 @@ def get_dxf_file(filepath): return doc if __name__ == '__main__': - parser = argparse.ArgumentParser(description='fetches positions from a dxf file', prog='get_positions') - parser.add_argument('-f', '--filename', action='store', required=True, default="ST_6300_Steuerungstestlayout1_neueBloecke.dwg", help='which file should be fetched', metavar='file') - parser.add_argument('-i', '--input', action='store_true', help='fetch all position of inputs', metavar='input') - parser.add_argument('-o', '--output', action='store_true', help='fetch all positions of outputs', metavar='output') - parser.add_argument('-r', '--rack', action='store_true', help='fetch all positions of all cable racks', metavar='output') + parser = argparse.ArgumentParser(description='fetches the x/y positions from a dxf file', prog='getpositions') + parser.add_argument('-f', '--filename', action='store', default="ST_6300_Steuerungstestlayout1_neueBloecke.dwg", help='which file should be fetched', metavar='myfile.dwg') + parser.add_argument('-i', '--input', action='store_true', help='fetch all position of inputs') + parser.add_argument('-o', '--output', action='store_true', help='fetch all positions of outputs') + parser.add_argument('-r', '--rack', action='store_true', help='fetch all positions of all cable racks') args = parser.parse_args() @@ -62,7 +63,7 @@ if __name__ == '__main__': work_dir = os.environ.get('PROJECT_WORK') filename = args.filename - doc = get_dxf_file(os.path.join(out_dir, filename)) + doc = get_dxf_file(os.path.join(work_dir, filename)) res = dict() if args.input: