mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-13 05:01:47 +08:00
Add recommended_extrusion_width explanation.
This commit is contained in:
parent
20a8d2f709
commit
8e9810ea0e
@ -238,6 +238,7 @@ group:Extrusion width
|
||||
setting:top_infill_extrusion_width
|
||||
setting:support_material_extrusion_width
|
||||
setting:skirt_extrusion_width
|
||||
recommended_extrusion_width_description
|
||||
group:Overlap
|
||||
line:Perimeter overlap
|
||||
setting:label$External:external_perimeter_overlap
|
||||
|
@ -294,53 +294,81 @@ std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle &preset_bundle)
|
||||
std::string PresetHints::recommended_thin_wall_thickness(const PresetBundle& preset_bundle)
|
||||
{
|
||||
const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config;
|
||||
const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config;
|
||||
const DynamicPrintConfig& print_config = preset_bundle.prints.get_edited_preset().config;
|
||||
const DynamicPrintConfig& printer_config = preset_bundle.printers.get_edited_preset().config;
|
||||
|
||||
float layer_height = float(print_config.opt_float("layer_height"));
|
||||
int num_perimeters = print_config.opt_int("perimeters");
|
||||
bool thin_walls = print_config.opt_bool("thin_walls");
|
||||
float nozzle_diameter = float(printer_config.opt_float("nozzle_diameter", 0));
|
||||
|
||||
float layer_height = float(print_config.opt_float("layer_height"));
|
||||
int num_perimeters = print_config.opt_int("perimeters");
|
||||
bool thin_walls = print_config.opt_bool("thin_walls");
|
||||
float nozzle_diameter = float(printer_config.opt_float("nozzle_diameter", 0));
|
||||
|
||||
std::string out;
|
||||
if (layer_height <= 0.f) {
|
||||
out += _utf8(L("Recommended object min thin wall thickness: Not available due to invalid layer height."));
|
||||
return out;
|
||||
}
|
||||
if (layer_height <= 0.f) {
|
||||
out += _utf8(L("Recommended object min thin wall thickness: Not available due to invalid layer height."));
|
||||
return out;
|
||||
}
|
||||
|
||||
Flow external_perimeter_flow = Flow::new_from_config_width(
|
||||
frExternalPerimeter,
|
||||
*print_config.opt<ConfigOptionFloatOrPercent>("external_perimeter_extrusion_width"),
|
||||
Flow external_perimeter_flow = Flow::new_from_config_width(
|
||||
frExternalPerimeter,
|
||||
*print_config.opt<ConfigOptionFloatOrPercent>("external_perimeter_extrusion_width"),
|
||||
nozzle_diameter, layer_height, false);
|
||||
Flow perimeter_flow = Flow::new_from_config_width(
|
||||
frPerimeter,
|
||||
*print_config.opt<ConfigOptionFloatOrPercent>("perimeter_extrusion_width"),
|
||||
Flow perimeter_flow = Flow::new_from_config_width(
|
||||
frPerimeter,
|
||||
*print_config.opt<ConfigOptionFloatOrPercent>("perimeter_extrusion_width"),
|
||||
nozzle_diameter, layer_height, false);
|
||||
|
||||
//set spacing
|
||||
external_perimeter_flow.spacing_ratio = print_config.opt<ConfigOptionPercent>("external_perimeter_overlap")->get_abs_value(1);
|
||||
perimeter_flow.spacing_ratio = print_config.opt<ConfigOptionPercent>("perimeter_overlap")->get_abs_value(1);
|
||||
|
||||
|
||||
if (num_perimeters > 0) {
|
||||
int num_lines = std::min(num_perimeters, 6);
|
||||
out += (boost::format(_utf8(L("Recommended object min (thick) wall thickness for layer height %.2f and"))) % layer_height).str() + " ";
|
||||
out += (boost::format(_utf8(L("%d perimeter: %.2f mm"))) % 1 % (external_perimeter_flow.width + external_perimeter_flow.spacing())).str() + " ";
|
||||
// Start with the width of two closely spaced
|
||||
try {
|
||||
double width = 2*(external_perimeter_flow.width + external_perimeter_flow.spacing(perimeter_flow));
|
||||
for (int i = 2; i <= num_lines; thin_walls ? ++ i : i ++) {
|
||||
out += ", " + (boost::format(_utf8(L("%d perimeter: %.2f mm"))) % i % width).str() + " ";
|
||||
double width = 2 * (external_perimeter_flow.width + external_perimeter_flow.spacing(perimeter_flow));
|
||||
for (int i = 2; i <= num_lines; thin_walls ? ++i : i++) {
|
||||
out += ", " + (boost::format(_utf8(L("%d perimeter: %.2f mm"))) % i % width).str() + " ";
|
||||
width += perimeter_flow.spacing() * 2;
|
||||
}
|
||||
} catch (const FlowErrorNegativeSpacing &) {
|
||||
}
|
||||
catch (const FlowErrorNegativeSpacing&) {
|
||||
out = _utf8(L("Recommended object thin wall thickness: Not available due to excessively small extrusion width."));
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string PresetHints::recommended_extrusion_width(const PresetBundle& preset_bundle)
|
||||
{
|
||||
const DynamicPrintConfig& print_config = preset_bundle.prints.get_edited_preset().config;
|
||||
const DynamicPrintConfig& printer_config = preset_bundle.printers.get_edited_preset().config;
|
||||
|
||||
int nb_nozzles = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
|
||||
double nozzle_diameter = 0;
|
||||
for(int i=0; i< nb_nozzles; i++)
|
||||
nozzle_diameter = std::max(nozzle_diameter, printer_config.opt_float("nozzle_diameter", i));
|
||||
double layer_height = print_config.opt_float("layer_height");
|
||||
double first_layer_height = print_config.option<ConfigOptionFloatOrPercent>("first_layer_height")->get_abs_value(nozzle_diameter);
|
||||
|
||||
std::string out;
|
||||
|
||||
Flow first_layer_flow = Flow::new_from_spacing(nozzle_diameter, nozzle_diameter, first_layer_height, false);
|
||||
Flow layer_flow = Flow::new_from_spacing(nozzle_diameter, nozzle_diameter, layer_height, false);
|
||||
|
||||
out += _utf8(L("Ideally, the spacing between two extrusions shouldn't be lower than the nozzle diameter. Below are the extrusion widths for a spacing equal to the nozzle diameter.\n"));
|
||||
out += (boost::format(_utf8(L("Recommended min extrusion width for the first layer (with a first layer height of %1%) is %2$.3f mm (or %3%%%)\n")))
|
||||
% first_layer_height % first_layer_flow.width % int(first_layer_flow.width * 100. / nozzle_diameter)).str();
|
||||
out += (boost::format(_utf8(L("Recommended min extrusion width for other layers (with a layer height of %1%) is %2$.3f mm (or %3%%%).\n")))
|
||||
% layer_height % layer_flow.width % int(layer_flow.width * 100. / nozzle_diameter)).str();
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
// Produce a textual explanation of the combined effects of the top/bottom_solid_layers
|
||||
// versus top/bottom_min_shell_thickness. Which of the two values wins depends
|
||||
|
@ -22,12 +22,16 @@ public:
|
||||
|
||||
// Produce a textual description of a recommended thin wall thickness
|
||||
// from the provided number of perimeters and the external / internal perimeter width.
|
||||
static std::string recommended_thin_wall_thickness(const PresetBundle &preset_bundle);
|
||||
static std::string recommended_thin_wall_thickness(const PresetBundle& preset_bundle);
|
||||
|
||||
// Produce a textual description of a recommended extrusion width
|
||||
// from the provided layer height
|
||||
static std::string recommended_extrusion_width(const PresetBundle& preset_bundle);
|
||||
|
||||
// Produce a textual explanation of the combined effects of the top/bottom_solid_layers
|
||||
// versus top/bottom_min_shell_thickness. Which of the two values wins depends
|
||||
// on the active layer height.
|
||||
static std::string top_bottom_shell_thickness_explanation(const PresetBundle &preset_bundle);
|
||||
static std::string top_bottom_shell_thickness_explanation(const PresetBundle& preset_bundle);
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -1499,6 +1499,16 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page)
|
||||
};
|
||||
current_group->append_line(current_line);
|
||||
}
|
||||
else if (boost::starts_with(full_line, "recommended_extrusion_width_description")) {
|
||||
TabPrint* tab = nullptr;
|
||||
if ((tab = dynamic_cast<TabPrint*>(this)) == nullptr) continue;
|
||||
current_line = { "", "" };
|
||||
current_line.full_width = 1;
|
||||
current_line.widget = [this, tab](wxWindow* parent) {
|
||||
return description_line_widget(parent, &(tab->m_recommended_extrusion_width_description_line));
|
||||
};
|
||||
current_group->append_line(current_line);
|
||||
}
|
||||
else if (boost::starts_with(full_line, "top_bottom_shell_thickness_explanation")) {
|
||||
TabPrint* tab = nullptr;
|
||||
if ((tab = dynamic_cast<TabPrint*>(this)) == nullptr) continue;
|
||||
@ -1706,6 +1716,9 @@ void TabPrint::update()
|
||||
if (m_recommended_thin_wall_thickness_description_line)
|
||||
m_recommended_thin_wall_thickness_description_line->SetText(
|
||||
from_u8(PresetHints::recommended_thin_wall_thickness(*m_preset_bundle)));
|
||||
if (m_recommended_extrusion_width_description_line)
|
||||
m_recommended_extrusion_width_description_line->SetText(
|
||||
from_u8(PresetHints::recommended_extrusion_width(*m_preset_bundle)));
|
||||
if(m_top_bottom_shell_thickness_explanation)
|
||||
m_top_bottom_shell_thickness_explanation->SetText(
|
||||
from_u8(PresetHints::top_bottom_shell_thickness_explanation(*m_preset_bundle)));
|
||||
@ -1731,6 +1744,9 @@ void TabPrint::OnActivate()
|
||||
if (m_recommended_thin_wall_thickness_description_line)
|
||||
m_recommended_thin_wall_thickness_description_line->SetText(
|
||||
from_u8(PresetHints::recommended_thin_wall_thickness(*m_preset_bundle)));
|
||||
if (m_recommended_extrusion_width_description_line)
|
||||
m_recommended_extrusion_width_description_line->SetText(
|
||||
from_u8(PresetHints::recommended_extrusion_width(*m_preset_bundle)));
|
||||
if(m_top_bottom_shell_thickness_explanation)
|
||||
m_top_bottom_shell_thickness_explanation->SetText(
|
||||
from_u8(PresetHints::top_bottom_shell_thickness_explanation(*m_preset_bundle)));
|
||||
|
@ -336,8 +336,9 @@ public:
|
||||
// Tab(parent, _(L("Print Settings")), L("print")) {}
|
||||
Tab(parent, _(L("Print Settings")), Slic3r::Preset::TYPE_PRINT) {}
|
||||
~TabPrint() {}
|
||||
|
||||
|
||||
ogStaticText* m_recommended_thin_wall_thickness_description_line = nullptr;
|
||||
ogStaticText* m_recommended_extrusion_width_description_line = nullptr;
|
||||
ogStaticText* m_top_bottom_shell_thickness_explanation = nullptr;
|
||||
bool m_support_material_overhangs_queried = false;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user