Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Dec 23, 2023
2 parents 1c6dc3d + 123f4a3 commit 84f7810
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/libslic3r/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ class ConfigOptionPercentsTempl : public ConfigOptionFloatsTempl<NULLABLE>
if (&v != &this->values.front())
ss << ",";
this->serialize_single_value(ss, v);
if (! (std::isnan(v) || v == NIL_VALUE()))
if (!(std::isnan(v) || v == ConfigOptionFloatsTempl<NULLABLE>::NIL_VALUE()))
ss << "%";
}
std::string str = ss.str();
Expand All @@ -1214,7 +1214,7 @@ class ConfigOptionPercentsTempl : public ConfigOptionFloatsTempl<NULLABLE>
for (const double v : this->values) {
std::ostringstream ss;
this->serialize_single_value(ss, v);
if (! (std::isnan(v) || v == NIL_VALUE()))
if (!(std::isnan(v) || v == ConfigOptionFloatsTempl<NULLABLE>::NIL_VALUE()))
ss << "%";
vv.push_back(ss.str());
}
Expand Down
1 change: 0 additions & 1 deletion src/libslic3r/GCode/SeamPlacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "libslic3r/Utils.hpp"

//#define DEBUG_FILES
#pragma optimize("", off)
#ifdef DEBUG_FILES
#include <boost/nowide/cstdio.hpp>
#include <SVG.hpp>
Expand Down
6 changes: 6 additions & 0 deletions src/libslic3r/GCode/WipeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ class WipeTowerWriter
if (limit_volumetric_flow) {
float e_speed = e / (((len == 0.f) ? std::abs(e) : len) / f * 60.f);
f /= std::max(1.f, e_speed / m_filpar[m_current_tool].max_e_speed);
if (len > 0 && m_filpar[m_current_tool].max_speed > 0) {
f = std::min(f, m_filpar[m_current_tool].max_speed);
}
}
gcode += set_format_F(f);
}
Expand Down Expand Up @@ -730,6 +733,9 @@ void WipeTower::set_extruder(size_t idx)
float nozzle_diameter = float(m_config->nozzle_diameter.get_at(idx));
m_filpar[idx].nozzle_diameter = nozzle_diameter; // to be used in future with (non-single) multiextruder MM

float max_speed = float(m_config->filament_max_speed.get_at(idx));
if (max_speed > 0.f)
m_filpar[idx].max_speed = max_speed;
float max_vol_speed = float(m_config->filament_max_volumetric_speed.get_at(idx));
if (max_vol_speed!= 0.f)
m_filpar[idx].max_e_speed = (max_vol_speed / filament_area());
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/GCode/WipeTower.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class WipeTower
// end skinnydip
float ramming_line_width_multiplicator = 1.f;
float ramming_step_multiplicator = 1.f;
float max_speed = std::numeric_limits<float>::max();
float max_e_speed = std::numeric_limits<float>::max();
std::vector<float> ramming_speed;
float nozzle_diameter;
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8123,7 +8123,7 @@ std::map<std::string, std::string> PrintConfigDef::to_prusa(t_config_option_key&
value = "octoprint";
} else if (opt_key.find("extrusion_width") != std::string::npos) {
if (std::set<std::string>{"extrusion_width", "first_layer_extrusion_width", "perimeter_extrusion_width", "external_perimeter_extrusion_width",
"infill_extrusion_width", "solid_infill_extrusion_width", "top_infill_extrusion_width"}.count(opt_key) > 0) {
"infill_extrusion_width", "solid_infill_extrusion_width", "top_infill_extrusion_width", "support_material_extrusion_width"}.count(opt_key) > 0) {
const ConfigOptionFloatOrPercent* opt = all_conf.option<ConfigOptionFloatOrPercent>(opt_key);
if (opt->is_phony() || opt->percent) {
if (opt->percent) {
Expand Down
3 changes: 1 addition & 2 deletions src/libslic3r/SupportMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4285,7 +4285,6 @@ void PrintObjectSupportMaterial::generate_toolpaths(
size_t idx_layer_intermediate = size_t(-1);
size_t idx_layer_interface = size_t(-1);
size_t idx_layer_base_interface = size_t(-1);
const InfillPattern fill_type_first_layer = ipRectiWithPerimeter;
std::unique_ptr<Fill> filler_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.contact_fill_pattern));
std::unique_ptr<Fill> filler_intermediate_interface = std::unique_ptr<Fill>(Fill::new_from_type(ipRectilinear));
// Filler for the base interface (to be used for soluble interface / non soluble base, to produce non soluble interface layer below soluble interface layer).
Expand Down Expand Up @@ -4406,7 +4405,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
float supp_density = m_support_params.interface_density;
coordf_t filler_spacing;
//if first layer and solid first layer : draw concentric with 100% density
if (support_layer.id() == 0) {
if (support_layer.id() == 0 && layer_ex.layer->bottom_z <= 0) {
filler = filler_first_layer_ptr.get();
supp_density = float(this->m_object_config->raft_first_layer_density.get_abs_value(1.));
interface_flow = m_support_params.first_layer_flow;
Expand Down
50 changes: 36 additions & 14 deletions src/slic3r/GUI/Field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,13 @@ std::pair<wxString, bool> any_to_wxstring(const boost::any &value, const ConfigO
};
// first, easy convert-to one-string
switch (opt.type) {
case coFloats:
case coFloats: {
if (opt_idx < 0) {
deserialize(ConfigOptionFloats{});
break;
}
case coPercents:
}
case coPercents: {
if (opt_idx < 0) {
deserialize(ConfigOptionPercents{});
break;
Expand All @@ -400,23 +401,31 @@ std::pair<wxString, bool> any_to_wxstring(const boost::any &value, const ConfigO
has_nil = true;
break;
}
}
case coFloat:
case coPercent: text_value = double_to_string(boost::any_cast<double>(value), opt.precision); break;
case coStrings:
case coPercent: {
text_value = double_to_string(boost::any_cast<double>(value), opt.precision);
break;
}
case coStrings: {
if (opt_idx < 0) {
//custom for strings, as we don't need the serialized form, the normal one with ';' in-between is enough
// custom for strings, as we don't need the serialized form, the normal one with ';' in-between is enough
ConfigOptionStrings reader;
reader.set_any(value, opt_idx);
std::string good_str;
for (std::string s : reader.values) good_str += s + ";";
if(!good_str.empty())
if (!good_str.empty())
good_str.pop_back();
text_value = good_str;
break;
}
// can't be nullable
case coString: text_value = boost::any_cast<std::string>(value); break;
case coFloatsOrPercents:
}
case coString: {
text_value = boost::any_cast<std::string>(value);
break;
}
case coFloatsOrPercents: {
if (opt_idx < 0) {
deserialize(ConfigOptionFloatsOrPercents{});
break;
Expand All @@ -427,13 +436,15 @@ std::pair<wxString, bool> any_to_wxstring(const boost::any &value, const ConfigO
has_nil = true;
break;
}
case coFloatOrPercent:
}
case coFloatOrPercent: {
FloatOrPercent fl_or_per = boost::any_cast<FloatOrPercent>(value);
text_value = double_to_string(fl_or_per.value);
if (fl_or_per.percent)
text_value.append("%");
break;
case coBools:
}
case coBools: {
if (opt_idx < 0) {
deserialize(ConfigOptionBools{});
} else {
Expand All @@ -445,12 +456,14 @@ std::pair<wxString, bool> any_to_wxstring(const boost::any &value, const ConfigO
text_value = boost::any_cast<uint8_t>(value) != 0 ? "true" : "false";
}
break;
case coBool:
}
case coBool: {
if (opt.is_script)
text_value = boost::any_cast<uint8_t>(value) != 0 ? "true" : "false";
else
text_value = boost::any_cast<bool>(value) ? "true" : "false";
case coInts:
}
case coInts: {
if (opt_idx < 0) {
deserialize(ConfigOptionInts{});
break;
Expand All @@ -460,14 +473,21 @@ std::pair<wxString, bool> any_to_wxstring(const boost::any &value, const ConfigO
has_nil = true;
break;
}
case coInt: text_value = wxString::Format(_T("%i"), int(boost::any_cast<int>(value))); break;
}
case coInt: {
text_value = wxString::Format(_T("%i"), int(boost::any_cast<int>(value)));
break;
}
case coPoints:
if (opt_idx < 0) {
deserialize(ConfigOptionPoints{});
assert(text_value == get_points_string(boost::any_cast<std::vector<Vec2d>>(value)));
break;
}
case coPoint: text_value = get_points_string({boost::any_cast<Vec2d>(value)});
case coPoint: {
text_value = get_points_string({boost::any_cast<Vec2d>(value)});
break;
}
}
return {text_value, has_nil};
}
Expand Down Expand Up @@ -2308,6 +2328,8 @@ boost::any &SliderCtrl::get_value()
} else if (m_opt.type == coInt) {
return m_value = int32_t(m_slider->GetValue() / m_scale);
}
assert(false);
return m_value;
}

} // GUI
Expand Down
6 changes: 4 additions & 2 deletions src/slic3r/GUI/GLCanvas3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6018,7 +6018,8 @@ void GLCanvas3D::_load_skirt_brim_preview_toolpaths(const BuildVolume &build_vol
if (!print_object->brim().empty())
for (const PrintInstance& inst : print_object->instances()) {
if (!print_object->brim().empty()) volume = ensure_volume_is_ready(volume);
_3DScene::extrusionentity_to_verts(print_object->brim(), print_zs[i], inst.shift, *volume);
_3DScene::extrusionentity_to_verts(print_object->brim(), print_zs[i],
print->config().complete_objects? inst.shift : Point(0, 0), *volume);
}
if (print_object->skirt_first_layer())
for (const PrintInstance& inst : print_object->instances()) {
Expand All @@ -6037,7 +6038,8 @@ void GLCanvas3D::_load_skirt_brim_preview_toolpaths(const BuildVolume &build_vol
if ( !print_object->skirt().empty() && (i != 0 || !print_object->skirt_first_layer()))
for (const PrintInstance& inst : print_object->instances()) {
if (!print_object->skirt().empty()) volume = ensure_volume_is_ready(volume);
_3DScene::extrusionentity_to_verts(print_object->skirt(), print_zs[i], inst.shift, *volume);
_3DScene::extrusionentity_to_verts(print_object->skirt(), print_zs[i],
print->config().complete_objects? inst.shift : Point(0, 0), *volume);
}
}
}
Expand Down
10 changes: 7 additions & 3 deletions src/slic3r/GUI/Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace Search {
static char marker_by_type(Preset::Type type, PrinterTechnology pt)
{
switch(type) {
case Preset::TYPE_FREQUENT_FFF:
case Preset::TYPE_FREQUENT_SLA:
case Preset::TYPE_FFF_PRINT:
case Preset::TYPE_SLA_PRINT:
return ImGui::PrintIconMarker;
Expand All @@ -47,7 +49,7 @@ static char marker_by_type(Preset::Type type, PrinterTechnology pt)
case Preset::TYPE_PRINTER:
return pt == ptSLA ? ImGui::PrinterSlaIconMarker : ImGui::PrinterIconMarker;
default:
return ' ';
return ImGui::PrintIconMarker;
}
}

Expand Down Expand Up @@ -994,9 +996,11 @@ void SearchListModel::Clear()
void SearchListModel::Prepend(const std::string& label)
{
const char icon_c = label.at(0);
int icon_idx = icon_idxs.at(icon_c);
wxString str = from_u8(label).Remove(0, 1);
wxString str = from_u8(label).Remove(0, 1);

int icon_idx = 0;
if(icon_c < icon_idxs.size())
icon_idx = icon_idxs.at(icon_c);
m_values.emplace_back(str, icon_idx);

RowPrepended();
Expand Down

0 comments on commit 84f7810

Please sign in to comment.