Skip to content

nextgis/libredwg-cpp

Repository files navigation

LibreDWG-Cpp

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.

Installation to Virtualenv

  1. Install dependecies:
    build-essential
    cmake
  1. Create virtualenv, activate it and install the package there:
$ python3 -m venv env
$ source env/bin/activate
$ pip install --editable ./[dev,tests]
  1. Run the tests:
$ cd tests
$ mkdir -p ./out_data
$ python -m pytest

Running Python Tests in Docker

To run Python tests in Docker container, based on Ubuntu, use:

$ docker build -t libredwg-cpp .

Usage Example (Python)

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)

Developer Notes

This project uses pre-commit to enforce code quality standards.

First, make sure pre-commit is installed:

$ pip install pre-commit

Then, enable it in the project by running:

$ pre-commit install

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •