Skip to main content

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.

compas_nest

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compas_nest-0.1.1.tar.gz (11.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

compas_nest-0.1.1-cp312-abi3-win_amd64.whl (987.9 kB view details)

Uploaded CPython 3.12+Windows x86-64

compas_nest-0.1.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (856.8 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

compas_nest-0.1.1-cp312-abi3-macosx_11_0_x86_64.whl (734.8 kB view details)

Uploaded CPython 3.12+macOS 11.0+ x86-64

compas_nest-0.1.1-cp312-abi3-macosx_11_0_arm64.whl (672.1 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file compas_nest-0.1.1.tar.gz.

File metadata

  • Download URL: compas_nest-0.1.1.tar.gz
  • Upload date:
  • Size: 11.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compas_nest-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a2454cfe45295ec736027f5acf907c3baae424073889fb0955458fc112265661
MD5 48d9335a26e6f1f47a119e941ce0b9b0
BLAKE2b-256 c2599d4d649304f1e1fdfe607a0917fb5c1c3944080486cebe814787a8319661

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1.tar.gz:

Publisher: build.yml on petrasvestartas/compas_nest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_nest-0.1.1-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: compas_nest-0.1.1-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 987.9 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for compas_nest-0.1.1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b52574a0e11866567db516416522667dd8b200553f106412f38abb774792be0d
MD5 e263e2ac4f9f7ec9960d4d891e5d58df
BLAKE2b-256 8fc5002958cc43bb85584bc994158185cabc9a8bfba6f69e0b5865ab412549c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1-cp312-abi3-win_amd64.whl:

Publisher: build.yml on petrasvestartas/compas_nest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_nest-0.1.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68bfdfa53a68b5e94a687ccde4164100d9f1b819395bd5eabc30e8072eaf5af5
MD5 912c2583bf7d6c5a8880f98d54b0153b
BLAKE2b-256 91573dd466d08069e5b48c68cf6dee0c7d68ccf34ef0c3ac9c39eb139f2ac963

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build.yml on petrasvestartas/compas_nest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_nest-0.1.1-cp312-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1-cp312-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1f02cd8875346eda126694a38465d619576a50aa35b02d1eee17baa424c0c41d
MD5 b98ab3d3d616e7f0f5173a8dc59ec3e2
BLAKE2b-256 a826d25af893115dd86fb00b75907f26396ff3951e525972f0427f924e1761f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1-cp312-abi3-macosx_11_0_x86_64.whl:

Publisher: build.yml on petrasvestartas/compas_nest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file compas_nest-0.1.1-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 92c38cdfdd9ad7c5fcd140b5534e4f4ea875b2cd9ccdbcb008d530fdc979b772
MD5 ff90a11cfdeb0922ace5e326dd2f5f57
BLAKE2b-256 79ce4d4f26a46143cea1710b9d68bf4617ca77ccd7f4d3450486cedf04f15c1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: build.yml on petrasvestartas/compas_nest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page