Compare commits

...

2 Commits

Author SHA1 Message Date
TheLegendTubaGuy
a564a01013 fix: preserve PA batch speed and accel overrides (#14540)
* fix: preserve PA batch speed and accel overrides

* Remove broken ModelConfig set_config_values
2026-07-03 16:28:57 +08:00
raistlin7447
adc8763099 fix: crash in Measure tool when a plain edge is the first selection (#14538)
* fix: crash in Measure tool when a plain edge is the first selection

The SPHERE_2 gripper raycaster called get_feature_offset() on
.first.feature instead of .second.feature (copy-pasted from the SPHERE_1
block). Plain planar-border edges store no extra point, so the Edge
branch dereferenced an empty optional behind a release-stripped assert,
aborting on Flatpak and undefined behavior elsewhere.

Point the SPHERE_2 raycaster at .second.feature and fall the Edge branch
back to the edge midpoint.

Fixes #14018
2026-07-03 11:29:28 +08:00
2 changed files with 12 additions and 19 deletions

View File

@@ -91,9 +91,14 @@ Vec3d GLGizmoMeasure::get_feature_offset(const Measure::SurfaceFeature &feature)
}
case Measure::SurfaceFeatureType::Edge:
{
std::optional<Vec3d> p = feature.get_extra_point();
assert(p.has_value());
ret = *p;
// Only polygon edges store an extra point (the polygon centre); plain edges have none.
const std::optional<Vec3d> extra = feature.get_extra_point();
if (extra.has_value())
ret = *extra;
else {
const auto [pt1, pt2] = feature.get_edge();
ret = 0.5 * (pt1 + pt2);
}
break;
}
case Measure::SurfaceFeatureType::Point:
@@ -1065,7 +1070,7 @@ void GLGizmoMeasure::on_render()
if (requires_raycaster_update) {
if (m_gripper_id_raycast_map.find(GripperType::SPHERE_2) != m_gripper_id_raycast_map.end()) {
m_gripper_id_raycast_map[GripperType::SPHERE_2]->set_transform(Geometry::translation_transform(get_feature_offset(*m_selected_features.first.feature)) *
m_gripper_id_raycast_map[GripperType::SPHERE_2]->set_transform(Geometry::translation_transform(get_feature_offset(*m_selected_features.second.feature)) *
Geometry::scale_transform(inv_zoom));
}
}

View File

@@ -253,18 +253,6 @@ static void set_config_values(DynamicPrintConfig *config, const std::string &key
}
}
template <typename T, typename OptionType>
static void set_config_values(ModelConfig& config, const std::string &key, T value)
{
auto config_opt = config.get().option<OptionType>(key);
if (config_opt) {
config.set_key_value(key, new OptionType(config_opt->values.size(), value));
}
else {
BOOST_LOG_TRIVIAL(info) << "set_config_values: the key" << key << "is empty.";
}
}
bool Plater::has_illegal_filename_characters(const wxString& wxs_name)
{
std::string name = into_u8(wxs_name);
@@ -12901,9 +12889,9 @@ void Plater::_calib_pa_pattern(const Calib_Params& params)
auto &obj_config = obj->config;
if (speeds.size() > 1)
set_config_values<double, ConfigOptionFloatsNullable>(obj_config, "outer_wall_speed", tspd);
obj_config.set_key_value("outer_wall_speed", new ConfigOptionFloatsNullable(1, tspd));
if (accels.size() > 1)
set_config_values<double, ConfigOptionFloatsNullable>(obj_config, "outer_wall_acceleration", tacc);
obj_config.set_key_value("outer_wall_acceleration", new ConfigOptionFloatsNullable(1, tacc));
auto cur_plate = get_partplate_list().get_plate(plate_idx);
if (!cur_plate) {
@@ -13325,7 +13313,7 @@ void Plater::calib_max_vol_speed(const Calib_Params& params)
set_config_values<double, ConfigOptionFloats>(filament_config, "filament_max_volumetric_speed", 200);
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{0.0});
printer_config->set_key_value("resonance_avoidance", new ConfigOptionBool{false});
set_config_values<bool, ConfigOptionBoolsNullable>(obj_cfg, "enable_overhang_speed", false);
obj_cfg.set_key_value("enable_overhang_speed", new ConfigOptionBoolsNullable(1, false));
obj_cfg.set_key_value("wall_loops", new ConfigOptionInt(1));
obj_cfg.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
obj_cfg.set_key_value("top_shell_layers", new ConfigOptionInt(0));