mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:15:53 +08:00
Add "Enforcers only" option into support combo box
And also make it work
This commit is contained in:
parent
3a7af1c1de
commit
7b207aaf5c
@ -502,6 +502,7 @@ static std::vector<std::string> s_Preset_sla_print_options {
|
|||||||
"support_max_bridges_on_pillar",
|
"support_max_bridges_on_pillar",
|
||||||
"support_pillar_connection_mode",
|
"support_pillar_connection_mode",
|
||||||
"support_buildplate_only",
|
"support_buildplate_only",
|
||||||
|
"support_enforcers_only",
|
||||||
"support_pillar_widening_factor",
|
"support_pillar_widening_factor",
|
||||||
"support_base_diameter",
|
"support_base_diameter",
|
||||||
"support_base_height",
|
"support_base_height",
|
||||||
|
@ -3661,6 +3661,13 @@ void PrintConfigDef::init_sla_params()
|
|||||||
def->mode = comSimple;
|
def->mode = comSimple;
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
|
def = this->add("support_enforcers_only", coBool);
|
||||||
|
def->label = L("Support only in enforced regions");
|
||||||
|
def->category = L("Supports");
|
||||||
|
def->tooltip = L("Only create support if it lies in a support enforcer.");
|
||||||
|
def->mode = comSimple;
|
||||||
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("support_pillar_widening_factor", coFloat);
|
def = this->add("support_pillar_widening_factor", coFloat);
|
||||||
def->label = L("Pillar widening factor");
|
def->label = L("Pillar widening factor");
|
||||||
def->category = L("Supports");
|
def->category = L("Supports");
|
||||||
|
@ -858,6 +858,9 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||||||
// Generate only ground facing supports
|
// Generate only ground facing supports
|
||||||
((ConfigOptionBool, support_buildplate_only))
|
((ConfigOptionBool, support_buildplate_only))
|
||||||
|
|
||||||
|
// Generate only ground facing supports
|
||||||
|
((ConfigOptionBool, support_enforcers_only))
|
||||||
|
|
||||||
// TODO: unimplemented at the moment. This coefficient will have an impact
|
// TODO: unimplemented at the moment. This coefficient will have an impact
|
||||||
// when bridges and pillars are merged. The resulting pillar should be a bit
|
// when bridges and pillars are merged. The resulting pillar should be a bit
|
||||||
// thicker than the ones merging into it. How much thicker? I don't know
|
// thicker than the ones merging into it. How much thicker? I don't know
|
||||||
|
@ -827,6 +827,7 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
|||||||
steps.emplace_back(slaposObjectSlice);
|
steps.emplace_back(slaposObjectSlice);
|
||||||
} else if (
|
} else if (
|
||||||
opt_key == "support_points_density_relative"
|
opt_key == "support_points_density_relative"
|
||||||
|
|| opt_key == "support_enforcers_only"
|
||||||
|| opt_key == "support_points_minimal_distance") {
|
|| opt_key == "support_points_minimal_distance") {
|
||||||
steps.emplace_back(slaposSupportPoints);
|
steps.emplace_back(slaposSupportPoints);
|
||||||
} else if (
|
} else if (
|
||||||
|
@ -404,10 +404,15 @@ void SLAPrint::Steps::slice_model(SLAPrintObject &po)
|
|||||||
// report_status(-2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
|
// report_status(-2, "", SlicingStatus::RELOAD_SLA_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void filter_support_points_by_modifiers(
|
|
||||||
sla::SupportPoints &pts,
|
struct SuppPtMask {
|
||||||
const std::vector<ExPolygons> &blockers,
|
const std::vector<ExPolygons> &blockers;
|
||||||
const std::vector<ExPolygons> &enforcers,
|
const std::vector<ExPolygons> &enforcers;
|
||||||
|
bool enforcers_only = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void filter_support_points_by_modifiers(sla::SupportPoints &pts,
|
||||||
|
const SuppPtMask &mask,
|
||||||
const std::vector<float> &slice_grid)
|
const std::vector<float> &slice_grid)
|
||||||
{
|
{
|
||||||
assert((blockers.empty() || blockers.size() == slice_grid.size()) &&
|
assert((blockers.empty() || blockers.size() == slice_grid.size()) &&
|
||||||
@ -423,23 +428,29 @@ static void filter_support_points_by_modifiers(
|
|||||||
if (it != slice_grid.end()) {
|
if (it != slice_grid.end()) {
|
||||||
size_t idx = std::distance(slice_grid.begin(), it);
|
size_t idx = std::distance(slice_grid.begin(), it);
|
||||||
bool is_enforced = false;
|
bool is_enforced = false;
|
||||||
if (idx < enforcers.size()) {
|
if (idx < mask.enforcers.size()) {
|
||||||
for (size_t enf_idx = 0;
|
for (size_t enf_idx = 0;
|
||||||
!is_enforced && enf_idx < enforcers[idx].size();
|
!is_enforced && enf_idx < mask.enforcers[idx].size();
|
||||||
++enf_idx)
|
++enf_idx)
|
||||||
{
|
{
|
||||||
if (enforcers[idx][enf_idx].contains(sp2d))
|
if (mask.enforcers[idx][enf_idx].contains(sp2d))
|
||||||
is_enforced = true;
|
is_enforced = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_blocked = false;
|
bool is_blocked = false;
|
||||||
if (!is_enforced && idx < blockers.size()) {
|
if (!is_enforced) {
|
||||||
|
if (!mask.enforcers_only) {
|
||||||
|
if (idx < mask.blockers.size()) {
|
||||||
for (size_t blk_idx = 0;
|
for (size_t blk_idx = 0;
|
||||||
!is_blocked && blk_idx < blockers[idx].size();
|
!is_blocked && blk_idx < mask.blockers[idx].size();
|
||||||
++blk_idx)
|
++blk_idx)
|
||||||
{
|
{
|
||||||
if (blockers[idx][blk_idx].contains(sp2d))
|
if (mask.blockers[idx][blk_idx].contains(sp2d))
|
||||||
|
is_blocked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
is_blocked = true;
|
is_blocked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -527,7 +538,8 @@ void SLAPrint::Steps::support_points(SLAPrintObject &po)
|
|||||||
return vol->is_support_enforcer();
|
return vol->is_support_enforcer();
|
||||||
});
|
});
|
||||||
|
|
||||||
filter_support_points_by_modifiers(points, blockers, enforcers, po.m_model_height_levels);
|
SuppPtMask mask{blockers, enforcers, po.config().support_enforcers_only.getBool()};
|
||||||
|
filter_support_points_by_modifiers(points, mask, po.m_model_height_levels);
|
||||||
|
|
||||||
po.m_supportdata->input.pts = points;
|
po.m_supportdata->input.pts = points;
|
||||||
|
|
||||||
|
@ -374,6 +374,7 @@ void ConfigManipulation::toggle_print_sla_options(DynamicPrintConfig* config)
|
|||||||
toggle_field("support_pillar_connection_mode", supports_en && is_default_tree);
|
toggle_field("support_pillar_connection_mode", supports_en && is_default_tree);
|
||||||
toggle_field("support_tree_type", supports_en);
|
toggle_field("support_tree_type", supports_en);
|
||||||
toggle_field("support_buildplate_only", supports_en);
|
toggle_field("support_buildplate_only", supports_en);
|
||||||
|
toggle_field("support_enforcers_only", supports_en);
|
||||||
toggle_field("support_base_diameter", supports_en);
|
toggle_field("support_base_diameter", supports_en);
|
||||||
toggle_field("support_base_height", supports_en);
|
toggle_field("support_base_height", supports_en);
|
||||||
toggle_field("support_base_safety_distance", supports_en);
|
toggle_field("support_base_safety_distance", supports_en);
|
||||||
|
@ -545,10 +545,15 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
|
|||||||
const bool supports_enable = selection == _("None") ? false : true;
|
const bool supports_enable = selection == _("None") ? false : true;
|
||||||
new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable));
|
new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable));
|
||||||
|
|
||||||
|
new_conf.set_key_value("support_enforcers_only", new ConfigOptionBool(false));
|
||||||
|
|
||||||
if (selection == _("Everywhere"))
|
if (selection == _("Everywhere"))
|
||||||
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false));
|
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false));
|
||||||
else if (selection == _("Support on build plate only"))
|
else if (selection == _("Support on build plate only"))
|
||||||
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true));
|
new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true));
|
||||||
|
else if (selection == _("For support enforcers only")) {
|
||||||
|
new_conf.set_key_value("support_enforcers_only", new ConfigOptionBool(true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tab->load_config(new_conf);
|
tab->load_config(new_conf);
|
||||||
@ -559,8 +564,6 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent) :
|
|||||||
|
|
||||||
ConfigOptionDef support_def_sla = support_def;
|
ConfigOptionDef support_def_sla = support_def;
|
||||||
support_def_sla.set_default_value(new ConfigOptionStrings{ "None" });
|
support_def_sla.set_default_value(new ConfigOptionStrings{ "None" });
|
||||||
assert(support_def_sla.enum_labels[2] == L("For support enforcers only"));
|
|
||||||
support_def_sla.enum_labels.erase(support_def_sla.enum_labels.begin() + 2);
|
|
||||||
option = Option(support_def_sla, "support");
|
option = Option(support_def_sla, "support");
|
||||||
option.opt.full_width = true;
|
option.opt.full_width = true;
|
||||||
line.append_option(option);
|
line.append_option(option);
|
||||||
|
@ -4777,6 +4777,7 @@ void TabSLAPrint::build()
|
|||||||
|
|
||||||
optgroup->append_single_option_line("support_pillar_connection_mode");
|
optgroup->append_single_option_line("support_pillar_connection_mode");
|
||||||
optgroup->append_single_option_line("support_buildplate_only");
|
optgroup->append_single_option_line("support_buildplate_only");
|
||||||
|
optgroup->append_single_option_line("support_enforcers_only");
|
||||||
optgroup->append_single_option_line("support_pillar_widening_factor");
|
optgroup->append_single_option_line("support_pillar_widening_factor");
|
||||||
optgroup->append_single_option_line("support_base_diameter");
|
optgroup->append_single_option_line("support_base_diameter");
|
||||||
optgroup->append_single_option_line("support_base_height");
|
optgroup->append_single_option_line("support_base_height");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user