Skip to content

Fix: modifier/part settings lost when importing (Add) a 3MF (#961) - #962

Open
docteurzoidberg wants to merge 1 commit into
Snapmaker:mainfrom
docteurzoidberg:fix/keep-volume-config-on-3mf-import
Open

docteurzoidberg wants to merge 1 commit into
Snapmaker:mainfrom
docteurzoidberg:fix/keep-volume-config-on-3mf-import

Conversation

@docteurzoidberg

Copy link
Copy Markdown

Fixes #961.

Problem. When a 3MF saved by Snapmaker Orca (or OrcaSlicer / Bambu Studio) is added with the Add button of the Prepare tab, which is the import path with load_config = false, every per-volume setting is wiped. For example, a modifier with sparse_infill_density = 100% falls back to the object's 15 %. Only extruder is kept. Opening the same file with Open project works. Upstream OrcaSlicer keeps these settings with Add.

Debug log when adding the file:

Plater::priv::load_files: load_model 1, load_config 0, input_files size 1
Plater::priv::load_files: is_project_file 0, type_3mf 1
... plate_data.size 1, project_preset.size 0, is_bbs_3mf 1, file_version 2.4.0.0

Cause. In Plater::priv::load_files(), upstream OrcaSlicer handles each En3mfType (From_Orca, From_BBS, From_Other) in its own branch of an if / else if chain. The final else if (!load_config) branch, which resets model_object->config and every model_volume->config except extruder, is therefore never reached for slicer 3MFs. In this fork, those type-specific branches are disabled (else if (false)), so every imported 3MF, including Snapmaker Orca's own (From_BBS), falls through to the reset.

Fix. Skip the reset for From_BBS files, so that adding a slicer 3MF keeps its part/modifier settings as upstream does. Geometry from other applications is still reset.

Testing. I could not build the project locally. The change is a one-line condition. Reproduction file attached to #961.

🤖 Generated with Claude Code

When a 3MF saved by Snapmaker Orca / OrcaSlicer / Bambu Studio is added
with the Add button (load_config = false), Plater::priv::load_files()
reset every ModelVolume config except the extruder, so modifier settings
such as sparse_infill_density were lost. Upstream OrcaSlicer handles each
En3mfType in its own branch and never reaches this reset for slicer 3MFs;
in this fork those branches are disabled, so skip the reset for From_BBS.

Fixes Snapmaker#961

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@docteurzoidberg

Copy link
Copy Markdown
Author

Debug log excerpt (Snapmaker Orca 2.4.0, Windows 11, log_severity_level = debug) when adding SNAP_console_centre_manuel.3mf (the project attached to #961) with the Add button. The file contains one modifier with sparse_infill_density = 100%; after loading, it shows the object's 15 %.

01:34:26.117558 UndoRedo::StackImpl::take_snapshot  snapshot name Import Object: SNAP_console_centre_manuel.3mf
01:34:26.120578 Plater::priv::load_files: load_model 1, load_config 0, input_files size 1
01:34:26.161457 Plater::priv::load_files: is_project_file 0, type_3mf 1
01:34:26.197972 load_3mf found metadata key = Application, value = Snapmaker_Orca-2.4.0
01:34:26.213152 _BBS_3MF_Importer::_load_model_from_file:1817 extract 11th file Metadata/model_settings.config, total=13
01:34:26.215152 _BBS_3MF_Importer::_generate_volumes_new: line 4731, subobject_id 1, shared_mesh_id 1
01:34:26.215152 _BBS_3MF_Importer::_generate_volumes_new: line 4731, subobject_id 2, shared_mesh_id 2
01:34:26.220664 Plater::priv::load_files:11653, plate_data.size 1, project_preset.size 0, is_bbs_3mf 1, file_version 2.4.0.0
01:34:26.221924 3MF geometry import filament detection imported_physical=4 ... model_max_extruder=1 ...
01:34:26.221924 3MF geometry import applied imported project config current_num_filaments=4 desired_physical_filaments=4 mixed_enabled=0
01:34:26.306120 Plater::priv::load_files:12391 import 3mf IMPORT_LOAD_MODEL_OBJECTS
01:34:26.363408 LOD: Disabled for 'console_centre'
01:34:26.364412 LOD: Disabled for 'insert'
01:34:26.367424 Plater::priv::load_files:12441, finished load_model_objects

model_settings.config is read and both volumes, the part and the modifier insert, are created. Because load_config is 0 and the file is is_bbs_3mf 1 (From_BBS), the code then reaches the else if (!load_config) reset, which clears the modifier's config except extruder. Opening the same file with File → Open project (load_config 1) keeps the 100 %.

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.

Modifier parameters (infill at least) not loaded back when adding/importing 3mf file to the platter

1 participant