mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: CLI: fix the wipe tower depth not correct issue
estimate the wipe tower depth using more logic JIRA: MAK-XXXX Change-Id: Ieb66ebb7e75b20e61b7c0cb8e60496287434d31b
This commit is contained in:
parent
7ada04ff1a
commit
e8257103b7
4 changed files with 44 additions and 18 deletions
|
@ -2604,20 +2604,39 @@ int CLI::run(int argc, char **argv)
|
|||
if (layer_height_opt)
|
||||
layer_height = layer_height_opt->getFloat();
|
||||
|
||||
float depth = v * (filaments_cnt - 1) / (layer_height * w);
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: x=%1%, y=%2%, width=%3%, depth=%4%, angle=%5%, prime_volume=%6%, filaments_cnt=%7%, layer_height=%8%")
|
||||
%x %y %w %depth %a %v %filaments_cnt %layer_height;
|
||||
//float depth = v * (filaments_cnt - 1) / (layer_height * w);
|
||||
|
||||
Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, v, filaments_cnt);
|
||||
Vec3d plate_origin = cur_plate->get_origin();
|
||||
int plate_width, plate_depth, plate_height;
|
||||
partplate_list.get_plate_size(plate_width, plate_depth, plate_height);
|
||||
float depth = wipe_tower_size(1);
|
||||
float margin = 15.f, wp_brim_width = 0.f;
|
||||
ConfigOption *wipe_tower_brim_width_opt = m_print_config.option("prime_tower_brim_width");
|
||||
if (wipe_tower_brim_width_opt ) {
|
||||
wp_brim_width = wipe_tower_brim_width_opt->getFloat();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: wp_brim_width %1%")%wp_brim_width;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: x=%1%, y=%2%, width=%3%, depth=%4%, angle=%5%, prime_volume=%6%, filaments_cnt=%7%, layer_height=%8%, plate_width=%9%, plate_depth=%10%")
|
||||
%x %y %w %depth %a %v %filaments_cnt %layer_height %plate_width %plate_depth;
|
||||
if ((y + depth + margin + wp_brim_width) > (float)plate_depth) {
|
||||
y = (float)plate_depth - depth - margin - wp_brim_width;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: exceeds the border, change y to %1%, plate_depth=%2%")%y %plate_depth;
|
||||
}
|
||||
|
||||
if ((x + w + margin + wp_brim_width) > (float)plate_width) {
|
||||
x = (float)plate_width - w - margin - wp_brim_width;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: exceeds the border, change x to %1%, plate_width=%2%")%y %plate_width;
|
||||
}
|
||||
|
||||
ArrangePolygon wipe_tower_ap;
|
||||
|
||||
Polygon ap({
|
||||
{scaled(x), scaled(y)},
|
||||
{scaled(x + w), scaled(y)},
|
||||
{scaled(x + w), scaled(y + depth)},
|
||||
{scaled(x), scaled(y + depth)}
|
||||
{scaled(x - wp_brim_width), scaled(y - wp_brim_width)},
|
||||
{scaled(x + w + wp_brim_width), scaled(y - wp_brim_width)},
|
||||
{scaled(x + w + wp_brim_width), scaled(y + depth + wp_brim_width)},
|
||||
{scaled(x - wp_brim_width), scaled(y + depth + wp_brim_width)}
|
||||
});
|
||||
wipe_tower_ap.bed_idx = 0;
|
||||
wipe_tower_ap.setter = NULL; // do not move wipe tower
|
||||
|
|
|
@ -1748,7 +1748,8 @@ Points GLCanvas3D::estimate_wipe_tower_points(int plate_index, bool global) cons
|
|||
if (plate_index >= plate_count) { plate_index = 0; }
|
||||
float w = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_tower_width"))->value;
|
||||
float v = dynamic_cast<const ConfigOptionFloat *>(m_config->option("prime_volume"))->value;
|
||||
Vec3d wipe_tower_size = ppl.get_plate(plate_index)->estimate_wipe_tower_size(w, v);
|
||||
const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
Vec3d wipe_tower_size = ppl.get_plate(plate_index)->estimate_wipe_tower_size(print_cfg, w, v);
|
||||
|
||||
if (wipe_tower_size(1) == 0) {
|
||||
// when depth is unavailable (no items on this plate), we have to estimate the depth using the extruder number of all plates
|
||||
|
@ -2630,7 +2631,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
|||
|
||||
const Print* print = m_process->fff_print();
|
||||
float brim_width = print->wipe_tower_data(filaments_count).brim_width;
|
||||
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(w, v);
|
||||
const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(print_cfg, w, v);
|
||||
|
||||
const float margin = 15.f;
|
||||
BoundingBoxf3 plate_bbox = wxGetApp().plater()->get_partplate_list().get_plate(plate_id)->get_bounding_box();
|
||||
|
|
|
@ -1590,21 +1590,26 @@ std::vector<int> PartPlate::get_used_extruders()
|
|||
return used_extruders;
|
||||
}
|
||||
|
||||
Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volume) const
|
||||
Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size) const
|
||||
{
|
||||
Vec3d wipe_tower_size;
|
||||
std::vector<int> plate_extruders = get_extruders(true);
|
||||
|
||||
double layer_height = 0.08f; // hard code layer height
|
||||
double max_height = 0.f;
|
||||
wipe_tower_size.setZero();
|
||||
wipe_tower_size(0) = w;
|
||||
|
||||
ConfigOption* layer_height_opt = wxGetApp().preset_bundle->prints.get_edited_preset().config.option("layer_height");
|
||||
const ConfigOption* layer_height_opt = config.option("layer_height");
|
||||
if (layer_height_opt)
|
||||
layer_height = layer_height_opt->getFloat();
|
||||
|
||||
// empty plate
|
||||
if (plate_extruders.empty())
|
||||
if (plate_extruder_size == 0)
|
||||
{
|
||||
std::vector<int> plate_extruders = get_extruders(true);
|
||||
plate_extruder_size = plate_extruders.size();
|
||||
}
|
||||
if (plate_extruder_size == 0)
|
||||
return wipe_tower_size;
|
||||
|
||||
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
|
||||
|
@ -1616,11 +1621,11 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volu
|
|||
}
|
||||
wipe_tower_size(2) = max_height;
|
||||
|
||||
const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||
//const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
||||
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
|
||||
|
||||
double depth = wipe_volume * (plate_extruders.size() - 1) / (layer_height * w);
|
||||
double depth = wipe_volume * (plate_extruder_size - 1) / (layer_height * w);
|
||||
if (timelapse_enabled || depth > EPSILON) {
|
||||
float min_wipe_tower_depth = 0.f;
|
||||
auto iter = WipeTower::min_depth_per_height.begin();
|
||||
|
|
|
@ -289,7 +289,7 @@ public:
|
|||
ModelInstance* get_instance(int obj_id, int instance_id);
|
||||
|
||||
Vec3d get_origin() { return m_origin; }
|
||||
Vec3d estimate_wipe_tower_size(const double w, const double wipe_volume) const;
|
||||
Vec3d estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size = 0) const;
|
||||
std::vector<int> get_extruders(bool conside_custom_gcode = false) const;
|
||||
std::vector<int> get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const;
|
||||
std::vector<int> get_extruders_without_support(bool conside_custom_gcode = false) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue