From 0968ffee65298676954898790691c84ff1723e47 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 3 Feb 2025 12:50:56 +0100 Subject: [PATCH] Parameter tower_hop_height type changed from int to float --- src/libslic3r/Format/SL1.cpp | 11 +++++------ src/libslic3r/PrintConfig.cpp | 8 ++++---- src/libslic3r/PrintConfig.hpp | 2 +- src/libslic3r/SLAPrint.cpp | 4 ++-- src/libslic3r/SLAPrintSteps.cpp | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/libslic3r/Format/SL1.cpp b/src/libslic3r/Format/SL1.cpp index 3a0283a350..baf4665bdf 100644 --- a/src/libslic3r/Format/SL1.cpp +++ b/src/libslic3r/Format/SL1.cpp @@ -107,16 +107,15 @@ std::string to_json(const SLAPrint& print, const ConfMap &m) switch (opt->type()) { case coFloats: { auto values = static_cast(opt); - // those options have to be exported in ms instead of s - below_node.put(get_key(opt_key), int(1000 * values->get_at(0))); - above_node.put(get_key(opt_key), int(1000 * values->get_at(1))); + double koef = opt_key == "tower_hop_height" ? 1000000. : 1000.; // export in nm (instead of mm), resp. in ms (instead of s) + below_node.put(get_key(opt_key), int(koef * values->get_at(0))); + above_node.put(get_key(opt_key), int(koef * values->get_at(1))); } break; case coInts: { auto values = static_cast(opt); - int koef = opt_key == "tower_hop_height" ? 1000000 : 1; - below_node.put(get_key(opt_key), koef * values->get_at(0)); - above_node.put(get_key(opt_key), koef * values->get_at(1)); + below_node.put(get_key(opt_key), values->get_at(0)); + above_node.put(get_key(opt_key), values->get_at(1)); } break; case coBools: { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 80988abd08..47486cc9b3 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -4758,14 +4758,14 @@ void PrintConfigDef::init_sla_tilt_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloats({ 0., 0.})); - def = this->add("tower_hop_height", coInts); + def = this->add("tower_hop_height", coFloats); def->full_label = L("Tower hop height"); def->tooltip = L("The height of the tower raise."); def->sidetext = L("mm"); def->min = 0; def->max = 100; def->mode = comExpert; - def->set_default_value(new ConfigOptionInts({ 0, 0})); + def->set_default_value(new ConfigOptionFloats({ 0., 0.})); def = this->add("tower_speed", coEnums); def->full_label = L("Tower speed"); @@ -5202,11 +5202,11 @@ const std::map tilt_options_floats_defs = {"tilt_down_delay", ConfigOptionFloats({ 0., 0., 0., 0.5, 0., 0., 0., 0. }) } , {"tilt_up_offset_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } , {"tilt_up_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } , + {"tower_hop_height", ConfigOptionFloats({ 0., 0., 0., 0., 5., 5., 0., 0. }) } , }; const std::map tilt_options_ints_defs = { - {"tower_hop_height", ConfigOptionInts({ 0, 0, 0, 0, 5, 5, 0, 0 }) } , {"tilt_down_offset_steps", ConfigOptionInts({ 0, 0, 0, 0, 2200, 2200, 0, 0 }) } , {"tilt_down_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } , {"tilt_up_offset_steps", ConfigOptionInts({ 1200, 1200, 600, 600, 2200, 2200, 0, 0 }) } , @@ -5242,11 +5242,11 @@ const std::map tilt_options_floats_sl1_defs = {"tilt_down_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } , {"tilt_up_offset_delay", ConfigOptionFloats({ 0., 0., 0., 0., 1., 1., 0., 0. }) } , {"tilt_up_delay", ConfigOptionFloats({ 0., 0., 0., 0., 0., 0., 0., 0. }) } , + {"tower_hop_height", ConfigOptionFloats({ 0., 0., 0., 0., 5., 5., 0., 0. }) } , }; const std::map tilt_options_ints_sl1_defs = { - {"tower_hop_height", ConfigOptionInts({ 0, 0, 0, 0, 5, 5, 0, 0 }) } , {"tilt_down_offset_steps", ConfigOptionInts({ 650, 650, 0, 0, 2200, 2200, 0, 0 }) } , {"tilt_down_cycles", ConfigOptionInts({ 1, 1, 1, 1, 1, 1, 0, 0 }) } , {"tilt_up_offset_steps", ConfigOptionInts({ 400, 400, 400, 400, 2200, 2200, 0, 0 }) } , diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index b0d71c388a..5f21c786c6 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1248,7 +1248,7 @@ PRINT_CONFIG_CLASS_DEFINE( //tilt params ((ConfigOptionFloats, delay_before_exposure)) ((ConfigOptionFloats, delay_after_exposure)) - ((ConfigOptionInts, tower_hop_height)) + ((ConfigOptionFloats, tower_hop_height)) ((ConfigOptionEnums, tower_speed)) ((ConfigOptionBools, use_tilt)) ((ConfigOptionEnums, tilt_down_initial_speed)) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index a5efef3a33..9182cb7932 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -695,8 +695,8 @@ std::string SLAPrint::validate(std::vector*) const } } - if ((!m_material_config.use_tilt.get_at(0) && m_material_config.tower_hop_height.get_at(0) == 0) - || (!m_material_config.use_tilt.get_at(1) && m_material_config.tower_hop_height.get_at(1) == 0)) + if ((!m_material_config.use_tilt.get_at(0) && is_approx(m_material_config.tower_hop_height.get_at(0), 0.)) + || (!m_material_config.use_tilt.get_at(1) && is_approx(m_material_config.tower_hop_height.get_at(1), 0.))) return _u8L("Disabling the 'Use tilt' function causes the object to separate away from the film in the " "vertical direction only. Therefore, it is necessary to set the 'Tower hop height' parameter " "to reasonable value. The recommended value is 5 mm."); diff --git a/src/libslic3r/SLAPrintSteps.cpp b/src/libslic3r/SLAPrintSteps.cpp index 0b7fbaef0e..3b92cd861c 100644 --- a/src/libslic3r/SLAPrintSteps.cpp +++ b/src/libslic3r/SLAPrintSteps.cpp @@ -1041,7 +1041,7 @@ struct ExposureProfile { tilt_down_delay_ms = int(1000 * config.tilt_down_delay.get_at(opt_id)); tilt_up_offset_delay_ms = int(1000 * config.tilt_up_offset_delay.get_at(opt_id)); tilt_up_delay_ms = int(1000 * config.tilt_up_delay.get_at(opt_id)); - tower_hop_height_nm = config.tower_hop_height.get_at(opt_id) * 1000000; + tower_hop_height_nm = int(config.tower_hop_height.get_at(opt_id) * 1000000); tilt_down_offset_steps = config.tilt_down_offset_steps.get_at(opt_id); tilt_down_cycles = config.tilt_down_cycles.get_at(opt_id); tilt_up_offset_steps = config.tilt_up_offset_steps.get_at(opt_id);