Updated PrintConfig default values for machine limits
+ fixed incorrect default value setting for the TextCtrl
This commit is contained in:
parent
3fdefbfbea
commit
54c90ee948
@ -861,7 +861,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = L("Set silent mode for the G-code flavor");
|
def->tooltip = L("Set silent mode for the G-code flavor");
|
||||||
def->default_value = new ConfigOptionBool(true);
|
def->default_value = new ConfigOptionBool(true);
|
||||||
|
|
||||||
const int machine_linits_opt_width = 70;
|
const int machine_limits_opt_width = 70;
|
||||||
{
|
{
|
||||||
struct AxisDefault {
|
struct AxisDefault {
|
||||||
std::string name;
|
std::string name;
|
||||||
@ -871,10 +871,10 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
};
|
};
|
||||||
std::vector<AxisDefault> axes {
|
std::vector<AxisDefault> axes {
|
||||||
// name, max_feedrate, max_acceleration, max_jerk
|
// name, max_feedrate, max_acceleration, max_jerk
|
||||||
{ "x", { 200., 200. }, { 1000., 1000. }, { 10., 10. } },
|
{ "x", { 500., 200. }, { 9000., 1000. }, { 10., 10. } },
|
||||||
{ "y", { 200., 200. }, { 1000., 1000. }, { 10., 10. } },
|
{ "y", { 500., 200. }, { 9000., 1000. }, { 10., 10. } },
|
||||||
{ "z", { 12., 12. }, { 200., 200. }, { 0.4, 0.4 } },
|
{ "z", { 12., 12. }, { 500., 200. }, { 0.2, 0.4 } },
|
||||||
{ "e", { 120., 120. }, { 5000., 5000. }, { 2.5, 2.5 } }
|
{ "e", { 120., 120. }, { 10000., 5000. }, { 2.5, 2.5 } }
|
||||||
};
|
};
|
||||||
for (const AxisDefault &axis : axes) {
|
for (const AxisDefault &axis : axes) {
|
||||||
std::string axis_upper = boost::to_upper_copy<std::string>(axis.name);
|
std::string axis_upper = boost::to_upper_copy<std::string>(axis.name);
|
||||||
@ -885,7 +885,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = (boost::format(L("Maximum feedrate of the %1% axis")) % axis_upper).str();
|
def->tooltip = (boost::format(L("Maximum feedrate of the %1% axis")) % axis_upper).str();
|
||||||
def->sidetext = L("mm/s");
|
def->sidetext = L("mm/s");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats(axis.max_feedrate);
|
def->default_value = new ConfigOptionFloats(axis.max_feedrate);
|
||||||
// Add the machine acceleration limits for XYZE axes (M201)
|
// Add the machine acceleration limits for XYZE axes (M201)
|
||||||
def = this->add("machine_max_acceleration_" + axis.name, coFloats);
|
def = this->add("machine_max_acceleration_" + axis.name, coFloats);
|
||||||
@ -894,7 +894,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = (boost::format(L("Maximum acceleration of the %1% axis")) % axis_upper).str();
|
def->tooltip = (boost::format(L("Maximum acceleration of the %1% axis")) % axis_upper).str();
|
||||||
def->sidetext = L("mm/s²");
|
def->sidetext = L("mm/s²");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats(axis.max_acceleration);
|
def->default_value = new ConfigOptionFloats(axis.max_acceleration);
|
||||||
// Add the machine jerk limits for XYZE axes (M205)
|
// Add the machine jerk limits for XYZE axes (M205)
|
||||||
def = this->add("machine_max_jerk_" + axis.name, coFloats);
|
def = this->add("machine_max_jerk_" + axis.name, coFloats);
|
||||||
@ -903,7 +903,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = (boost::format(L("Maximum jerk of the %1% axis")) % axis_upper).str();
|
def->tooltip = (boost::format(L("Maximum jerk of the %1% axis")) % axis_upper).str();
|
||||||
def->sidetext = L("mm/s");
|
def->sidetext = L("mm/s");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats(axis.max_jerk);
|
def->default_value = new ConfigOptionFloats(axis.max_jerk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -915,7 +915,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = L("Minimum feedrate when extruding") + " (M205 S)";
|
def->tooltip = L("Minimum feedrate when extruding") + " (M205 S)";
|
||||||
def->sidetext = L("mm/s");
|
def->sidetext = L("mm/s");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats{ 0., 0. };
|
def->default_value = new ConfigOptionFloats{ 0., 0. };
|
||||||
|
|
||||||
// M205 T... [mm/sec]
|
// M205 T... [mm/sec]
|
||||||
@ -925,7 +925,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = L("Minimum travel feedrate") + " (M205 T)";
|
def->tooltip = L("Minimum travel feedrate") + " (M205 T)";
|
||||||
def->sidetext = L("mm/s");
|
def->sidetext = L("mm/s");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats{ 0., 0. };
|
def->default_value = new ConfigOptionFloats{ 0., 0. };
|
||||||
|
|
||||||
// M204 S... [mm/sec^2]
|
// M204 S... [mm/sec^2]
|
||||||
@ -935,8 +935,8 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = L("Maximum acceleration when extruding") + " (M204 S)";
|
def->tooltip = L("Maximum acceleration when extruding") + " (M204 S)";
|
||||||
def->sidetext = L("mm/s²");
|
def->sidetext = L("mm/s²");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats(1250., 1250.);
|
def->default_value = new ConfigOptionFloats(1500., 1250.);
|
||||||
|
|
||||||
// M204 T... [mm/sec^2]
|
// M204 T... [mm/sec^2]
|
||||||
def = this->add("machine_max_acceleration_retracting", coFloats);
|
def = this->add("machine_max_acceleration_retracting", coFloats);
|
||||||
@ -945,8 +945,8 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def->tooltip = L("Maximum acceleration when retracting") + " (M204 T)";
|
def->tooltip = L("Maximum acceleration when retracting") + " (M204 T)";
|
||||||
def->sidetext = L("mm/s²");
|
def->sidetext = L("mm/s²");
|
||||||
def->min = 0;
|
def->min = 0;
|
||||||
def->width = machine_linits_opt_width;
|
def->width = machine_limits_opt_width;
|
||||||
def->default_value = new ConfigOptionFloats(1250., 1250.);
|
def->default_value = new ConfigOptionFloats(1500., 1250.);
|
||||||
|
|
||||||
def = this->add("max_fan_speed", coInts);
|
def = this->add("max_fan_speed", coInts);
|
||||||
def->label = L("Max");
|
def->label = L("Max");
|
||||||
|
@ -35,6 +35,22 @@ namespace Slic3r { namespace GUI {
|
|||||||
set_undo_bitmap(&bmp);
|
set_undo_bitmap(&bmp);
|
||||||
set_undo_to_sys_bitmap(&bmp);
|
set_undo_to_sys_bitmap(&bmp);
|
||||||
|
|
||||||
|
switch (m_opt.type)
|
||||||
|
{
|
||||||
|
case coPercents:
|
||||||
|
case coFloats:
|
||||||
|
case coStrings:
|
||||||
|
case coBools:
|
||||||
|
case coInts: {
|
||||||
|
auto tag_pos = m_opt_id.find("#");
|
||||||
|
if (tag_pos != std::string::npos)
|
||||||
|
m_opt_idx = stoi(m_opt_id.substr(tag_pos + 1, m_opt_id.size()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
BUILD();
|
BUILD();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,10 +167,10 @@ namespace Slic3r { namespace GUI {
|
|||||||
case coFloat:
|
case coFloat:
|
||||||
{
|
{
|
||||||
double val = m_opt.type == coFloats ?
|
double val = m_opt.type == coFloats ?
|
||||||
static_cast<const ConfigOptionFloats*>(m_opt.default_value)->get_at(0) :
|
static_cast<const ConfigOptionFloats*>(m_opt.default_value)->get_at(m_opt_idx) :
|
||||||
m_opt.type == coFloat ?
|
m_opt.type == coFloat ?
|
||||||
m_opt.default_value->getFloat() :
|
m_opt.default_value->getFloat() :
|
||||||
static_cast<const ConfigOptionPercents*>(m_opt.default_value)->get_at(0);
|
static_cast<const ConfigOptionPercents*>(m_opt.default_value)->get_at(m_opt_idx);
|
||||||
text_value = double_to_string(val);
|
text_value = double_to_string(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -164,10 +180,8 @@ namespace Slic3r { namespace GUI {
|
|||||||
case coStrings:
|
case coStrings:
|
||||||
{
|
{
|
||||||
const ConfigOptionStrings *vec = static_cast<const ConfigOptionStrings*>(m_opt.default_value);
|
const ConfigOptionStrings *vec = static_cast<const ConfigOptionStrings*>(m_opt.default_value);
|
||||||
if (vec == nullptr || vec->empty()) break;
|
if (vec == nullptr || vec->empty()) break; //for the case of empty default value
|
||||||
if (vec->size() > 1)
|
text_value = vec->get_at(m_opt_idx);
|
||||||
break;
|
|
||||||
text_value = vec->values.at(0);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -249,7 +263,7 @@ void CheckBox::BUILD() {
|
|||||||
|
|
||||||
bool check_value = m_opt.type == coBool ?
|
bool check_value = m_opt.type == coBool ?
|
||||||
m_opt.default_value->getBool() : m_opt.type == coBools ?
|
m_opt.default_value->getBool() : m_opt.type == coBools ?
|
||||||
static_cast<ConfigOptionBools*>(m_opt.default_value)->values.at(0) :
|
static_cast<ConfigOptionBools*>(m_opt.default_value)->get_at(m_opt_idx) :
|
||||||
false;
|
false;
|
||||||
|
|
||||||
auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
|
auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size);
|
||||||
@ -408,7 +422,7 @@ void Choice::set_selection()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case coStrings:{
|
case coStrings:{
|
||||||
text_value = static_cast<const ConfigOptionStrings*>(m_opt.default_value)->values.at(0);
|
text_value = static_cast<const ConfigOptionStrings*>(m_opt.default_value)->get_at(m_opt_idx);
|
||||||
|
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (auto el : m_opt.enum_values)
|
for (auto el : m_opt.enum_values)
|
||||||
@ -572,7 +586,7 @@ void ColourPicker::BUILD()
|
|||||||
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
|
if (m_opt.height >= 0) size.SetHeight(m_opt.height);
|
||||||
if (m_opt.width >= 0) size.SetWidth(m_opt.width);
|
if (m_opt.width >= 0) size.SetWidth(m_opt.width);
|
||||||
|
|
||||||
wxString clr(static_cast<ConfigOptionStrings*>(m_opt.default_value)->values.at(0));
|
wxString clr(static_cast<ConfigOptionStrings*>(m_opt.default_value)->get_at(m_opt_idx));
|
||||||
auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size);
|
auto temp = new wxColourPickerCtrl(m_parent, wxID_ANY, clr, wxDefaultPosition, size);
|
||||||
|
|
||||||
// // recast as a wxWindow to fit the calling convention
|
// // recast as a wxWindow to fit the calling convention
|
||||||
|
@ -95,6 +95,7 @@ public:
|
|||||||
/// Copy of ConfigOption for deduction purposes
|
/// Copy of ConfigOption for deduction purposes
|
||||||
const ConfigOptionDef m_opt {ConfigOptionDef()};
|
const ConfigOptionDef m_opt {ConfigOptionDef()};
|
||||||
const t_config_option_key m_opt_id;//! {""};
|
const t_config_option_key m_opt_id;//! {""};
|
||||||
|
int m_opt_idx = 0;
|
||||||
|
|
||||||
/// Sets a value for this control.
|
/// Sets a value for this control.
|
||||||
/// subclasses should overload with a specific version
|
/// subclasses should overload with a specific version
|
||||||
|
@ -1734,7 +1734,7 @@ void TabPrinter::append_option_line(ConfigOptionsGroupShp optgroup, const std::s
|
|||||||
optgroup->append_line(line);
|
optgroup->append_line(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
PageShp TabPrinter::create_kinematics_page()
|
PageShp TabPrinter::build_kinematics_page()
|
||||||
{
|
{
|
||||||
auto page = add_options_page(_(L("Machine limits")), "cog.png", true);
|
auto page = add_options_page(_(L("Machine limits")), "cog.png", true);
|
||||||
|
|
||||||
@ -1806,7 +1806,7 @@ void TabPrinter::build_extruder_pages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (existed_page < n_before_extruders && is_marlin_flavor){
|
if (existed_page < n_before_extruders && is_marlin_flavor){
|
||||||
auto page = create_kinematics_page();
|
auto page = build_kinematics_page();
|
||||||
m_pages.insert(m_pages.begin() + n_before_extruders, page);
|
m_pages.insert(m_pages.begin() + n_before_extruders, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ public:
|
|||||||
void update() override;
|
void update() override;
|
||||||
void update_serial_ports();
|
void update_serial_ports();
|
||||||
void extruders_count_changed(size_t extruders_count);
|
void extruders_count_changed(size_t extruders_count);
|
||||||
PageShp create_kinematics_page();
|
PageShp build_kinematics_page();
|
||||||
void build_extruder_pages();
|
void build_extruder_pages();
|
||||||
void on_preset_loaded() override;
|
void on_preset_loaded() override;
|
||||||
void init_options_list() override;
|
void init_options_list() override;
|
||||||
|
Loading…
Reference in New Issue
Block a user