99#include " libslic3r/Model.hpp"
1010#include " ../GUI/MsgDialog.hpp"
1111#include " BBLUtil.hpp"
12+ #include " ../GUI/Plater.hpp"
1213
1314
1415namespace Slic3r {
@@ -76,6 +77,16 @@ wxString get_nozzle_volume_type_name(NozzleVolumeType type)
7677 return wxString ();
7778}
7879
80+ static int get_physical_extruder_idx (std::vector<int > physical_extruder_maps, int extruder_id)
81+ {
82+ for (size_t index = 0 ; index < physical_extruder_maps.size (); ++index) {
83+ if (physical_extruder_maps[index] == extruder_id) {
84+ return index;
85+ }
86+ }
87+ return extruder_id;
88+ }
89+
7990bool is_pa_params_valid (const Calib_Params ¶ms)
8091{
8192 if (params.start < MIN_PA_K_VALUE || params.end > MAX_PA_K_VALUE || params.step < MIN_PA_K_VALUE_STEP || params.end < params.start + params.step ) {
@@ -1174,26 +1185,13 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject *obj, co
11741185 return false ;
11751186 }
11761187
1177- float cali_diameter = cali_infos.calib_datas [0 ].nozzle_diameter ;
1178- int extruder_id = cali_infos.calib_datas [0 ].extruder_id ;
11791188 for (const auto & cali_info : cali_infos.calib_datas ) {
11801189 if (cali_infos.cali_mode == CalibMode::Calib_PA_Line && !is_support_auto_pa_cali (cali_info.filament_id )) {
11811190 error_message = _L (" TPU 90A/TPU 85A is too soft and does not support automatic Flow Dynamics calibration." );
11821191 return false ;
11831192 }
1184-
1185- if (!is_approx (cali_diameter, cali_info.nozzle_diameter )) {
1186- error_message = _L (" Automatic calibration only supports cases where the left and right nozzle diameters are identical." );
1187- return false ;
1188- }
11891193 }
11901194
1191- if (extruder_id >= obj->m_extder_data .extders .size ()) {
1192- error_message = _L (" The number of printer extruders and the printer selected for calibration does not match." );
1193- return false ;
1194- }
1195-
1196- float diameter = obj->m_extder_data .extders [extruder_id].current_nozzle_diameter ;
11971195 bool is_multi_extruder = obj->is_multi_extruders ();
11981196 std::vector<NozzleFlowType> nozzle_volume_types;
11991197 if (is_multi_extruder) {
@@ -1202,12 +1200,24 @@ bool CalibUtils::check_printable_status_before_cali(const MachineObject *obj, co
12021200 }
12031201 }
12041202
1203+ Preset *printer_preset = get_printer_preset (obj);
1204+
12051205 for (const auto &cali_info : cali_infos.calib_datas ) {
12061206 wxString name = _L (" left" );
12071207 if (cali_info.extruder_id == 0 ) {
12081208 name = _L (" right" );
12091209 }
12101210
1211+ float cali_diameter = cali_info.nozzle_diameter ;
1212+ int extruder_id = cali_info.extruder_id ;
1213+
1214+ if (extruder_id >= obj->m_extder_data .extders .size ()) {
1215+ error_message = _L (" The number of printer extruders and the printer selected for calibration does not match." );
1216+ return false ;
1217+ }
1218+
1219+ float diameter = obj->m_extder_data .extders [extruder_id].current_nozzle_diameter ;
1220+
12111221 if (!is_approx (cali_info.nozzle_diameter , diameter)) {
12121222 if (is_multi_extruder)
12131223 error_message = wxString::Format (_L (" The currently selected nozzle diameter of %s extruder does not match the actual nozzle diameter.\n "
0 commit comments