Metadata-Version: 2.4
Name: design3d
Version: 0.1.0
Summary: Python CAD modeler to design 3D models from code: B-Rep solids built, checked and exported to STEP and STL by a program, for AI agents, classic programming and design automation
Author-email: Steven Masfaraud <design3d@masfaraud.fr>
License-Expression: LGPL-2.1-only
Project-URL: Homepage, https://design3d.app
Project-URL: Documentation, https://design3d.app
Project-URL: Showcases, https://design3d.app/showcases/
Project-URL: Source, https://github.com/masfaraud/design3d
Project-URL: Issues, https://github.com/masfaraud/design3d/issues
Project-URL: Changelog, https://github.com/masfaraud/design3d/blob/master/CHANGELOG.md
Keywords: CAD,3D modeling,solid modeling,B-Rep,STEP,STL,NURBS,B-spline,mesh,parametric design,generative design,computational design,CAD from code,CAD automation,design automation,engineering design,AI agents,agentic engineering,LLM
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Manufacturing
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Cython
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: packaging
Requires-Dist: Cython>=3.0.0
Requires-Dist: numpy
Requires-Dist: orjson
Requires-Dist: matplotlib
Requires-Dist: scipy
Requires-Dist: geomdl
Requires-Dist: networkx
Requires-Dist: triangle
Requires-Dist: kaitaistruct
Requires-Dist: sympy
Requires-Dist: trimesh
Requires-Dist: rtree
Requires-Dist: pyfqmr
Requires-Dist: CGAL
Requires-Dist: scikit-learn
Requires-Dist: threadpoolctl
Requires-Dist: lxml
Provides-Extra: test
Requires-Dist: coverage; extra == "test"
Provides-Extra: doc
Requires-Dist: sphinx; extra == "doc"
Requires-Dist: nbsphinx; extra == "doc"
Requires-Dist: sphinx_book_theme; extra == "doc"
Requires-Dist: nbformat; extra == "doc"
Requires-Dist: nbconvert; extra == "doc"
Requires-Dist: sphinx_copybutton; extra == "doc"
Requires-Dist: sphinx_design; extra == "doc"
Requires-Dist: sphinx-sitemap; extra == "doc"
Requires-Dist: sphinxext-opengraph; extra == "doc"
Requires-Dist: myst-parser; extra == "doc"
Requires-Dist: ablog; extra == "doc"
Dynamic: license-file

<h1 align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/masfaraud/design3d/master/src/design3d/assets/logos/design3d-logo-horizontal-dark.svg">
    <img src="https://raw.githubusercontent.com/masfaraud/design3d/master/src/design3d/assets/logos/design3d-logo-horizontal-light.svg" alt="design3d" width="400">
  </picture>
</h1>

<h4 align="center">
  Python CAD from code, based on B-Rep, with STEP and STL import and export: ready for AI agents, programming and
  design automation
</h4>

<div align="center">
  <a href="https://github.com/masfaraud/design3d/actions/workflows/test.yml"><img src="https://github.com/masfaraud/design3d/actions/workflows/test.yml/badge.svg?branch=master"></a>
  <a href="https://github.com/masfaraud/design3d/stargazers/"><img src="https://badgen.net/github/stars/masfaraud/design3d"></a>
  <a href="https://pypi.org/project/design3d/"><img src="https://img.shields.io/pypi/v/design3d.svg"></a>
  <a href="https://github.com/masfaraud/design3d/graphs/contributors"><img src="https://img.shields.io/github/contributors/masfaraud/design3d.svg"></a>
  <a href="https://github.com/masfaraud/design3d/issues"><img src="https://img.shields.io/github/issues/masfaraud/design3d.svg"></a>
</div>

<div align="center">
  <a href="#description"><b>Description</b></a> |
  <a href="#showcases"><b>Showcases</b></a> |
  <a href="#built-for-agents"><b>Built for agents</b></a> |
  <a href="#user-installation"><b>User Installation</b></a> |
  <a href="#dev-installation"><b>Dev Installation</b></a> |
  <a href="#usage"><b>Usage</b></a> |
  <a href="#license"><b>License</b></a> |
  <a href="#team-and-contributors"><b>Contributors</b></a>
</div>

## Description

design3d is a Python CAD modeler based on Boundary Representation (B-Rep), made to design 3D models from code: models
are built, checked by computation (distances, intersections, volumes) and exported to STEP or STL by a program, with no
graphical interface to drive.

This is what makes it suited to agentic engineering: an AI agent writes the design logic in Python, runs it, checks the
result, iterates, and exports a STEP file that opens in any CAD software. The same code works without an agent, in
classic programming (scripts, notebooks, applications) and in design automation (configurators, families of parts,
design studies run in CI pipelines).

<p align="center"><a href="https://design3d.app/showcases/substation-of-poste-electrique-de-l-horme.html"><img src="https://raw.githubusercontent.com/masfaraud/design3d/master/docs/source/images/substation1.jpg" width="90%" /></a></p>
<p align="center"><i>A 63/20 kV substation designed on a real plot, its terminal towers at the real towers of the
incoming lines. Every part is placed by code and every clearance is checked by code. Click the picture to open
it in 3D.</i></p>

## Showcases

The showcases are complete engineering designs, not modeling exercises: each one starts from requirements and reference
data, derives the architecture by calculation, checks its constraints and iterates until they are satisfied. Their 3D
views open in the browser, from [design3d.app/showcases](https://design3d.app/showcases/). They were written by a coding
agent from a design brief, reviewed by an engineer, and show what an agent can build with design3d.

### 63/20 kV substation on real plots

<p align="center"><a href="https://design3d.app/showcases/"><img src="https://raw.githubusercontent.com/masfaraud/design3d/master/docs/source/images/substation2.jpg" width="80%" /></a></p>

The same outdoor substation is designed on three real plots of the Loire and Rhône (France), read from OpenStreetMap: a
roomy one, a cramped one with two incoming lines, an odd shaped one with three. From the nominal voltages, the design
derives the insulation levels and the clearances in air of IEC 61936-1, designs the post insulators for the pollution of
the site, lays out each bay by iterations on its clearances, sizes the transformers from their rating, chooses the order
of the bays by cost, and places the whole on the plot with the largest margin. Open in 3D:
[l'Horme](https://design3d.app/showcases/substation-of-poste-electrique-de-l-horme.html), [le Grand
Verger](https://design3d.app/showcases/substation-of-poste-electrique-du-grand-verger.html),
[Sury-le-Comtal](https://design3d.app/showcases/substation-of-poste-electrique-de-sury-le-comtal.html). About 5,100
lines of Python:
[scripts/showcases/substation](https://github.com/masfaraud/design3d/tree/master/scripts/showcases/substation).

### Double-deck high-speed train

<p align="center"><a href="https://design3d.app/showcases/high-speed-train.html"><img src="https://raw.githubusercontent.com/masfaraud/design3d/master/docs/source/images/high_speed_train.jpg" width="49%" /></a> <img src="https://raw.githubusercontent.com/masfaraud/design3d/master/docs/source/images/hst-1.jpg" width="49%" /></p>

A trainset inspired by the Alstom TGV M, designed as a system architecture. The architecture allocates to each system an
envelope, interfaces and a mass budget; each system (bogies, traction, air conditioning, staircases, carbody from its
aluminium extrusions...) is designed in its envelope and reports the issues it cannot solve; the architecture changes
its parameters and allocates again, until every system fits. The traction chain is sized from the performance
requirements, the air conditioning from the heat balance of the car. Open in 3D:
[trainset](https://design3d.app/showcases/high-speed-train.html), [trailer
architecture](https://design3d.app/showcases/trailer-architecture.html). About 7,100 lines of Python:
[scripts/showcases/high_speed_train](https://github.com/masfaraud/design3d/tree/master/scripts/showcases/high_speed_train).

### Motorcycle

<p align="center"><a href="https://design3d.app/showcases/motorcycle.html"><img src="https://raw.githubusercontent.com/masfaraud/design3d/master/docs/source/images/motorcycle.jpg" width="60%" /></a></p>

A motorcycle with the dimensions of a 2015 Yamaha MT-125: a few architecture parameters (tyre sizes, wheelbase, steering
geometry, swingarm) give the hardpoints, from which every part is built and placed. [Open in
3D](https://design3d.app/showcases/motorcycle.html). About 1,100 lines of Python:
[scripts/showcases/motorcycle_design.py](https://github.com/masfaraud/design3d/tree/master/scripts/showcases/motorcycle_design.py).

## Built for agents

An agent designing with design3d works in a loop: write the design code, run it, check the result, fix, export.
design3d gives it what each step needs:

- **Code only**: a plain Python library with no graphical interface to drive. Models are built, queried and modified
  by code, and run headless in scripts, notebooks, CI pipelines or agent sandboxes.
- **Checks by computation**: distances, intersections, volumes, point belonging and boolean operations let the agent
  verify its own work instead of trusting a picture.
- **Serialization**: objects serialize to JSON (`to_dict` and `SerializableObject.from_json`), so models can be
  stored, compared and passed between tools.
- **Exchange**: STEP and STL import and export bring the results into standard CAD software.
- **Visual review**: `babylonjs()` opens the model in a web viewer with its scene tree, to show the result to a human.
- **Rich geometry**: B-spline curves and surfaces, sweeps, lofts, revolutions and extrusions.

```python
import design3d
from design3d import primitives3d
from design3d.core import VolumeModel


def cube(center, side, name):
    return primitives3d.Block(
        design3d.Frame3D(center, side * design3d.X3D, side * design3d.Y3D, side * design3d.Z3D), name=name
    )


housing = cube(design3d.O3D, 0.5, "housing")
part = cube(design3d.Point3D(0.6, 0.0, 0.0), 0.2, "part")

# The agent checks its own design before exporting it
assert housing.is_disjoint_from(part), "the part collides with the housing"
print(f"housing volume: {housing.volume():.3f} m3")

VolumeModel([housing, part], name="checked design").to_step("checked_design.step")
```

design3d itself is developed with coding agents: the repository ships instructions for them in
[AGENTS.md](AGENTS.md), and a test suite to check every change. design3d is a hard fork of the discontinued volmdlr
project.

## User Installation

```bash
pip install design3d
```

design3d requires Python 3.12 or later.

## Dev Installation

Building design3d compiles Cython extensions, so you need a C/C++ compiler (usually already available on Linux and
macOS; on Windows, install the Microsoft C++ Build Tools).

```bash
git clone https://github.com/masfaraud/design3d.git
cd design3d
pip install -e '.[test,doc]'
pre-commit install
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for how to run the tests and checks before opening a pull request.

## Usage

```python
import design3d
from design3d import primitives3d
from design3d.core import VolumeModel

# A 30 cm cube centered on the origin
block = primitives3d.Block(
    design3d.Frame3D(design3d.O3D, 0.3 * design3d.X3D, 0.3 * design3d.Y3D, 0.3 * design3d.Z3D),
    name="block",
)
print(block.volume())  # 0.027

model = VolumeModel([block])
model.to_step("block.step")  # export to STEP
model.babylonjs()  # display in your web browser
```

More examples are in the [scripts](https://github.com/masfaraud/design3d/tree/master/scripts) folder.

## Documentation

The documentation is not published online yet. To build it locally:

```bash
pip install '.[doc]'
make -C docs html
```

Then open `docs/build/html/index.html`.

## License

100% open source under the LGPL 2.1 license. See [LICENSE](LICENSE) for more details.

## Team and contributors

design3d is a hard fork of the discontinued [volmdlr](https://github.com/Dessia-tech/volmdlr) project: credits to the
volmdlr project team.
