Skip to content

Use the new volmdlr GLB viewer in the knapsack tutorial (require volmdlr>=0.22.2)#55

Open
pgibertini wants to merge 1 commit into
mainfrom
feat/volmdlr-0.22.2-new-viewer
Open

Use the new volmdlr GLB viewer in the knapsack tutorial (require volmdlr>=0.22.2)#55
pgibertini wants to merge 1 commit into
mainfrom
feat/volmdlr-0.22.2-new-viewer

Conversation

@pgibertini

@pgibertini pgibertini commented Jul 22, 2026

Copy link
Copy Markdown

Adds the new @volmdlr_view display (model.json v2.6 + content-addressed GLBs, introduced in volmdlr 0.22.2) to the knapsack tutorial, alongside the existing @cad_view (Babylon babylon_data).

Changes

  • pyproject.toml: require volmdlr>=0.22.2 (was commented out).
  • knapsack_problem.py:
    • import VolumeModel from volmdlr.model (the display-capable class in 0.22.2; volmdlr.core.VolumeModel is a stub without babylon_data/volmdlr_view).
    • add a volmdlr_view (@volmdlr_view) method to each class next to its cadview (@cad_view), returning VolumeModel(...).volmdlr_view(reference_path=...).
    • reference_path threaded through volmdlr_primitives and the export root, so a clicked part resolves on the live object via get_in_object_from_path.

Both displays are kept so the tutorial shows the Babylon and GLB viewers side by side.

Depends on volmdlr!423 (v0.22.2) and dessia_common!139 (VolmdlrView forwards reference_path).

https://claude.ai/code/session_01MkzWt77anKrfiZb7Te7syn

@pgibertini
pgibertini force-pushed the feat/volmdlr-0.22.2-new-viewer branch 3 times, most recently from a58e062 to b7a562b Compare July 22, 2026 19:20
- pyproject: require volmdlr>=0.22.2.
- add a @volmdlr_view (model.json v2.6 + GLB) display to each class, alongside
  the existing @cad_view (Babylon). Import VolumeModel from volmdlr.model (the
  display-capable class in 0.22.2; volmdlr.core.VolumeModel is a stub) and name
  it with the object name so the viewer tree root shows it.
- KnapsackPackage.volmdlr_primitives: delegate to self.items (an Items wrapper)
  anchored at "{reference_path}/items", so item paths resolve as
  #/items/items/{i} via get_in_object_from_path (were #/items/{i}, which hit the
  Items wrapper and failed). Geometry unchanged.

reference_path is threaded through volmdlr_primitives and the export root.

https://claude.ai/code/session_01MkzWt77anKrfiZb7Te7syn
@pgibertini
pgibertini force-pushed the feat/volmdlr-0.22.2-new-viewer branch from b7a562b to f912d03 Compare July 22, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant