mirror of
https://github.com/gumyr/build123d.git
synced 2025-12-05 18:20:46 -08:00
Compare commits
3 commits
72e89b7b1d
...
70310ddd4a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70310ddd4a | ||
|
|
3942c32804 | ||
|
|
a649fab27c |
3 changed files with 61 additions and 48 deletions
15
NOTICE
Normal file
15
NOTICE
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
build123d
|
||||
Copyright (c) 2022–2025 The build123d Contributors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at:
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
This project was originally derived from portions of the CadQuery codebase
|
||||
(https://github.com/CadQuery/cadquery) but has since been extensively
|
||||
refactored and restructured into an independent system.
|
||||
CadQuery is licensed under the Apache License, Version 2.0.
|
||||
16
README.md
16
README.md
|
|
@ -19,9 +19,17 @@
|
|||
[](https://doi.org/10.5281/zenodo.14872322)
|
||||
|
||||
|
||||
Build123d is a python-based, parametric, [boundary representation (BREP)][BREP] modeling framework for 2D and 3D CAD. It's built on the [Open Cascade] geometric kernel and allows for the creation of complex models using a simple and intuitive python syntax. Build123d can be used to create models for 3D printing, CNC machining, laser cutting, and other manufacturing processes. Models can be exported to a wide variety of popular CAD tools such as [FreeCAD] and SolidWorks.
|
||||
Build123d is a Python-based, parametric [boundary representation (BREP)][BREP] modeling framework for 2D and 3D CAD. Built on the [Open Cascade] geometric kernel, it provides a clean, fully Pythonic interface for creating precise models suitable for 3D printing, CNC machining, laser cutting, and other manufacturing processes. Models can be exported to popular CAD tools such as [FreeCAD] and SolidWorks.
|
||||
|
||||
Build123d could be considered as an evolution of [CadQuery] where the somewhat restrictive Fluent API (method chaining) is replaced with stateful context managers - e.g. `with` blocks - thus enabling the full python toolbox: for loops, references to objects, object sorting and filtering, etc.
|
||||
Designed for modern, maintainable CAD-as-code, build123d combines clear architecture with expressive, algebraic modeling. It offers:
|
||||
- Minimal or no internal state depending on mode,
|
||||
- Explicit 1D, 2D, and 3D geometry classes with well-defined operations,
|
||||
- Extensibility through subclassing and functional composition—no monkey patching,
|
||||
- Standards-compliant code (PEP 8, mypy, pylint) with rich pylance type hints,
|
||||
- Deep Python integration—selectors as lists, locations as iterables, and natural conversions (Solid(shell), tuple(Vector)),
|
||||
- Operator-driven modeling (obj += sub_obj, Plane.XZ * Pos(X=5) * Rectangle(1, 1)) for algebraic, readable, and composable design logic.
|
||||
|
||||
The result is a framework that feels native to Python while providing the full power of OpenCascade geometry underneath.
|
||||
|
||||
The documentation for **build123d** can be found at [readthedocs](https://build123d.readthedocs.io/en/latest/index.html).
|
||||
|
||||
|
|
@ -62,6 +70,10 @@ python3 -m pip install -e .
|
|||
|
||||
Further installation instructions are available (e.g. Poetry) see the [installation section on readthedocs](https://build123d.readthedocs.io/en/latest/installation.html).
|
||||
|
||||
Attribution:
|
||||
|
||||
Build123d was originally derived from portions of the [CadQuery] codebase but has since been extensively refactored and restructured into an independent system.
|
||||
|
||||
[BREP]: https://en.wikipedia.org/wiki/Boundary_representation
|
||||
[CadQuery]: https://cadquery.readthedocs.io/en/latest/index.html
|
||||
[FreeCAD]: https://www.freecad.org/
|
||||
|
|
|
|||
|
|
@ -29,68 +29,54 @@
|
|||
:align: center
|
||||
:alt: build123d logo
|
||||
|
||||
Build123d is a python-based, parametric, boundary representation (BREP) modeling
|
||||
framework for 2D and 3D CAD. It's built on the Open Cascade geometric kernel and
|
||||
allows for the creation of complex models using a simple and intuitive python
|
||||
syntax. Build123d can be used to create models for 3D printing, CNC machining,
|
||||
laser cutting, and other manufacturing processes. Models can be exported to a
|
||||
wide variety of popular CAD tools such as FreeCAD and SolidWorks.
|
||||
|
||||
Build123d could be considered as an evolution of
|
||||
`CadQuery <https://cadquery.readthedocs.io/en/latest/index.html>`_ where the
|
||||
somewhat restrictive Fluent API (method chaining) is replaced with stateful
|
||||
context managers - i.e. `with` blocks - thus enabling the full python toolbox:
|
||||
for loops, references to objects, object sorting and filtering, etc.
|
||||
|
||||
Note that this documentation is available in
|
||||
`pdf <https://build123d.readthedocs.io/_/downloads/en/latest/pdf/>`_ and
|
||||
`epub <https://build123d.readthedocs.io/_/downloads/en/latest/epub/>`_ formats
|
||||
for reference while offline.
|
||||
|
||||
########
|
||||
Overview
|
||||
About
|
||||
########
|
||||
|
||||
build123d uses the standard python context manager - i.e. the ``with`` statement often used when
|
||||
working with files - as a builder of the object under construction. Once the object is complete
|
||||
it can be extracted from the builders and used in other ways: for example exported as a STEP
|
||||
file or used in an Assembly. There are three builders available:
|
||||
Build123d is a Python-based, parametric (BREP) modeling framework for 2D and 3D CAD.
|
||||
Built on the Open Cascade geometric kernel, it provides a clean, fully Pythonic interface
|
||||
for creating precise models suitable for 3D printing, CNC machining, laser cutting, and
|
||||
other manufacturing processes. Models can be exported to popular CAD tools such as FreeCAD
|
||||
and SolidWorks.
|
||||
|
||||
* **BuildLine**: a builder of one dimensional objects - those with the property
|
||||
of length but not of area or volume - typically used
|
||||
to create complex lines used in sketches or paths.
|
||||
* **BuildSketch**: a builder of planar two dimensional objects - those with the property
|
||||
of area but not of volume - typically used to create 2D drawings that are extruded into 3D parts.
|
||||
* **BuildPart**: a builder of three dimensional objects - those with the property of volume -
|
||||
used to create individual parts.
|
||||
Designed for modern, maintainable CAD-as-code, build123d combines clear architecture with
|
||||
expressive, algebraic modeling. It offers:
|
||||
|
||||
The three builders work together in a hierarchy as follows:
|
||||
* Minimal or no internal state depending on mode
|
||||
* Explicit 1D, 2D, and 3D geometry classes with well-defined operations
|
||||
* Extensibility through subclassing and functional composition—no monkey patching
|
||||
* Standards-compliant code (PEP 8, mypy, pylint) with rich pylance type hints
|
||||
* Deep Python integration—selectors as lists, locations as iterables, and natural
|
||||
conversions (``Solid(shell)``, ``tuple(Vector)``)
|
||||
* Operator-driven modeling (``obj += sub_obj``, ``Plane.XZ * Pos(X=5) * Rectangle(1, 1)``)
|
||||
for algebraic, readable, and composable design logic
|
||||
|
||||
.. code-block:: python
|
||||
The result is a framework that feels native to Python while providing the full power of
|
||||
OpenCascade geometry underneath.
|
||||
|
||||
with BuildPart() as my_part:
|
||||
...
|
||||
with BuildSketch() as my_sketch:
|
||||
...
|
||||
with BuildLine() as my_line:
|
||||
...
|
||||
...
|
||||
...
|
||||
|
||||
where ``my_line`` will be added to ``my_sketch`` once the line is complete and ``my_sketch`` will be
|
||||
added to ``my_part`` once the sketch is complete.
|
||||
With build123d, intricate parametric models can be created in just a few lines of readable
|
||||
Python code—as demonstrated by the tea cup example below.
|
||||
|
||||
As an example, consider the design of a tea cup:
|
||||
.. dropdown:: Teacup Example
|
||||
|
||||
.. literalinclude:: ../examples/tea_cup.py
|
||||
:start-after: [Code]
|
||||
:end-before: [End]
|
||||
.. literalinclude:: ../examples/tea_cup.py
|
||||
:start-after: [Code]
|
||||
:end-before: [End]
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
|
||||
<model-viewer poster="_images/tea_cup.png" src="_static/tea_cup.glb" alt="A tea cup modelled in build123d" auto-rotate camera-controls style="width: 100%; height: 50vh;"></model-viewer>
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
This documentation is available in
|
||||
`pdf <https://build123d.readthedocs.io/_/downloads/en/latest/pdf/>`_ and
|
||||
`epub <https://build123d.readthedocs.io/_/downloads/en/latest/epub/>`_ formats
|
||||
for reference while offline.
|
||||
|
||||
.. note::
|
||||
|
||||
There is a `Discord <https://discord.com/invite/Bj9AQPsCfx>`_ server (shared with CadQuery) where
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue