a programmatic cad library
Project description
A library for working with three-dimensional geometry. Designed for CAD / CAM applications.
To get started with this library, we recommend walking through the demos below. Each notebook contains links to our comprehensive class and method-level documentation.
Online Demo
Thanks to the magic of binder, you can try out petrify online. We have demos for several core petrify features:
Construction of many basic solids.
Methods for defining advanced solids.
Combining multiple solids into a single complex solid.
Have patience; notebooks on binder can take up to a minute to start. Due to a bug in pythreejs, you’ll need to click “restart and run all” to see the relevant interactive visualizations.
Design Principles
Novice focus. This library should make it as easy as possible to build and manipulate solids, shapes, and other geometry.
Immutable operation. Immutable math is easier for novices to reason about. This library explicitly does not target strong real-time applications like games that demands mutability for performance.
Pluggable engines. CSG is complicated. Different engines have different tradeoffs:
The pymesh engine is the default where the pymesh2 library is installed. It uses the IGL engine, which is mature and quite fast. However, building pymesh with IGL support can be difficult for novices and in certain environments (like Windows).
cython-csg is relatively fast, but still requires a cython build toolchain.
pycsg is a pure-python implementation. It is obviously quite slow, but works everywhere python does. For example, pure python environments like pyiodide can utilize this engine easily.
Contributors
This library is a fusion of:
pycsg
pyeuclid v3 fork (https://github.com/ezag/pyeuclid/)
the reverbat STL PR on pycsg (https://github.com/timknip/pycsg/pull/9)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.