CAD persistence: implement recipe round-trip on the BBS 3mf backend (mirror)

Mirror of snaporca-cad ad822bf. The earlier mirror (2c0140afb9) implemented
persistence in the PrusaSlicer 3mf.cpp, but the GUI saves/loads projects via the
BBS-native backend (store_bbs_3mf / load_bbs_3mf), so the recipe was never
written to nor read from GUI-saved projects.

- bbs_3mf.cpp: BBS_CAD_RECIPE_FILE = "Metadata/SnapOrca_cad.bin"; writer
  _add_cad_recipe_file_to_archive (called after layer-height in store_bbs_3mf);
  reader branch in _load_model_from_file's metadata dispatch loop (iterate +
  iequals on m_filename — mz_zip_reader_locate_file does not work on these
  archives).
- Plater.cpp: load_files carries the Model-level cad_recipe onto q->model().
- test_3mf.cpp: [3mf] test asserting store_bbs_3mf embeds the recipe entry
  byte-for-byte (read back via miniz, Catch2 v3).

Verified on behemoth: libslic3r_tests + the new [3mf] BBS test pass; orca-slicer
GUI links clean. Round-trip verified live on snaporca-cad (identical code path).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
Tommaso Bianchi
2026-06-28 21:53:36 +02:00
co-authored by Claude Opus 4.8
parent e985d95dfb
commit 36b2bd8bfc
3 changed files with 93 additions and 0 deletions
+6
View File
@@ -6801,6 +6801,12 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
auto loaded_idxs = load_model_objects(model.objects, is_project_file);
obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
// load_model_objects only transfers ModelObjects; carry the Model-level CAD
// recipe (Metadata/SnapOrca_cad.bin) onto the plater model so the Design tab
// can rehydrate the editable feature tree on reopen.
if (!model.cad_recipe.empty())
q->model().cad_recipe = model.cad_recipe;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ":" << __LINE__ << boost::format(", finished load_model_objects");
wxString msg = wxString::Format(_L("Loading file: %s"), from_path(real_filename));
dlg_cont = dlg.Update(progress_percent, msg);