Merge branch 'master' into tm_colldetection_upgr

This commit is contained in:
tamasmeszaros 2019-01-15 15:32:35 +01:00
commit 05861dcacd
18 changed files with 163 additions and 89 deletions

View file

@ -103,8 +103,7 @@ OozePrevention::_get_temp(GCode &gcodegen)
: gcodegen.config().temperature.get_at(gcodegen.writer().extruder()->id()); : gcodegen.config().temperature.get_at(gcodegen.writer().extruder()->id());
} }
std::string std::string Wipe::wipe(GCode &gcodegen, bool toolchange)
Wipe::wipe(GCode &gcodegen, bool toolchange)
{ {
std::string gcode; std::string gcode;
@ -137,19 +136,22 @@ Wipe::wipe(GCode &gcodegen, bool toolchange)
wipe_path.clip_end(wipe_path.length() - wipe_dist); wipe_path.clip_end(wipe_path.length() - wipe_dist);
// subdivide the retraction in segments // subdivide the retraction in segments
for (const Line &line : wipe_path.lines()) { if (! wipe_path.empty()) {
double segment_length = line.length(); for (const Line &line : wipe_path.lines()) {
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one double segment_length = line.length();
due to rounding (TODO: test and/or better math for this) */ /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
double dE = length * (segment_length / wipe_dist) * 0.95; due to rounding (TODO: test and/or better math for this) */
//FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle. double dE = length * (segment_length / wipe_dist) * 0.95;
// Is it here for the cooling markers? Or should it be outside of the cycle? //FIXME one shall not generate the unnecessary G1 Fxxx commands, here wipe_speed is a constant inside this cycle.
gcode += gcodegen.writer().set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers() ? ";_WIPE" : ""); // Is it here for the cooling markers? Or should it be outside of the cycle?
gcode += gcodegen.writer().extrude_to_xy( gcode += gcodegen.writer().set_speed(wipe_speed*60, "", gcodegen.enable_cooling_markers() ? ";_WIPE" : "");
gcodegen.point_to_gcode(line.b), gcode += gcodegen.writer().extrude_to_xy(
-dE, gcodegen.point_to_gcode(line.b),
"wipe and retract" -dE,
); "wipe and retract"
);
}
gcodegen.set_last_pos(wipe_path.points.back());
} }
// prevent wiping again on same path // prevent wiping again on same path
@ -2577,9 +2579,11 @@ std::string GCode::travel_to(const Point &point, ExtrusionRole role, std::string
// use G1 because we rely on paths being straight (G0 may make round paths) // use G1 because we rely on paths being straight (G0 may make round paths)
Lines lines = travel.lines(); Lines lines = travel.lines();
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) if (! lines.empty()) {
gcode += m_writer.travel_to_xy(this->point_to_gcode(line->b), comment); for (const Line &line : lines)
gcode += m_writer.travel_to_xy(this->point_to_gcode(line.b), comment);
this->set_last_pos(lines.back().b);
}
return gcode; return gcode;
} }

View file

@ -155,11 +155,11 @@ public:
void do_export(Print *print, const char *path, GCodePreviewData *preview_data = nullptr); void do_export(Print *print, const char *path, GCodePreviewData *preview_data = nullptr);
// Exported for the helper classes (OozePrevention, Wipe) and for the Perl binding for unit tests. // Exported for the helper classes (OozePrevention, Wipe) and for the Perl binding for unit tests.
const Vec2d& origin() const { return m_origin; } const Vec2d& origin() const { return m_origin; }
void set_origin(const Vec2d &pointf); void set_origin(const Vec2d &pointf);
void set_origin(const coordf_t x, const coordf_t y) { this->set_origin(Vec2d(x, y)); } void set_origin(const coordf_t x, const coordf_t y) { this->set_origin(Vec2d(x, y)); }
const Point& last_pos() const { return m_last_pos; } const Point& last_pos() const { return m_last_pos; }
Vec2d point_to_gcode(const Point &point) const; Vec2d point_to_gcode(const Point &point) const;
Point gcode_to_point(const Vec2d &point) const; Point gcode_to_point(const Vec2d &point) const;
const FullPrintConfig &config() const { return m_config; } const FullPrintConfig &config() const { return m_config; }
const Layer* layer() const { return m_layer; } const Layer* layer() const { return m_layer; }
@ -360,6 +360,7 @@ protected:
size_t num_objects, size_t num_objects,
size_t num_islands); size_t num_islands);
friend class Wipe;
friend class WipeTowerIntegration; friend class WipeTowerIntegration;
}; };

View file

@ -1182,15 +1182,17 @@ Transform3d assemble_transform(const Vec3d& translation, const Vec3d& rotation,
Vec3d extract_euler_angles(const Eigen::Matrix<double, 3, 3, Eigen::DontAlign>& rotation_matrix) Vec3d extract_euler_angles(const Eigen::Matrix<double, 3, 3, Eigen::DontAlign>& rotation_matrix)
{ {
#if ENABLE_NEW_EULER_ANGLES #if ENABLE_NEW_EULER_ANGLES
bool x_only = (rotation_matrix(0, 0) == 1.0) && (rotation_matrix(0, 1) == 0.0) && (rotation_matrix(0, 2) == 0.0) && (rotation_matrix(1, 0) == 0.0) && (rotation_matrix(2, 0) == 0.0); auto is_approx = [](double value, double test_value) -> bool { return std::abs(value - test_value) < EPSILON; };
bool y_only = (rotation_matrix(0, 1) == 0.0) && (rotation_matrix(1, 0) == 0.0) && (rotation_matrix(1, 1) == 1.0) && (rotation_matrix(1, 2) == 0.0) && (rotation_matrix(2, 1) == 0.0);
bool z_only = (rotation_matrix(0, 2) == 0.0) && (rotation_matrix(1, 2) == 0.0) && (rotation_matrix(2, 0) == 0.0) && (rotation_matrix(2, 1) == 0.0) && (rotation_matrix(2, 2) == 1.0); bool x_only = is_approx(rotation_matrix(0, 0), 1.0) && is_approx(rotation_matrix(0, 1), 0.0) && is_approx(rotation_matrix(0, 2), 0.0) && is_approx(rotation_matrix(1, 0), 0.0) && is_approx(rotation_matrix(2, 0), 0.0);
// bool xy_only = (rotation_matrix(0, 1) == 0.0); // Rx * Ry bool y_only = is_approx(rotation_matrix(0, 1), 0.0) && is_approx(rotation_matrix(1, 0), 0.0) && is_approx(rotation_matrix(1, 1), 1.0) && is_approx(rotation_matrix(1, 2), 0.0) && is_approx(rotation_matrix(2, 1), 0.0);
bool yx_only = (rotation_matrix(1, 0) == 0.0); // Ry * Rx bool z_only = is_approx(rotation_matrix(0, 2), 0.0) && is_approx(rotation_matrix(1, 2), 0.0) && is_approx(rotation_matrix(2, 0), 0.0) && is_approx(rotation_matrix(2, 1), 0.0) && is_approx(rotation_matrix(2, 2), 1.0);
// bool xz_only = (rotation_matrix(0, 2) == 0.0); // Rx * Rz // bool xy_only = is_approx(rotation_matrix(0, 1), 0.0); // Rx * Ry
// bool zx_only = (rotation_matrix(2, 0) == 0.0); // Rz * Rx bool yx_only = is_approx(rotation_matrix(1, 0), 0.0); // Ry * Rx
// bool yz_only = (rotation_matrix(1, 2) == 0.0); // Ry * Rz // bool xz_only = is_approx(rotation_matrix(0, 2), 0.0); // Rx * Rz
// bool zy_only = (rotation_matrix(2, 1) == 0.0); // Rz * Ry // bool zx_only = is_approx(rotation_matrix(2, 0), 0.0); // Rz * Rx
// bool yz_only = is_approx(rotation_matrix(1, 2), 0.0); // Ry * Rz
// bool zy_only = is_approx(rotation_matrix(2, 1), 0.0); // Rz * Ry
Vec3d angles = Vec3d::Zero(); Vec3d angles = Vec3d::Zero();
if (x_only || y_only || z_only) if (x_only || y_only || z_only)

View file

@ -206,6 +206,26 @@ std::vector<Point> MultiPoint::_douglas_peucker(const std::vector<Point>& pts, c
floater = &pts[floater_idx]; floater = &pts[floater_idx];
} }
} }
assert(result_pts.front() == pts.front());
assert(result_pts.back() == pts.back());
#if 0
{
static int iRun = 0;
BoundingBox bbox(pts);
BoundingBox bbox2(result_pts);
bbox.merge(bbox2);
SVG svg(debug_out_path("douglas_peucker_%d.svg", iRun ++).c_str(), bbox);
if (pts.front() == pts.back())
svg.draw(Polygon(pts), "black");
else
svg.draw(Polyline(pts), "black");
if (result_pts.front() == result_pts.back())
svg.draw(Polygon(result_pts), "green", scale_(0.1));
else
svg.draw(Polyline(result_pts), "green", scale_(0.1));
}
#endif
} }
return result_pts; return result_pts;
} }

View file

@ -1204,8 +1204,8 @@ bool SLASupportTree::generate(const PointSet &points,
// there is no need to bridge them together. // there is no need to bridge them together.
if(pillar_dist > 2*cfg.head_back_radius_mm && if(pillar_dist > 2*cfg.head_back_radius_mm &&
bridge_distance < cfg.max_bridge_length_mm) bridge_distance < cfg.max_bridge_length_mm)
while(sj(Z) > pillar.endpoint(Z) && while(sj(Z) > pillar.endpoint(Z) + cfg.base_radius_mm &&
ej(Z) > nextpillar.endpoint(Z)) ej(Z) > nextpillar.endpoint(Z) + + cfg.base_radius_mm)
{ {
if(chkd >= bridge_distance) { if(chkd >= bridge_distance) {
result.add_bridge(sj, ej, pillar.r); result.add_bridge(sj, ej, pillar.r);
@ -1702,7 +1702,7 @@ SlicedSupports SLASupportTree::slice(float layerh, float init_layerh) const
const Pad& pad = m_impl->pad(); const Pad& pad = m_impl->pad();
if(!pad.empty()) gndlvl -= float(get_pad_elevation(pad.cfg)); if(!pad.empty()) gndlvl -= float(get_pad_elevation(pad.cfg));
std::vector<float> heights = {gndlvl}; std::vector<float> heights;
heights.reserve(size_t(modelh/layerh) + 1); heights.reserve(size_t(modelh/layerh) + 1);
for(float h = gndlvl + init_layerh; h < gndlvl + modelh; h += layerh) { for(float h = gndlvl + init_layerh; h < gndlvl + modelh; h += layerh) {

View file

@ -732,9 +732,7 @@ void SLAPrint::process()
po.m_supportdata->level_ids.reserve(sslices.size()); po.m_supportdata->level_ids.reserve(sslices.size());
for(int i = 0; i < int(sslices.size()); ++i) { for(int i = 0; i < int(sslices.size()); ++i) {
int a = i == 0 ? 0 : 1; LevelID h = sminZ + sih + i * slh;
int b = i == 0 ? 0 : i - 1;
LevelID h = sminZ + a * sih + b * slh;
po.m_supportdata->level_ids.emplace_back(h); po.m_supportdata->level_ids.emplace_back(h);
float fh = float(double(h) * SCALING_FACTOR); float fh = float(double(h) * SCALING_FACTOR);

View file

@ -148,8 +148,16 @@ private:
// Which steps have to be performed. Implicitly: all // Which steps have to be performed. Implicitly: all
std::vector<bool> m_stepmask; std::vector<bool> m_stepmask;
// Individual 2d slice polygons from lower z to higher z levels
std::vector<ExPolygons> m_model_slices; std::vector<ExPolygons> m_model_slices;
// Exact (float) height levels mapped to the slices. Each record contains
// the index to the model and the support slice vectors.
SliceIndex m_slice_index; SliceIndex m_slice_index;
// The height levels corrected and scaled up in integer values. This will
// be used at rasterization.
std::vector<LevelID> m_level_ids; std::vector<LevelID> m_level_ids;
// Caching the transformed (m_trafo) raw mesh of the object // Caching the transformed (m_trafo) raw mesh of the object

View file

@ -860,12 +860,12 @@ void TriangleMeshSlicer::_slice_do(size_t facet_idx, std::vector<IntersectionLin
// find layer extents // find layer extents
std::vector<float>::const_iterator min_layer, max_layer; std::vector<float>::const_iterator min_layer, max_layer;
min_layer = std::lower_bound(z.begin(), z.end(), min_z); // first layer whose slice_z is >= min_z min_layer = std::lower_bound(z.begin(), z.end(), min_z); // first layer whose slice_z is >= min_z
max_layer = std::upper_bound(z.begin() + (min_layer - z.begin()), z.end(), max_z) - 1; // last layer whose slice_z is <= max_z max_layer = std::upper_bound(min_layer, z.end(), max_z); // first layer whose slice_z is > max_z
#ifdef SLIC3R_TRIANGLEMESH_DEBUG #ifdef SLIC3R_TRIANGLEMESH_DEBUG
printf("layers: min = %d, max = %d\n", (int)(min_layer - z.begin()), (int)(max_layer - z.begin())); printf("layers: min = %d, max = %d\n", (int)(min_layer - z.begin()), (int)(max_layer - z.begin()));
#endif /* SLIC3R_TRIANGLEMESH_DEBUG */ #endif /* SLIC3R_TRIANGLEMESH_DEBUG */
for (std::vector<float>::const_iterator it = min_layer; it != max_layer + 1; ++ it) { for (std::vector<float>::const_iterator it = min_layer; it != max_layer; ++ it) {
std::vector<float>::size_type layer_idx = it - z.begin(); std::vector<float>::size_type layer_idx = it - z.begin();
IntersectionLine il; IntersectionLine il;
if (this->slice_facet(*it / SCALING_FACTOR, facet, facet_idx, min_z, max_z, &il) == TriangleMeshSlicer::Slicing) { if (this->slice_facet(*it / SCALING_FACTOR, facet, facet_idx, min_z, max_z, &il) == TriangleMeshSlicer::Slicing) {

View file

@ -114,7 +114,7 @@ AboutDialog::AboutDialog()
this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE); this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE);
vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3);
this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); // this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this);
logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this);
SetSizer(main_sizer); SetSizer(main_sizer);

View file

@ -775,6 +775,8 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
SetSize(std::max(size.GetWidth(), static_cast<int>(MIN_WIDTH)), std::max(size.GetHeight(), static_cast<int>(MIN_HEIGHT))); SetSize(std::max(size.GetWidth(), static_cast<int>(MIN_WIDTH)), std::max(size.GetHeight(), static_cast<int>(MIN_HEIGHT)));
Layout(); Layout();
SetEscapeId(wxID_CLOSE); // To close the dialog using "Esc" button
// Bind events // Bind events
p->hex_picker->Bind(wxEVT_FILEPICKER_CHANGED, [this](wxFileDirPickerEvent& evt) { p->hex_picker->Bind(wxEVT_FILEPICKER_CHANGED, [this](wxFileDirPickerEvent& evt) {
@ -826,6 +828,7 @@ FirmwareDialog::FirmwareDialog(wxWindow *parent) :
if (this->p->avrdude) { if (this->p->avrdude) {
evt.Veto(); evt.Veto();
} else { } else {
this->EndModal(wxID_CLOSE);
evt.Skip(); evt.Skip();
} }
}); });

View file

@ -1609,13 +1609,12 @@ void GLCanvas3D::Selection::rotate(const Vec3d& rotation, bool local)
else if (is_single_volume() || is_single_modifier()) else if (is_single_volume() || is_single_modifier())
#if ENABLE_WORLD_ROTATIONS #if ENABLE_WORLD_ROTATIONS
{ {
if (requires_local_axes()) if (local)
(*m_volumes)[i]->set_volume_rotation(rotation); (*m_volumes)[i]->set_volume_rotation(rotation);
else else
{ {
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation); Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), rotation);
const Transform3d& inst_m = m_cache.volumes_data[i].get_instance_rotation_matrix(); Vec3d new_rotation = Geometry::extract_euler_angles(m * m_cache.volumes_data[i].get_volume_rotation_matrix());
Vec3d new_rotation = Geometry::extract_euler_angles(inst_m.inverse() * m * inst_m * m_cache.volumes_data[i].get_volume_rotation_matrix());
(*m_volumes)[i]->set_volume_rotation(new_rotation); (*m_volumes)[i]->set_volume_rotation(new_rotation);
} }
} }
@ -5709,7 +5708,7 @@ void GLCanvas3D::set_camera_zoom(float zoom)
// Don't allow to zoom too far outside the scene. // Don't allow to zoom too far outside the scene.
float zoom_min = _get_zoom_to_bounding_box_factor(_max_bounding_box()); float zoom_min = _get_zoom_to_bounding_box_factor(_max_bounding_box());
if (zoom_min > 0.0f) if (zoom_min > 0.0f)
zoom = std::max(zoom, zoom_min * 0.8f); zoom = std::max(zoom, zoom_min * 0.7f);
m_camera.zoom = zoom; m_camera.zoom = zoom;
viewport_changed(); viewport_changed();

View file

@ -497,7 +497,11 @@ void ObjectManipulation::change_rotation_value(const Vec3d& rotation)
} }
canvas->get_selection().start_dragging(); canvas->get_selection().start_dragging();
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
canvas->get_selection().rotate(rad_rotation, selection.is_single_full_instance() || selection.requires_local_axes());
#else
canvas->get_selection().rotate(rad_rotation, selection.is_single_full_instance()); canvas->get_selection().rotate(rad_rotation, selection.is_single_full_instance());
#endif // ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION
canvas->do_rotate(); canvas->do_rotate();
#if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION #if ENABLE_IMPROVED_SIDEBAR_OBJECTS_MANIPULATION

View file

@ -24,7 +24,7 @@ public:
virtual void Hide(); virtual void Hide();
virtual void UpdateAndShow(const bool show); virtual void UpdateAndShow(const bool show);
wxSizer* get_sizer(); virtual wxSizer* get_sizer();
ConfigOptionsGroup* get_og() { return m_og.get(); } ConfigOptionsGroup* get_og() { return m_og.get(); }
}; };

View file

@ -751,30 +751,20 @@ void Preview::load_print_as_fff()
if (IsShown()) if (IsShown())
{ {
if (gcode_preview_data_valid) if (gcode_preview_data_valid)
{ // Load the real G-code preview.
m_canvas->load_gcode_preview(*m_gcode_preview_data, colors); m_canvas->load_gcode_preview(*m_gcode_preview_data, colors);
show_hide_ui_elements("full");
// recalculates zs and update sliders accordingly
has_layers = ! m_canvas->get_current_print_zs(true).empty();
if (! has_layers)
{
// all layers filtered out
reset_sliders();
m_canvas_widget->Refresh();
}
}
else else
{ // Load the initial preview based on slices, not the final G-code.
// load skirt and brim
m_canvas->load_preview(colors); m_canvas->load_preview(colors);
show_hide_ui_elements("simple"); show_hide_ui_elements(gcode_preview_data_valid ? "full" : "simple");
} // recalculates zs and update sliders accordingly
std::vector<double> zs = m_canvas->get_current_print_zs(true);
if (zs.empty()) {
if (has_layers) // all layers filtered out
update_sliders(m_canvas->get_current_print_zs(true)); reset_sliders();
m_canvas_widget->Refresh();
} else
update_sliders(zs);
m_loaded = true; m_loaded = true;
} }
} }

View file

@ -286,12 +286,17 @@ class FreqChangedParams : public OG_Settings
{ {
double m_brim_width = 0.0; double m_brim_width = 0.0;
wxButton* m_wiping_dialog_button{ nullptr }; wxButton* m_wiping_dialog_button{ nullptr };
wxSizer* m_sizer {nullptr};
std::shared_ptr<ConfigOptionsGroup> m_og_sla;
public: public:
FreqChangedParams(wxWindow* parent, const int label_width); FreqChangedParams(wxWindow* parent, const int label_width);
~FreqChangedParams() {} ~FreqChangedParams() {}
wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; } wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; }
void Show(const bool show); wxSizer* get_sizer() override;
ConfigOptionsGroup* get_og(const bool is_fff);
void Show(const bool is_fff);
}; };
FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
@ -299,22 +304,13 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
{ {
DynamicPrintConfig* config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; DynamicPrintConfig* config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
// Frequently changed parameters for FFF_technology
m_og->set_config(config); m_og->set_config(config);
m_og->label_width = label_width; m_og->label_width = label_width;
m_og->m_on_change = [config, this](t_config_option_key opt_key, boost::any value) { m_og->m_on_change = [config, this](t_config_option_key opt_key, boost::any value) {
TabPrint* tab_print = nullptr; Tab* tab_print = wxGetApp().get_tab(Preset::TYPE_PRINT);
for (size_t i = 0; i < wxGetApp().tab_panel()->GetPageCount(); ++i) { if (!tab_print) return;
Tab *tab = dynamic_cast<Tab*>(wxGetApp().tab_panel()->GetPage(i));
if (!tab)
continue;
if (tab->name() == "print") {
tab_print = static_cast<TabPrint*>(tab);
break;
}
}
if (tab_print == nullptr)
return;
if (opt_key == "fill_density") { if (opt_key == "fill_density") {
value = m_og->get_config_value(*config, opt_key); value = m_og->get_config_value(*config, opt_key);
@ -413,19 +409,56 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
return sizer; return sizer;
}; };
m_og->append_line(line); m_og->append_line(line);
// Frequently changed parameters for SLA_technology
m_og_sla = std::make_shared<ConfigOptionsGroup>(parent, "");
DynamicPrintConfig* config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
m_og_sla->set_config(config_sla);
m_og_sla->label_width = label_width*2;
m_og_sla->m_on_change = [config_sla, this](t_config_option_key opt_key, boost::any value) {
Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT);
if (!tab) return;
tab->set_value(opt_key, value);
DynamicPrintConfig new_conf = *config_sla;
new_conf.set_key_value(opt_key, new ConfigOptionBool(boost::any_cast<bool>(value)));
tab->load_config(new_conf);
tab->update_dirty();
};
m_og_sla->append_single_option_line("supports_enable");
m_og_sla->append_single_option_line("pad_enable");
m_sizer = new wxBoxSizer(wxVERTICAL);
m_sizer->Add(m_og->sizer, 0, wxEXPAND);
m_sizer->Add(m_og_sla->sizer, 0, wxEXPAND | wxTOP, 5);
} }
void FreqChangedParams::Show(const bool show) wxSizer* FreqChangedParams::get_sizer()
{ {
bool is_wdb_shown = m_wiping_dialog_button->IsShown(); return m_sizer;
m_og->Show(show); }
void FreqChangedParams::Show(const bool is_fff)
{
const bool is_wdb_shown = m_wiping_dialog_button->IsShown();
m_og->Show(is_fff);
m_og_sla->Show(!is_fff);
// correct showing of the FreqChangedParams sizer when m_wiping_dialog_button is hidden // correct showing of the FreqChangedParams sizer when m_wiping_dialog_button is hidden
if (show && !is_wdb_shown) if (is_fff && !is_wdb_shown)
m_wiping_dialog_button->Hide(); m_wiping_dialog_button->Hide();
} }
ConfigOptionsGroup* FreqChangedParams::get_og(const bool is_fff)
{
return is_fff ? m_og.get() : m_og_sla.get();
}
// Sidebar / private // Sidebar / private
struct Sidebar::priv struct Sidebar::priv
@ -703,9 +736,9 @@ wxScrolledWindow* Sidebar::scrolled_panel()
return p->scrolled; return p->scrolled;
} }
ConfigOptionsGroup* Sidebar::og_freq_chng_params() ConfigOptionsGroup* Sidebar::og_freq_chng_params(const bool is_fff)
{ {
return p->frequently_changed_parameters->get_og(); return p->frequently_changed_parameters->get_og(is_fff);
} }
wxButton* Sidebar::get_wiping_dialog_button() wxButton* Sidebar::get_wiping_dialog_button()

View file

@ -76,7 +76,7 @@ public:
ObjectSettings* obj_settings(); ObjectSettings* obj_settings();
wxScrolledWindow* scrolled_panel(); wxScrolledWindow* scrolled_panel();
ConfigOptionsGroup* og_freq_chng_params(); ConfigOptionsGroup* og_freq_chng_params(const bool is_fff);
wxButton* get_wiping_dialog_button(); wxButton* get_wiping_dialog_button();
void update_objects_list_extruder_column(int extruders_count); void update_objects_list_extruder_column(int extruders_count);
void show_info_sizer(); void show_info_sizer();

View file

@ -120,7 +120,7 @@ SysInfoDialog::SysInfoDialog()
this->Bind(wxEVT_BUTTON, &SysInfoDialog::onCloseDialog, this, wxID_OK); this->Bind(wxEVT_BUTTON, &SysInfoDialog::onCloseDialog, this, wxID_OK);
main_sizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); main_sizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3);
this->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this); // this->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this);
logo->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this); logo->Bind(wxEVT_LEFT_DOWN, &SysInfoDialog::onCloseDialog, this);
SetSizer(main_sizer); SetSizer(main_sizer);

View file

@ -751,8 +751,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
wxPostEvent(this, event); wxPostEvent(this, event);
auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(); ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
if (opt_key == "fill_density") if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable")
{ {
boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key); boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
og_freq_chng_params->set_value(opt_key, val); og_freq_chng_params->set_value(opt_key, val);
@ -881,8 +881,20 @@ void Tab::update_preset_description_line()
void Tab::update_frequently_changed_parameters() void Tab::update_frequently_changed_parameters()
{ {
auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(); auto og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF));
if (!og_freq_chng_params) return; if (!og_freq_chng_params) return;
if (m_type == Preset::TYPE_SLA_PRINT)
{
for (auto opt_key : { "supports_enable", "pad_enable" })
{
boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key);
og_freq_chng_params->set_value(opt_key, val);
}
return;
}
// for m_type == Preset::TYPE_PRINT
boost::any value = og_freq_chng_params->get_config_value(*m_config, "fill_density"); boost::any value = og_freq_chng_params->get_config_value(*m_config, "fill_density");
og_freq_chng_params->set_value("fill_density", value); og_freq_chng_params->set_value("fill_density", value);
@ -2370,7 +2382,7 @@ void Tab::load_current_preset()
} }
else { else {
on_presets_changed(); on_presets_changed();
if (m_name == "print") if (m_type == Preset::TYPE_SLA_PRINT || m_type == Preset::TYPE_PRINT)// if (m_name == "print")
update_frequently_changed_parameters(); update_frequently_changed_parameters();
} }