FIX: cali: fix the 3mf wrong issue when cali for multi-extruder
jira: no-jira Change-Id: I352e4dd499f4e4dd22cdc21f3f62428a0baa5bfb
This commit is contained in:
parent
b89aa86a8e
commit
f9cd3dd876
|
@ -2214,7 +2214,7 @@ void CalibrationPresetPage::select_default_compatible_filament()
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(false);
|
//assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_filament_compatible();
|
check_filament_compatible();
|
||||||
|
@ -2270,7 +2270,7 @@ std::vector<FilamentComboBox*> CalibrationPresetPage::get_selected_filament_comb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
//assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6393,14 +6393,14 @@ void GLCanvas3D::render_thumbnail_legacy(ThumbnailData& thumbnail_data, unsigned
|
||||||
bool ban_light)
|
bool ban_light)
|
||||||
{
|
{
|
||||||
// check that thumbnail size does not exceed the default framebuffer size
|
// check that thumbnail size does not exceed the default framebuffer size
|
||||||
const Size& cnv_size = get_canvas_size();
|
/*const Size& cnv_size = get_canvas_size();
|
||||||
unsigned int cnv_w = (unsigned int)cnv_size.get_width();
|
unsigned int cnv_w = (unsigned int)cnv_size.get_width();
|
||||||
unsigned int cnv_h = (unsigned int)cnv_size.get_height();
|
unsigned int cnv_h = (unsigned int)cnv_size.get_height();
|
||||||
if (w > cnv_w || h > cnv_h) {
|
if (w > cnv_w || h > cnv_h) {
|
||||||
float ratio = std::min((float)cnv_w / (float)w, (float)cnv_h / (float)h);
|
float ratio = std::min((float)cnv_w / (float)w, (float)cnv_h / (float)h);
|
||||||
w = (unsigned int)(ratio * (float)w);
|
w = (unsigned int)(ratio * (float)w);
|
||||||
h = (unsigned int)(ratio * (float)h);
|
h = (unsigned int)(ratio * (float)h);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
thumbnail_data.set(w, h);
|
thumbnail_data.set(w, h);
|
||||||
if (!thumbnail_data.is_valid())
|
if (!thumbnail_data.is_valid())
|
||||||
|
|
|
@ -890,6 +890,21 @@ public:
|
||||||
bool for_picking = false,
|
bool for_picking = false,
|
||||||
bool ban_light = false);
|
bool ban_light = false);
|
||||||
|
|
||||||
|
// render thumbnail using the default framebuffer
|
||||||
|
static void render_thumbnail_legacy(ThumbnailData & thumbnail_data,
|
||||||
|
unsigned int w,
|
||||||
|
unsigned int h,
|
||||||
|
const ThumbnailsParams & thumbnail_params,
|
||||||
|
PartPlateList & partplate_list,
|
||||||
|
ModelObjectPtrs & model_objects,
|
||||||
|
const GLVolumeCollection & volumes,
|
||||||
|
std::vector<std::array<float, 4>> &extruder_colors,
|
||||||
|
GLShaderProgram * shader,
|
||||||
|
Camera::EType camera_type,
|
||||||
|
bool use_top_view = false,
|
||||||
|
bool for_picking = false,
|
||||||
|
bool ban_light = false);
|
||||||
|
|
||||||
//BBS use gcoder viewer render calibration thumbnails
|
//BBS use gcoder viewer render calibration thumbnails
|
||||||
void render_calibration_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params);
|
void render_calibration_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, unsigned int h, const ThumbnailsParams& thumbnail_params);
|
||||||
|
|
||||||
|
@ -1174,20 +1189,6 @@ private:
|
||||||
bool _render_orient_menu(float left, float right, float bottom, float top);
|
bool _render_orient_menu(float left, float right, float bottom, float top);
|
||||||
bool _render_arrange_menu(float left, float right, float bottom, float top);
|
bool _render_arrange_menu(float left, float right, float bottom, float top);
|
||||||
void _render_3d_navigator();
|
void _render_3d_navigator();
|
||||||
// render thumbnail using the default framebuffer
|
|
||||||
void render_thumbnail_legacy(ThumbnailData & thumbnail_data,
|
|
||||||
unsigned int w,
|
|
||||||
unsigned int h,
|
|
||||||
const ThumbnailsParams & thumbnail_params,
|
|
||||||
PartPlateList & partplate_list,
|
|
||||||
ModelObjectPtrs & model_objects,
|
|
||||||
const GLVolumeCollection & volumes,
|
|
||||||
std::vector<std::array<float, 4>> &extruder_colors,
|
|
||||||
GLShaderProgram * shader,
|
|
||||||
Camera::EType camera_type,
|
|
||||||
bool use_top_view = false,
|
|
||||||
bool for_picking = false,
|
|
||||||
bool ban_light = false);
|
|
||||||
|
|
||||||
void _update_volumes_hover_state();
|
void _update_volumes_hover_state();
|
||||||
|
|
||||||
|
|
|
@ -208,6 +208,40 @@ static bool check_nozzle_diameter_and_type(const DynamicPrintConfig &full_config
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init_multi_extruder_params_for_cali(DynamicPrintConfig& config, const CalibInfo& calib_info)
|
||||||
|
{
|
||||||
|
int extruder_count = 1;
|
||||||
|
auto nozzle_diameters_opt = dynamic_cast<const ConfigOptionFloatsNullable*>(config.option("nozzle_diameter"));
|
||||||
|
if (nozzle_diameters_opt != nullptr) {
|
||||||
|
extruder_count = (int)(nozzle_diameters_opt->size());
|
||||||
|
}
|
||||||
|
std::vector<int>& nozzle_volume_types = dynamic_cast<ConfigOptionEnumsGeneric*>(config.option("nozzle_volume_type", true))->values;
|
||||||
|
nozzle_volume_types.clear();
|
||||||
|
nozzle_volume_types.resize(extruder_count, (int)calib_info.nozzle_volume_type);
|
||||||
|
|
||||||
|
std::vector<int> physical_extruder_maps = dynamic_cast<ConfigOptionInts*>(config.option("physical_extruder_map", true))->values;
|
||||||
|
int extruder_id = calib_info.extruder_id;
|
||||||
|
for (size_t index = 0; index < extruder_count; ++index) {
|
||||||
|
if (physical_extruder_maps[index] == extruder_id)
|
||||||
|
{
|
||||||
|
extruder_id = index + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int num_filaments = 1;
|
||||||
|
auto filament_colour_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_colour"));
|
||||||
|
if (filament_colour_opt != nullptr) {
|
||||||
|
num_filaments = (int)(filament_colour_opt->size());
|
||||||
|
}
|
||||||
|
std::vector<int>& filament_maps = config.option<ConfigOptionInts>("filament_map", true)->values;
|
||||||
|
filament_maps.clear();
|
||||||
|
filament_maps.resize(num_filaments, extruder_id);
|
||||||
|
|
||||||
|
config.option<ConfigOptionEnum<FilamentMapMode>>("filament_map_mode", true)->value = FilamentMapMode::fmmManual;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CalibMode CalibUtils::get_calib_mode_by_name(const std::string name, int& cali_stage)
|
CalibMode CalibUtils::get_calib_mode_by_name(const std::string name, int& cali_stage)
|
||||||
{
|
{
|
||||||
if (name == "pa_line_calib_mode") {
|
if (name == "pa_line_calib_mode") {
|
||||||
|
@ -606,6 +640,8 @@ bool CalibUtils::calib_flowrate(int pass, const CalibInfo &calib_info, wxString
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
|
init_multi_extruder_params_for_cali(full_config, calib_info);
|
||||||
|
|
||||||
Calib_Params params;
|
Calib_Params params;
|
||||||
params.mode = CalibMode::Calib_Flow_Rate;
|
params.mode = CalibMode::Calib_Flow_Rate;
|
||||||
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
||||||
|
@ -728,6 +764,8 @@ bool CalibUtils::calib_generic_PA(const CalibInfo &calib_info, wxString &error_m
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
|
init_multi_extruder_params_for_cali(full_config, calib_info);
|
||||||
|
|
||||||
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
if (!process_and_store_3mf(&model, full_config, params, error_message))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -829,6 +867,8 @@ void CalibUtils::calib_temptue(const CalibInfo &calib_info, wxString &error_mess
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
|
init_multi_extruder_params_for_cali(full_config, calib_info);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, params, error_message);
|
process_and_store_3mf(&model, full_config, params, error_message);
|
||||||
if (!error_message.empty())
|
if (!error_message.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -908,6 +948,8 @@ void CalibUtils::calib_max_vol_speed(const CalibInfo &calib_info, wxString &erro
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
|
init_multi_extruder_params_for_cali(full_config, calib_info);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, new_params, error_message);
|
process_and_store_3mf(&model, full_config, new_params, error_message);
|
||||||
if (!error_message.empty())
|
if (!error_message.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -966,6 +1008,8 @@ void CalibUtils::calib_VFA(const CalibInfo &calib_info, wxString &error_message)
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
|
init_multi_extruder_params_for_cali(full_config, calib_info);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, params, error_message);
|
process_and_store_3mf(&model, full_config, params, error_message);
|
||||||
if (!error_message.empty())
|
if (!error_message.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -1017,6 +1061,8 @@ void CalibUtils::calib_retraction(const CalibInfo &calib_info, wxString &error_m
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
|
init_multi_extruder_params_for_cali(full_config, calib_info);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, params, error_message);
|
process_and_store_3mf(&model, full_config, params, error_message);
|
||||||
if (!error_message.empty())
|
if (!error_message.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -1184,9 +1230,11 @@ bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
|
||||||
partplate_list, model->objects, glvolume_collection, colors_out, shader, Slic3r::GUI::Camera::EType::Ortho);
|
partplate_list, model->objects, glvolume_collection, colors_out, shader, Slic3r::GUI::Camera::EType::Ortho);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:{
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("framebuffer_type: unknown");
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__<< boost::format(": framebuffer_type: others");
|
||||||
|
Slic3r::GUI::GLCanvas3D::render_thumbnail_legacy(*thumbnail_data, thumbnail_width, thumbnail_height, thumbnail_params, partplate_list, model->objects, glvolume_collection, colors_out, shader, Slic3r::GUI::Camera::EType::Ortho);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
thumbnails.push_back(thumbnail_data);
|
thumbnails.push_back(thumbnail_data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue