mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 11:53:48 +00:00
FIX: context: fix the .gcode.3mf not shown issue (#13360)
filament_self_index difference caused JIRA: no-jira Change-Id: Ia70fe8a8095b8067fe13bbfc9e5c39d9f3ee05d3 (cherry picked from commit 3a55a3a1eef94f577376cd697c3b72cb46967672) Co-authored-by: lane.wei <lane.wei@bambulab.com>
This commit is contained in:
@@ -905,7 +905,7 @@ public:
|
|||||||
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
|
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
|
||||||
std::vector<ObjectID> print_object_ids() const override;
|
std::vector<ObjectID> print_object_ids() const override;
|
||||||
|
|
||||||
ApplyStatus apply(const Model &model, DynamicPrintConfig config) override;
|
ApplyStatus apply(const Model &model, DynamicPrintConfig config, bool extruder_applied = false) override;
|
||||||
|
|
||||||
void process(long long *time_cost_with_cache = nullptr, bool use_cache = false) override;
|
void process(long long *time_cost_with_cache = nullptr, bool use_cache = false) override;
|
||||||
// Exports G-code into a file name based on the path_template, returns the file path of the generated G-code file.
|
// Exports G-code into a file name based on the path_template, returns the file path of the generated G-code file.
|
||||||
|
|||||||
@@ -1104,7 +1104,7 @@ static PrintObjectRegions* generate_print_object_regions(
|
|||||||
return out.release();
|
return out.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_config)
|
Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_config, bool extruder_applied)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
check_model_ids_validity(model);
|
check_model_ids_validity(model);
|
||||||
@@ -1156,6 +1156,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
|||||||
}
|
}
|
||||||
|
|
||||||
//apply extruder related values
|
//apply extruder related values
|
||||||
|
if (!extruder_applied) {
|
||||||
new_full_config.update_values_to_printer_extruders(new_full_config, printer_options_with_variant_1, "printer_extruder_id", "printer_extruder_variant");
|
new_full_config.update_values_to_printer_extruders(new_full_config, printer_options_with_variant_1, "printer_extruder_id", "printer_extruder_variant");
|
||||||
new_full_config.update_values_to_printer_extruders(new_full_config, printer_options_with_variant_2, "printer_extruder_id", "printer_extruder_variant", 2);
|
new_full_config.update_values_to_printer_extruders(new_full_config, printer_options_with_variant_2, "printer_extruder_id", "printer_extruder_variant", 2);
|
||||||
//update print config related with variants
|
//update print config related with variants
|
||||||
@@ -1163,6 +1164,17 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
|||||||
|
|
||||||
m_ori_full_print_config = new_full_config;
|
m_ori_full_print_config = new_full_config;
|
||||||
new_full_config.update_values_to_printer_extruders_for_multiple_filaments(new_full_config, filament_options_with_variant, "filament_self_index", "filament_extruder_variant");
|
new_full_config.update_values_to_printer_extruders_for_multiple_filaments(new_full_config, filament_options_with_variant, "filament_self_index", "filament_extruder_variant");
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// int extruder_count;
|
||||||
|
// bool different_extruder = new_full_config.support_different_extruders(extruder_count);
|
||||||
|
// print_variant_index.resize(extruder_count);
|
||||||
|
// for (int e_index = 0; e_index < extruder_count; e_index++)
|
||||||
|
// {
|
||||||
|
// print_variant_index[e_index] = e_index;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
auto opt_filament_map = new_full_config.option<ConfigOptionInts>("filament_map");
|
auto opt_filament_map = new_full_config.option<ConfigOptionInts>("filament_map");
|
||||||
std::vector<int> filament_maps = opt_filament_map ? opt_filament_map->values : std::vector<int>();
|
std::vector<int> filament_maps = opt_filament_map ? opt_filament_map->values : std::vector<int>();
|
||||||
|
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ public:
|
|||||||
// Some data was changed, which in turn invalidated already calculated steps.
|
// Some data was changed, which in turn invalidated already calculated steps.
|
||||||
APPLY_STATUS_INVALIDATED,
|
APPLY_STATUS_INVALIDATED,
|
||||||
};
|
};
|
||||||
virtual ApplyStatus apply(const Model &model, DynamicPrintConfig config) = 0;
|
virtual ApplyStatus apply(const Model &model, DynamicPrintConfig config, bool extruder_applied = false) = 0;
|
||||||
const Model& model() const { return m_model; }
|
const Model& model() const { return m_model; }
|
||||||
|
|
||||||
struct TaskParams {
|
struct TaskParams {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ std::vector<ObjectID> SLAPrint::print_object_ids() const
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig config)
|
SLAPrint::ApplyStatus SLAPrint::apply(const Model &model, DynamicPrintConfig config, bool extruder_applied)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
check_model_ids_validity(model);
|
check_model_ids_validity(model);
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ public:
|
|||||||
bool empty() const override { return m_objects.empty(); }
|
bool empty() const override { return m_objects.empty(); }
|
||||||
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
|
// List of existing PrintObject IDs, to remove notifications for non-existent IDs.
|
||||||
std::vector<ObjectID> print_object_ids() const override;
|
std::vector<ObjectID> print_object_ids() const override;
|
||||||
ApplyStatus apply(const Model &model, DynamicPrintConfig config) override;
|
ApplyStatus apply(const Model &model, DynamicPrintConfig config, bool extruder_applied = false) override;
|
||||||
void set_task(const TaskParams ¶ms) override;
|
void set_task(const TaskParams ¶ms) override;
|
||||||
void process(long long *time_cost_with_cache = nullptr, bool use_cache = false) override;
|
void process(long long *time_cost_with_cache = nullptr, bool use_cache = false) override;
|
||||||
void finalize() override;
|
void finalize() override;
|
||||||
|
|||||||
@@ -3414,12 +3414,13 @@ int PartPlate::load_gcode_from_file(const std::string& filename)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
// process gcode
|
// process gcode
|
||||||
DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config();
|
std::vector<int> filament_maps = this->get_filament_maps();
|
||||||
|
DynamicPrintConfig full_config = wxGetApp().preset_bundle->full_config(false, filament_maps);
|
||||||
full_config.apply(m_config, true);
|
full_config.apply(m_config, true);
|
||||||
m_print->apply(*m_model, full_config);
|
m_print->apply(*m_model, full_config, false);
|
||||||
//BBS: need to apply two times, for after the first apply, the m_print got its object,
|
//BBS: need to apply two times, for after the first apply, the m_print got its object,
|
||||||
//which will affect the config when new_full_config.normalize_fdm(used_filaments);
|
//which will affect the config when new_full_config.normalize_fdm(used_filaments);
|
||||||
m_print->apply(*m_model, full_config);
|
m_print->apply(*m_model, full_config, false);
|
||||||
|
|
||||||
// BBS: use backup path to save temp gcode
|
// BBS: use backup path to save temp gcode
|
||||||
// auto path = get_tmp_gcode_path();
|
// auto path = get_tmp_gcode_path();
|
||||||
|
|||||||
Reference in New Issue
Block a user