C++ Wrapper around LibreDWG C library - free implementation of the DWG file format. LibreDWG-Cpp allows to convert DWG file to DXF. Also, LibreDWG-Cpp provides a Python API.
- Install dependecies:
build-essential
cmake
- Create virtualenv, activate it and install the package there:
$ python3 -m venv env
$ source env/bin/activate
$ pip install --editable ./[dev,tests]- Run the tests:
$ cd tests
$ mkdir -p ./out_data
$ python -m pytestTo run Python tests in Docker container, based on Ubuntu, use:
$ docker build -t libredwg-cpp .import libredwg_cpp
try:
document = libredwg_cpp.Document.open("path-to-dwg-file.dwg")
print("'path-to-dwg-file.dwg' was successfully opened. It's version:", document.version())
document.write_dxf("path-to-target-dxf-file.dxf")
print("Convertation to DXF completed successfully.")
except libredwg_cpp.Error as error:
print("An error occurred:", error)This project uses pre-commit to enforce code quality standards.
First, make sure pre-commit is installed:
$ pip install pre-commitThen, enable it in the project by running:
$ pre-commit install