diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4bbd579 --- /dev/null +++ b/.gitignore @@ -0,0 +1,169 @@ +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + +/site-packages + +# Benutzerdefiniert +/data +/work +/log +work/easy.dxf +work/easy_todraw_edit.json diff --git a/README.md b/README.md index d2bc1bb..fa3d9d0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ # plant2dxf -Erzeugt aus einer csv Datei mit Angaben über alle in einer Anlage enthaltenen Elemente eine dxf der Anlage \ No newline at end of file +Erzeugt aus einer csv Datei mit Angaben über alle in einer Anlage enthaltenen Elemente eine dxf der Anlage + + +``csv + + Elementnummer;TeileArt;TeileId;NachbarIds;Bezeichnung;Planquadrat;Merkmale + 1;"ILS 2.0 Kreisel";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"shape_d76e250a-0a46-f6d0-df52-943ab572cc63,shape_ad62cba4-3a33-c4c5-944f-eac7abb7603e,shape_456bee3e-01e8-be9e-aa74-4265c1195bbe,shape_463bb635-b3b0-d4e9-c8b9-42be3b7219b7,shape_6d9bfe2c-d8b8-3ceb-bf26-bdacd0a40712,shape_1ca5b56e-7825-2852-d241-0562233b6310,shape_2f9fa13c-23d5-784d-da4c-8d1c7e313116,shape_fa451c64-e507-8932-d5da-7cc93476a176,shape_30127aba-263b-1ed5-c5cf-e27933594406,shape_641530a1-7396-8e83-3a50-1bc59a406a5e,shape_161f85cd-b1f4-0943-34b7-1d3b8134bcc0,shape_e8f52a47-c493-39ef-ddcb-78297d96944d,shape_24812b84-fd3b-6a44-0302-2d0fc169a6d9,shape_80ca3488-cc41-4caa-00cd-b3de9f5428e6,shape_8b856d97-b18b-6263-7c98-79d8b4ca679a,shape_67f8d19e-8857-1f5d-7d90-3a2a0a9da157";"Kreisel:1";"X:9174.15 Y:12039.11";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"20.265","Anzahl der Separatoren":"2","Anzahl der Scanner":"0","Anzahl der Rampen":"0","Höhe in m":"2"} + 2;"ILS 2.0 Kreisel";"shape_8e75c773-8088-b286-9dc0-f601442d5e70";"shape_ad62cba4-3a33-c4c5-944f-eac7abb7603e";"Kreisel:2";"X:18174.14 Y:12004.13";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"20.265","Anzahl der Separatoren":"2","Anzahl der Scanner":"0","Anzahl der Rampen":"0","Höhe in m":"2"} + 3;"ILS 2.0 Kreisel";"shape_d76e250a-0a46-f6d0-df52-943ab572cc63";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29,Weiche_Xg8Ledh-T0ejWPHluSM8tA";"Kreisel:3";"X:12474.15 Y:22171.59";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"5","Anzahl der Separatoren":"2","Anzahl der Scanner":"0","Anzahl der Rampen":"0","Höhe in m":"2"} + 4;"ILS 2.0 Weiche";"Weiche_Xg8Ledh-T0ejWPHluSM8tA";"shape_d76e250a-0a46-f6d0-df52-943ab572cc63";" zw. Kreisel:3 und Kreisel:1";"X:9574.15 Y:22171.59";{"Weichenart":"Aktiv"} + 5;"ILS 2.0 Gefällestrecke";"shape_ad62cba4-3a33-c4c5-944f-eac7abb7603e";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29,shape_8e75c773-8088-b286-9dc0-f601442d5e70";"";"X:13674.14 Y:20021.68";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 6;"ILS 2.0 Gefällestrecke";"shape_456bee3e-01e8-be9e-aa74-4265c1195bbe";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13624.15 Y:18421.59";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.1"} + 7;"ILS 2.0 Gefällestrecke";"shape_30127aba-263b-1ed5-c5cf-e27933594406";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:12821.68";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 8;"ILS 2.0 Gefällestrecke";"shape_6d9bfe2c-d8b8-3ceb-bf26-bdacd0a40712";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:16021.66";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 9;"ILS 2.0 Gefällestrecke";"shape_463bb635-b3b0-d4e9-c8b9-42be3b7219b7";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:16821.71";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 10;"ILS 2.0 Gefällestrecke";"shape_1ca5b56e-7825-2852-d241-0562233b6310";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:15221.61";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 11;"ILS 2.0 Gefällestrecke";"shape_e8f52a47-c493-39ef-ddcb-78297d96944d";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:10421.53";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 12;"ILS 2.0 Gefällestrecke";"shape_161f85cd-b1f4-0943-34b7-1d3b8134bcc0";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:11221.58";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 13;"ILS 2.0 Gefällestrecke";"shape_641530a1-7396-8e83-3a50-1bc59a406a5e";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:12021.63";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 14;"ILS 2.0 Gefällestrecke";"shape_fa451c64-e507-8932-d5da-7cc93476a176";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:13621.51";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 15;"ILS 2.0 Gefällestrecke";"shape_2f9fa13c-23d5-784d-da4c-8d1c7e313116";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:14421.56";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 16;"ILS 2.0 Gefällestrecke";"shape_24812b84-fd3b-6a44-0302-2d0fc169a6d9";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13624.16 Y:17621.54";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.1"} + 17;"ILS 2.0 Gefällestrecke";"shape_8b856d97-b18b-6263-7c98-79d8b4ca679a";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:8821.64";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 18;"ILS 2.0 Gefällestrecke";"shape_67f8d19e-8857-1f5d-7d90-3a2a0a9da157";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:8021.59";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + 19;"ILS 2.0 Gefällestrecke";"shape_80ca3488-cc41-4caa-00cd-b3de9f5428e6";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";"";"X:13674.15 Y:9621.69";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2"} + + ![Mubea Anlage](doc/images/mubea.png) \ No newline at end of file diff --git a/bin/get_cmd.bat b/bin/get_cmd.bat new file mode 100644 index 0000000..4dab2dd --- /dev/null +++ b/bin/get_cmd.bat @@ -0,0 +1,4 @@ +@echo off +call setenv.bat +start + diff --git a/bin/install_py.bat b/bin/install_py.bat new file mode 100644 index 0000000..ca9b59f --- /dev/null +++ b/bin/install_py.bat @@ -0,0 +1,15 @@ +call setenv.bat +if not exist %PROJECT%\.venv ( + ECHO Initialisiere Python virtual environment... + py -m venv %PROJECT%\.venv --upgrade-deps + ECHO Erfolgreich. + + call %PROJECT%\.venv\Scripts\activate.bat + ECHO Installiere erforderliche Python Packages... + pip install -r %PROJECT_LIB%/requirements.txt -q + ECHO Erfolgreich + deactivate + + ) ELSE ( + ECHO Erforderliche Python Packages bereits installiert! + ) diff --git a/bin/manage_interpreter.bat b/bin/manage_interpreter.bat new file mode 100644 index 0000000..02d47a3 --- /dev/null +++ b/bin/manage_interpreter.bat @@ -0,0 +1,30 @@ +@echo off +CALL setenv.bat +IF DEFINED NETWORK_INTERPRETER_PATH ( + goto %~1_network + +) ELSE ( + goto %~1_local +) + +:activate_interpreter_local +IF NOT EXIST %PROJECT%\.venv CALL %PROJECT_BIN%\install_py.bat +CALL %PROJECT%\.venv\Scripts\activate.bat +goto :eof + +:deactivate_interpreter_local +deactivate +goto :eof + +:activate_interpreter_network +SET OLD_PATH=%PATH% +SET PATH=%NETWORK_INTERPRETER_PATH%;%PATH% +CALL %PROJECT%\.venv\Scripts\activate.bat +goto :eof + +:deactivate_interpreter_network +SET PATH=%OLD_PATH% +SET OLD_PATH= +SET NETWORK_INTERPRETER_PATH= +CALL %PROJECT%\.venv\Scripts\deactivate.bat +goto :eof diff --git a/bin/plant2dxf.bat b/bin/plant2dxf.bat new file mode 100644 index 0000000..4e590e7 --- /dev/null +++ b/bin/plant2dxf.bat @@ -0,0 +1,4 @@ +@echo off +CALL manage_interpreter.bat activate_interpreter +python %PROJECT_LIB%\plant2dxf.py %* +CALL manage_interpreter.bat deactivate_interpreter diff --git a/bin/setenv.bat b/bin/setenv.bat new file mode 100644 index 0000000..9c1b715 --- /dev/null +++ b/bin/setenv.bat @@ -0,0 +1,30 @@ +@echo off +REM falls Umlaute in den Pfaden sind: +chcp 65001 > nul +REM ~dp0 steht für das Verzeichnis, in der diese Datei liegt +pushd %~dp0\.. + +set PROJECT=%cd% +set PROJECT_BIN=%PROJECT%\bin +set PROJECT_CFG=%PROJECT%\cfg +set PROJECT_DOC=%PROJECT%\doc +set PROJECT_LIB=%PROJECT%\lib +set PROJECT_DATA=%PROJECT%\data +set PROJECT_WORK=%PROJECT%\work +set PROJECT_TEST=%PROJECT%\testdata + +set SIVAS_TEILESTAMM=\\195.243.223.3\sivas\jit\programme\KSbExcelExportSivasTeilestamm.exe +set SIVAS_EXCEL_EXPORT_DIR=%PROJECT_DATA% + +if not exist %PROJECT%\work mkdir %PROJECT%\work +if not exist %PROJECT%\data mkdir %PROJECT%\data + +set PROJECT_IO_RESULTS=%PROJECT_WORK% +set PROJECT_BOM_RESULTS=%PROJECT_WORK% +set INSTALL_DIR="%ONEDRIVE%\Desktop\Kabeltool" + +set PATH=%PROJECT_BIN%;%PATH% + + +popd +goto :eof diff --git a/cfg/allgemein.cfg b/cfg/allgemein.cfg new file mode 100644 index 0000000..7003541 --- /dev/null +++ b/cfg/allgemein.cfg @@ -0,0 +1,2 @@ +# Allgemeine Konfigurationsdatei, welche die einzulesenden Layer, sowie geometrische Abhängigkeiten steuert. +# General Config-File, that controls the Layers being read while processing a certain dxf file diff --git a/doc/images/mubea.png b/doc/images/mubea.png new file mode 100644 index 0000000..732b815 Binary files /dev/null and b/doc/images/mubea.png differ diff --git a/lib/plant2dxf.py b/lib/plant2dxf.py new file mode 100644 index 0000000..434af0d --- /dev/null +++ b/lib/plant2dxf.py @@ -0,0 +1,25 @@ +import os +import unittest + + +class TestPlant(unittest.TestCase): + + def test_duplicate_points(self): + ''' Testet das Nicht-Hinzufügen von doppelten Punkten''' + + # nodeids.add_point(Point(1,1)) + # nodeids.add_point(Point(1,1)) + + self.assertEqual(1, 1) + +if __name__ == '__main__': + # Plot Ausgabe in Unittests steuern + draw = False + + suite = unittest.TestSuite() + suite.addTest(TestPlant('test_duplicate_points')) + runner = unittest.TextTestRunner() + runner.run(suite) + +if __name__ == "__main__": + diff --git a/lib/requirements.txt b/lib/requirements.txt new file mode 100644 index 0000000..9cdb0fe --- /dev/null +++ b/lib/requirements.txt @@ -0,0 +1 @@ +ezdxf==1.4.1