Metadata-Version: 2.4
Name: dxf_io
Version: 0.1.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Classifier: Typing :: Typed
Requires-Dist: numpy>=1.22
Requires-Dist: dxf-io[visualization,manifold] ; extra == 'all'
Requires-Dist: manifold3d>=3.0 ; extra == 'manifold'
Requires-Dist: pyvista>=0.40 ; extra == 'visualization'
Provides-Extra: all
Provides-Extra: manifold
Provides-Extra: visualization
License-File: LICENSE
Summary: Fast Rust-based DXF mesh reader and writer (SOLID / 3DFACE) with optional PyVista support.
Keywords: DXF,mesh,parser,writer,3DFACE,geometry,CAD,pyvista,Rust
Author-email: Antoine Collet <antoine.collet5@gmail.com>
License-Expression: BSD-3-Clause
Requires-Python: >=3.10
Description-Content-Type: text/x-rst; charset=UTF-8
Project-URL: Changelog, https://github.com/antoinecollet5/dxf_io/blob/master/CHANGELOG.md
Project-URL: Documentation, https://dxf-io.readthedocs.io
Project-URL: Homepage, https://github.com/antoinecollet5/dxf_io
Project-URL: Issues, https://github.com/antoinecollet5/dxf_io/issues
Project-URL: Repository, https://github.com/antoinecollet5/dxf_io

=================
dxf_io
=================

|License| |Python| |PyPI| |Build Status| |Documentation Status| |codecov| |Ruff| |ty|

🚀 **Fast Rust-based DXF mesh reader and writer, with optional PyVista support** — 10–100x faster than pure Python (ezdxf).

``dxf_io`` reads the ``SOLID`` and ``3DFACE`` entities of ASCII DXF files into NumPy
arrays (merging duplicate vertices and finding connected components), and writes
triangle meshes back as ``3DFACE`` entities.

**The complete and up to date documentation can be found here**: https://dxf-io.readthedocs.io.

===============
📦 Installation
===============

Pre-built wheels are available for Linux (x86_64, aarch64; glibc and musl), macOS
(Intel and Apple Silicon) and Windows (x64, ARM64), for CPython 3.10 to 3.15, including
free-threaded builds:

.. code-block:: bash

    pip install dxf_io                  # NumPy only
    pip install "dxf_io[visualization]" # + PyVista
    pip install "dxf_io[all]"           # + PyVista and manifold3d

Installing from source requires a `Rust toolchain <https://rustup.rs>`_.

==============
🧭 Quick start
==============

.. code-block:: python

    from dxf_io import dxf_to_manifold_meshes, parse_dxf_fast, write_dxf_fast

    # Raw arrays: points (N, 3) float64, faces (M, 3) and labels (N,) intp.
    mesh = parse_dxf_fast("model.dxf", decimals=6)
    print(mesh["points"].shape, mesh["faces"].shape)

    # One mesh per connected component (pyvista.PolyData if PyVista is installed).
    parts = dxf_to_manifold_meshes("model.dxf", use_pyvista=False)
    for part in parts:
        print(part.n_points, part.n_faces)

    # Write a triangle mesh (to a file, or to a string when no file is given).
    write_dxf_fast(mesh["points"], mesh["faces"], "out.dxf")

===============
⚡ Performance
===============

Parsing, vertex merging and writing run in Rust, use all the available cores and release
the GIL. On a 67 MB file (360,000 vertices, 720,000 triangles), parsing takes about
0.15 s and writing about 0.2 s on a 2-core machine, about 65x faster than
`ezdxf <https://ezdxf.mozman.at>`_ merely reading and iterating the faces (``dxf_io``
also merges the vertices and finds the connected components). Splitting a mesh into its
components is linear in its size, whatever the number of components.

Reproduce with ``uv run --with ezdxf python benchmark.py --synthetic 300 --ezdxf``.

==============
🛠️ Development
==============

.. code-block:: bash

    uv sync                               # builds the extension, installs dev tools
    uv run pytest && cargo test           # Python and Rust tests
    uv run ruff check . && uv run ruff format --check . && uv run ty check

See `CONTRIBUTING.md <https://github.com/antoinecollet5/dxf_io/blob/master/CONTRIBUTING.md>`_
for the release process.

=================
🤖 AI assistance
=================

Parts of this project were developed with the help of
`Claude <https://www.anthropic.com/claude>`_, Anthropic's AI assistant, under the
direction of the maintainer: notably the parallel parsing and vertex merging in Rust,
tests, packaging, and the CI and release workflows.

===========
🔑 License
===========

This project is released under the **BSD 3-Clause License**.

Copyright (c) 2026, Antoine COLLET. All rights reserved.

For more details, see the `LICENSE <https://github.com/antoinecollet5/dxf_io/blob/master/LICENSE>`_ file.

==============
⚠️ Disclaimer
==============

This software is provided "as is", without warranty of any kind, express or implied.
In no event shall the authors be liable for any damages arising from use of this software.

By using this software, you agree to accept full responsibility for any consequences.

============
📧 Contact
============

For questions, suggestions, or contributions:

- Email: `antoine.collet5@gmail.com <mailto:antoine.collet5@gmail.com>`_
- GitHub: `dxf_io <https://github.com/antoinecollet5/dxf_io>`_

Contributions are welcome!

=============
📚 References
=============

- `PyO3 Documentation <https://pyo3.rs>`_
- `Maturin <https://github.com/PyO3/maturin>`_
- `rayon - data parallelism <https://github.com/rayon-rs/rayon>`_
- `PyVista <https://docs.pyvista.org>`_

.. |License| image:: https://img.shields.io/badge/License-BSD_3--Clause-blue.svg
    :target: https://github.com/antoinecollet5/dxf_io/blob/master/LICENSE
    :alt: License

.. |Python| image:: https://img.shields.io/pypi/pyversions/dxf_io.svg
    :target: https://pypi.org/project/dxf_io/
    :alt: Python

.. |PyPI| image:: https://img.shields.io/pypi/v/dxf_io.svg
    :target: https://pypi.org/project/dxf_io/
    :alt: PyPI

.. |Build Status| image:: https://github.com/antoinecollet5/dxf_io/actions/workflows/main.yml/badge.svg
    :target: https://github.com/antoinecollet5/dxf_io/actions/workflows/main.yml
    :alt: Build Status

.. |Documentation Status| image:: https://readthedocs.org/projects/dxf-io/badge/?version=latest
    :target: https://dxf-io.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |codecov| image:: https://codecov.io/gh/antoinecollet5/dxf_io/graph/badge.svg?token=CxdQ0SkRbx
    :target: https://codecov.io/gh/antoinecollet5/dxf_io
    :alt: Code Coverage

.. |Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
    :target: https://github.com/astral-sh/ruff
    :alt: Ruff

.. |ty| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json
    :target: https://github.com/astral-sh/ty
    :alt: Checked with ty

