FIX: context: fix the .gcode.3mf not shown issue
filament_self_index difference caused JIRA: no-jira Change-Id: Ia70fe8a8095b8067fe13bbfc9e5c39d9f3ee05d3
This commit is contained in:
parent
55898ab88e
commit
3a55a3a1ee
|
@ -725,7 +725,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(std::unordered_map<std::string, long long>* slice_time = nullptr, bool use_cache = false) override;
|
void process(std::unordered_map<std::string, long long>* slice_time = 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.
|
||||||
|
|
|
@ -1018,7 +1018,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);
|
||||||
|
@ -1111,6 +1111,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
|
|
||||||
//apply extruder related values
|
//apply extruder related values
|
||||||
std::vector<int> print_variant_index;
|
std::vector<int> print_variant_index;
|
||||||
|
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
|
||||||
|
@ -1118,6 +1119,16 @@ 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Find modified keys of the various configs. Resolve overrides extruder retract values by filament profiles.
|
// Find modified keys of the various configs. Resolve overrides extruder retract values by filament profiles.
|
||||||
DynamicPrintConfig filament_overrides;
|
DynamicPrintConfig filament_overrides;
|
||||||
|
|
|
@ -406,7 +406,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);
|
||||||
|
|
|
@ -449,7 +449,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(std::unordered_map<std::string, long long>* slice_time = nullptr, bool use_cache = false) override;
|
void process(std::unordered_map<std::string, long long>* slice_time = nullptr, bool use_cache = false) override;
|
||||||
void finalize() override;
|
void finalize() override;
|
||||||
|
|
|
@ -2541,12 +2541,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();
|
||||||
|
|
Loading…
Reference in New Issue