exploration/upgrade_old_dxf_versions/upgrade_R14_to_R2000.py
raw| 1 | # Copyright (c) 2021, Manfred Moitzi |
| 2 | # License: MIT License |
| 3 | |
| 4 | from pathlib import Path |
| 5 | import ezdxf |
| 6 | |
| 7 | DIR = Path(ezdxf.EZDXF_TEST_FILES) / "R14_test_files" |
| 8 | |
| 9 | |
| 10 | def upgrade_dxf_file(name): |
| 11 | print(f"upgrade {name} to R2000") |
| 12 | dwg = ezdxf.readfile(DIR / name) |
| 13 | dwg.saveas(DIR / "as_R2000" / name) |
| 14 | |
| 15 | |
| 16 | def main(): |
| 17 | for dxf_file in DIR.glob("*.dxf"): |
| 18 | name = dxf_file.name |
| 19 | upgrade_dxf_file(name) |
| 20 | |
| 21 | |
| 22 | if __name__ == "__main__": |
| 23 | main() |