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.dev4.tar.gz (11.7 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.dev4-cp312-abi3-win_amd64.whl (987.1 kB view details)

Uploaded CPython 3.12+Windows x86-64

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

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

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

Uploaded CPython 3.12+macOS 11.0+ x86-64

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

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: compas_nest-0.1.1.dev4.tar.gz
  • Upload date:
  • Size: 11.7 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.dev4.tar.gz
Algorithm Hash digest
SHA256 6a445094f5f19621f81baad00d207a99eae440479586001257ba7bc03abf11d3
MD5 9c34d3c057849c89fae5a990560a3684
BLAKE2b-256 051bb7e121da40dc8c785c8449c10a0c1a5995beb41507fa6a39ceb6c8dc4725

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1.dev4.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.dev4-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1.dev4-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c856a24d253074c78c230e5424ff95f770138a678283766f98bc0620f6eefbf8
MD5 9c7e8a097a5f92402a291e289e368b2c
BLAKE2b-256 32aded684495c786177f3177b835499692085e6b9189e5100d03fd7955c81320

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1.dev4-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.dev4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1.dev4-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 29715b7f898ca52a4ed7bba2da027134b2d90b4defde79f35e5bf892a712488d
MD5 612671005bdcde2b0168fce41e0823ff
BLAKE2b-256 4891ea46d93287d4e569bbf81f0ff0c2191bb44a5cca1d606efc47554bf53a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1.dev4-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.dev4-cp312-abi3-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1.dev4-cp312-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 78d0b3412f365b176fc192a9940a340b75d207b4962fd84db7dc534846435bc3
MD5 da9bd8614cab318fdc3ab8647a538c84
BLAKE2b-256 7ab9cc8cbf4e2fac0ccb4e4f2f51d1e4bae7f36cc5d230ef67ef142bc40d4707

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1.dev4-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.dev4-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.1.dev4-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 faba1f89e31af9a2aca34016c28b64c8804ec6eaa39df6c91ae7f821689bbcc5
MD5 125cc6613faca3b0cb90c6b03ff84d17
BLAKE2b-256 86c43f91bba504843158b47c93e95f538df3d82b2537fe509b0528a18ac2ac9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.1.dev4-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