mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-04 17:45:11 +08:00
Fix flow calibration overlapping objects with nozzle > 0.4mm (#9189)
* Make sure the objects are refreshed after scaling * Scale the calib pattern using `selection.scale` so they won't overlap (SoftFever/OrcaSlicer#9085)
This commit is contained in:
parent
74df3a450b
commit
0a3cbabae6
@ -10,6 +10,7 @@
|
|||||||
#include <regex>
|
#include <regex>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/iterator/counting_iterator.hpp>
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <boost/filesystem/path.hpp>
|
#include <boost/filesystem/path.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
@ -9851,16 +9852,19 @@ void adjust_settings_for_flowrate_calib(ModelObjectPtrs& objects, bool linear, i
|
|||||||
double layer_height = nozzle_diameter / 2.0; // prefer 0.2 layer height for 0.4 nozzle
|
double layer_height = nozzle_diameter / 2.0; // prefer 0.2 layer height for 0.4 nozzle
|
||||||
first_layer_height = std::max(first_layer_height, layer_height);
|
first_layer_height = std::max(first_layer_height, layer_height);
|
||||||
|
|
||||||
|
const auto canvas = wxGetApp().plater()->canvas3D();
|
||||||
|
auto& selection = canvas->get_selection();
|
||||||
|
selection.setup_cache();
|
||||||
|
TransformationType transformation_type;
|
||||||
|
transformation_type.set_relative();
|
||||||
float zscale = (first_layer_height + 9 * layer_height) / 2;
|
float zscale = (first_layer_height + 9 * layer_height) / 2;
|
||||||
// only enlarge
|
// only enlarge
|
||||||
if (xyScale > 1.2) {
|
if (xyScale > 1.2) {
|
||||||
for (auto _obj : objects)
|
selection.scale({xyScale, xyScale, zscale}, transformation_type);
|
||||||
_obj->scale(xyScale, xyScale, zscale);
|
} else {
|
||||||
}
|
selection.scale({1, 1, zscale}, transformation_type);
|
||||||
else {
|
|
||||||
for (auto _obj : objects)
|
|
||||||
_obj->scale(1, 1, zscale);
|
|
||||||
}
|
}
|
||||||
|
canvas->do_scale("");
|
||||||
|
|
||||||
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
|
auto cur_flowrate = filament_config->option<ConfigOptionFloats>("filament_flow_ratio")->get_at(0);
|
||||||
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
|
Flow infill_flow = Flow(nozzle_diameter * 1.2f, layer_height, nozzle_diameter);
|
||||||
@ -9978,6 +9982,10 @@ void Plater::calib_flowrate(bool is_linear, int pass) {
|
|||||||
|
|
||||||
adjust_settings_for_flowrate_calib(model().objects, is_linear, pass);
|
adjust_settings_for_flowrate_calib(model().objects, is_linear, pass);
|
||||||
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
wxGetApp().get_tab(Preset::TYPE_PRINTER)->reload_config();
|
||||||
|
|
||||||
|
// Refresh object after scaling
|
||||||
|
const std::vector<size_t> object_idx(boost::counting_iterator<size_t>(0), boost::counting_iterator<size_t>(model().objects.size()));
|
||||||
|
changed_objects(object_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user