2D irregular nesting (OpenNest) for COMPAS.
Project description
compas_nest
Documentation: https://petrasvestartas.github.io/compas_nest/
2D irregular nesting for the COMPAS framework — Python bindings for the OpenNest C++ engines, built with nanobind.
Nest polylines with holes into sheets with holes, with live terminal progress and compas_viewer visualization.
Two engines
| Class | Engine | Notes |
|---|---|---|
opennest_collision |
physics / overlap-relaxation (np_nest) |
dependency-free; iteration-budget driven; nests parts into holes |
opennest |
NFP + genetic algorithm (nfp_nest) |
bundled Clipper2; generation/fitness driven; carries part attributes through placement |
Install
pip install compas_nest
From source (editable)
One-step (uv, macOS + Windows Git Bash + Linux): creates a local .venv, installs every
dependency, and builds the package:
git clone --recurse-submodules https://github.com/petrasvestartas/compas_nest.git
cd compas_nest
bash bash/install.sh
After editing C++ sources, rebuild without recreating the env: bash bash/build.sh --test.
conda:
conda env create -f environment.yml
conda activate compas_nest
pip install --no-build-isolation -ve .
plain pip:
pip install nanobind "scikit-build-core[pyproject]"
pip install --no-build-isolation -ve .
The C++ engine sources live under external/nest/ (nest_physics_cpp/ + opennest_cpp/, the latter
bundling Clipper2 and a minimal Boost subset). They are self-contained — no CGAL/Boost/Eigen download
is needed.
Quick start
from compas.geometry import Polyline
from compas_nest import nest_geo, nest_sheets, opennest_collision
def rect(x0, y0, w, h):
return Polyline([[x0, y0, 0], [x0+w, y0, 0], [x0+w, y0+h, 0], [x0, y0+h, 0], [x0, y0, 0]])
geo = nest_geo()
geo.add_part(rect(0, 0, 20, 10), copies=3)
geo.add_part(rect(0, 0, 15, 15), holes=[rect(5, 5, 5, 5)], copies=2)
sheets = nest_sheets()
sheets.add_sheet(rect(0, 0, 100, 100), holes=[rect(40, 40, 10, 10)])
result = opennest_collision(iterations=2000, num_rotations=64).solve(geo, sheets)
for group in result.placed_polylines():
print("sheet", group["sheet_id"], "->", len(group["parts"]), "parts")
# serialize placed polylines (with holes) + transformations to COMPAS JSON
result.to_json("data/output/quickstart.json")
See the examples/ folder for the viewer workflows, and the
documentation for examples, API reference and credits.
License & credits
MIT — see LICENSE. Attributions for the underlying work are in CREDITS.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file compas_nest-0.1.1.post4.tar.gz.
File metadata
- Download URL: compas_nest-0.1.1.post4.tar.gz
- Upload date:
- Size: 52.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acd67c7c978b8ecc465c9d1af91f5d1dfeb1ecfa39df8e2c580fceace35f0d45
|
|
| MD5 |
3dff6502c1a113b3265243f3a1a9fa4f
|
|
| BLAKE2b-256 |
6e9ff2bbcaf149c7d1d61f8cad3764434f9f72852c0d2edc86e53250ecbb1253
|
Provenance
The following attestation bundles were made for compas_nest-0.1.1.post4.tar.gz:
Publisher:
build.yml on petrasvestartas/compas_nest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compas_nest-0.1.1.post4.tar.gz -
Subject digest:
acd67c7c978b8ecc465c9d1af91f5d1dfeb1ecfa39df8e2c580fceace35f0d45 - Sigstore transparency entry: 1819569127
- Sigstore integration time:
-
Permalink:
petrasvestartas/compas_nest@274750a9ab75b415095c321b225f3598712a04c9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/petrasvestartas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@274750a9ab75b415095c321b225f3598712a04c9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file compas_nest-0.1.1.post4-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: compas_nest-0.1.1.post4-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 1.2 MB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2302f87caef09101aa302603c8e467ac8f9490882e294143ebe4c00c3817c8ad
|
|
| MD5 |
70e4c634e28209586ed414013c62e50e
|
|
| BLAKE2b-256 |
daff707eb99313e8c36b1b8c5c1bcfcaeada6c68f9bfc37ebba00483afccc606
|
Provenance
The following attestation bundles were made for compas_nest-0.1.1.post4-cp312-abi3-win_amd64.whl:
Publisher:
build.yml on petrasvestartas/compas_nest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compas_nest-0.1.1.post4-cp312-abi3-win_amd64.whl -
Subject digest:
2302f87caef09101aa302603c8e467ac8f9490882e294143ebe4c00c3817c8ad - Sigstore transparency entry: 1819569316
- Sigstore integration time:
-
Permalink:
petrasvestartas/compas_nest@274750a9ab75b415095c321b225f3598712a04c9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/petrasvestartas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@274750a9ab75b415095c321b225f3598712a04c9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file compas_nest-0.1.1.post4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: compas_nest-0.1.1.post4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 965.9 kB
- Tags: CPython 3.12+, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b10900348e58582210377b18bbc79b8610b98ed4fbb136c7a644ba6d450a108
|
|
| MD5 |
9462b7661109688b2b3a0ef23b172845
|
|
| BLAKE2b-256 |
a10e64fa3f966394d71738586a602b4b696a8b84ac8a60e8536b8effd82928f9
|
Provenance
The following attestation bundles were made for compas_nest-0.1.1.post4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
build.yml on petrasvestartas/compas_nest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compas_nest-0.1.1.post4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
0b10900348e58582210377b18bbc79b8610b98ed4fbb136c7a644ba6d450a108 - Sigstore transparency entry: 1819569276
- Sigstore integration time:
-
Permalink:
petrasvestartas/compas_nest@274750a9ab75b415095c321b225f3598712a04c9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/petrasvestartas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@274750a9ab75b415095c321b225f3598712a04c9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_x86_64.whl.
File metadata
- Download URL: compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_x86_64.whl
- Upload date:
- Size: 843.3 kB
- Tags: CPython 3.12+, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f8a58ef4f1803fdacaae23e0ac6430a1e45f9162fd231a340e42b0f1c91f41d
|
|
| MD5 |
c4fa7901554a24eb12653bc23490f0e9
|
|
| BLAKE2b-256 |
74c83f1975f8fb3ecfa122a1ed164e8eddcc9450869ce61c463d4d6b873ce815
|
Provenance
The following attestation bundles were made for compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_x86_64.whl:
Publisher:
build.yml on petrasvestartas/compas_nest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_x86_64.whl -
Subject digest:
1f8a58ef4f1803fdacaae23e0ac6430a1e45f9162fd231a340e42b0f1c91f41d - Sigstore transparency entry: 1819569222
- Sigstore integration time:
-
Permalink:
petrasvestartas/compas_nest@274750a9ab75b415095c321b225f3598712a04c9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/petrasvestartas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@274750a9ab75b415095c321b225f3598712a04c9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 781.7 kB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5d2a64233d45dcf600182447be870f6ebb57c292e9b523736bb831b85ebba21
|
|
| MD5 |
fb6a1532dd21d72d258dd921bb8f9f84
|
|
| BLAKE2b-256 |
78cde3d5fb2432cae771dade648b5669e7514245c57f97645d36e138db0024c8
|
Provenance
The following attestation bundles were made for compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_arm64.whl:
Publisher:
build.yml on petrasvestartas/compas_nest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
compas_nest-0.1.1.post4-cp312-abi3-macosx_11_0_arm64.whl -
Subject digest:
c5d2a64233d45dcf600182447be870f6ebb57c292e9b523736bb831b85ebba21 - Sigstore transparency entry: 1819569181
- Sigstore integration time:
-
Permalink:
petrasvestartas/compas_nest@274750a9ab75b415095c321b225f3598712a04c9 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/petrasvestartas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@274750a9ab75b415095c321b225f3598712a04c9 -
Trigger Event:
push
-
Statement type: