Skip to main content

2D irregular nesting (OpenNest) for COMPAS.

Project description

compas_nest

2D irregular nesting for the COMPAS framework — Python bindings for the OpenNest C++ engines, built with nanobind (the same toolchain as compas_cgal).

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.

Credits

compas_nest is the COMPAS / Python binding of the OpenNest C++ engines by Petras Vestartas, which build on SVGnest/Deepnest (NFP+GA), jagua-rs/sparrow (physics strip-packing), Clipper2 and Boost.Polygon. Full attributions: docs/credits.md.

License

MIT

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.0.tar.gz (9.2 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.0-cp312-abi3-win_amd64.whl (871.1 kB view details)

Uploaded CPython 3.12+Windows x86-64

compas_nest-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (740.1 kB view details)

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

compas_nest-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl (618.1 kB view details)

Uploaded CPython 3.12+macOS 11.0+ x86-64

compas_nest-0.1.0-cp312-abi3-macosx_11_0_arm64.whl (555.4 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

compas_nest-0.1.0-cp311-cp311-win_amd64.whl (876.7 kB view details)

Uploaded CPython 3.11Windows x86-64

compas_nest-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (751.4 kB view details)

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

compas_nest-0.1.0-cp311-cp311-macosx_11_0_x86_64.whl (623.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

compas_nest-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (560.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

compas_nest-0.1.0-cp310-cp310-win_amd64.whl (877.1 kB view details)

Uploaded CPython 3.10Windows x86-64

compas_nest-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (752.0 kB view details)

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

compas_nest-0.1.0-cp310-cp310-macosx_11_0_x86_64.whl (623.5 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

compas_nest-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (561.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

compas_nest-0.1.0-cp39-cp39-win_amd64.whl (878.3 kB view details)

Uploaded CPython 3.9Windows x86-64

compas_nest-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (752.5 kB view details)

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

compas_nest-0.1.0-cp39-cp39-macosx_11_0_x86_64.whl (624.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

compas_nest-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (561.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: compas_nest-0.1.0.tar.gz
  • Upload date:
  • Size: 9.2 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.0.tar.gz
Algorithm Hash digest
SHA256 ae3fa755debe186361f91c650d70e6626b0fda0f74e4a9052c0298490b15cd51
MD5 dcb3d6c42578be0deb1ccd2d00123009
BLAKE2b-256 3a6dfb7fef41d96315eedb36090ff03a7dd655b9803817dfb116d509c6928cfe

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: compas_nest-0.1.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 871.1 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.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 211b31455d97222e72b09c474900df002d7744d36412b3eca35249213271a25a
MD5 2568edc27a929dd15392050e4f495adb
BLAKE2b-256 89650a5ec0b25354786d3372260e51b1e770b22de23e9d2bd6ca29f8c3b048ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cd2ef1f57e54a957732654b2071f0716a4d995869b8d68bdc205e365a7533a56
MD5 444699ec99806e3ab82cbdd64500c0ef
BLAKE2b-256 fb9f662bbe808e506c5691cd9fc46d00bea8b43598d1fa6aa3503583f273935b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp312-abi3-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 a810b8977e6ea6d9cc13c42e2a233f4b66ad7f4286b567d500e9a62ebcba3aed
MD5 06ab55b40fd07d79d1d736e2167736d9
BLAKE2b-256 48874030d1e4ac8aa5c43c14ce37f3a0201094f0e8b190e083a83f04481ec6c6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5351711ba46cac79c1d68a1738a62b42b5dd7bf3133fb61516441b13906a3824
MD5 6693135dcadda30dd24bc1114790f262
BLAKE2b-256 4d294078f91d032e0e3eb780ada4effe75d9039d9f4f9a54d27e7adc60b2e895

See more details on using hashes here.

Provenance

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

File details

Details for the file compas_nest-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: compas_nest-0.1.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 876.7 kB
  • Tags: CPython 3.11, 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.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 20088fb08976180d85eefc132c171064b651286de1f183d8be57d61b84851e6e
MD5 b1f7d7e7a7ea0cb823093350a0d77f13
BLAKE2b-256 299314d81552a4965b21cddc3e09c124654992fbff0cdfe9629af8766a8b1f3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp311-cp311-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.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e0c6fc6bbfac8441f423775a4d080fc95c8803f3ebfbddf82d27404b1bfb8818
MD5 92ebbdddf29f3652aafef2e4ae6a6d4d
BLAKE2b-256 d905ee833f66e84a53c11b0066a2504ac69d0b23c78380af21eb58744e6eb291

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp311-cp311-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.0-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 e7e51d1cf4d4006093164f866b60c91205f540f9218cd69905e11bc225fba884
MD5 ddd9b3a102e0367aeeac3f5a51711d85
BLAKE2b-256 f468edd41d44735600df6b01153bf379a8b77fbbf30ed5eba7995f269b75f60c

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp311-cp311-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.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b26bb15f277ff77f3cfd80435c7c8d8471a634fe196da1251b4d815528a08dbc
MD5 5555ec16fe9718daec0e663a5a5d4215
BLAKE2b-256 6c33811db01694675105a6aa8cad5da20b7df8eaa5b429790c0cb0f8a13f2165

See more details on using hashes here.

Provenance

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

File details

Details for the file compas_nest-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: compas_nest-0.1.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 877.1 kB
  • Tags: CPython 3.10, 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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e95d205dd672d355bccd888d0de848cf965d5ff48ac8e6dad053db8bf75a6710
MD5 29c2ad10cdaa7b2af97bda6b84ba8f8d
BLAKE2b-256 378285a0fec8f727d3981ae56bacf8bd86d689936a95fb2ec5c9bd8841bc1d0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp310-cp310-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.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9cfd4a594e0afd573c786ff0ab647f8b5ed8a8506094ca6c4d7fc46ed626ff1a
MD5 da7c2a7741516825582d8aa6c75b1d6a
BLAKE2b-256 c24fa6a1a30b78aa8cf466c7a00120a285785b24a7b7783c712246d727d25d0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp310-cp310-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.0-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 45223d56633feff84b1f7edc9c19699e2ca1c29c9e2a82dbcd0269878f82338e
MD5 3e1a8b2157ed4d40d7134eca2f2a0db5
BLAKE2b-256 9c727590ef1efec0b7dc523e8bcfbfafee2007abda39c98ab29c3507e6e51d45

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp310-cp310-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.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 033199c8a98f69e35d2c2ab234943ea1f72bc1738d82704dc976a9ced89b1f03
MD5 a01babb00c6a7e04e35acbe2fbb24a2c
BLAKE2b-256 476581d45f531f7c6b39da2cb4f6be9f1c7c602508f0094c000487a814d3a316

See more details on using hashes here.

Provenance

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

File details

Details for the file compas_nest-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: compas_nest-0.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 878.3 kB
  • Tags: CPython 3.9, 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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 35376e3d56bf496f6a5ae95df65fcc1d7446ddc69bcc9cfef4270380c6586a66
MD5 7c8523770b60f70b1d1ce6bd58eff6e3
BLAKE2b-256 01f03acb2459ea3472250211ae6819609427722461c336225334633158070bbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp39-cp39-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.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 db3178e25b7133f622c67d9891fc18906896a09d699d1c3a0690836b21d88e03
MD5 dda9942b02b69c98a648e6c81298e384
BLAKE2b-256 734b199de7bcd1899a48dddce2664c4eb1a7af31d74628427240a1662b9dd7de

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp39-cp39-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.0-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 09b398d489addb0a0c533eb350d9e9b1a09c82fc84ab50859553f0d9fe67f67d
MD5 19fd6789564c2c289aa941db6f68a901
BLAKE2b-256 7e4b2076035d1827dbc09d22deb048269b5bb7b1a28fe7a85dc898566e3151d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp39-cp39-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.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for compas_nest-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c88a53ee8c204e456484057ea8114cd5024272297f796ad29007c73f4f80d186
MD5 185079f4b27fff888dfa539651553a7e
BLAKE2b-256 ed1403a80c601ecd0c88975c10ce1a3102b28757216ffbcf58c61bf9daf347cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for compas_nest-0.1.0-cp39-cp39-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