Skip to content

Commit

Permalink
split interface pattern into top and bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jul 1, 2024
2 parents 512b568 + 8822851 commit 2b8811c
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 40 deletions.
9 changes: 5 additions & 4 deletions resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,17 @@ group:Options for support material and raft
group:Options for support material interface
setting:support_material_interface_layer_height
line:Pattern
setting:support_material_interface_pattern
setting:label$Interface spacing:support_material_interface_spacing
setting:label$Top:support_material_top_interface_pattern
setting:label$Bottom:support_material_bottom_interface_pattern
setting:label$Spacing:support_material_interface_spacing
end_line
line:Pattern Angle
setting:label$_:support_material_interface_angle
setting:label$Increment:support_material_interface_angle_increment
end_line
line:Layer count
setting:support_material_interface_layers
setting:support_material_bottom_interface_layers
setting:label$Top:support_material_interface_layers
setting:label$Bottom:support_material_bottom_interface_layers
end_line
setting:support_material_interface_contact_loops

Expand Down
18 changes: 12 additions & 6 deletions src/libslic3r/Format/BBConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void init()
key_translation_map["sparse_infill_pattern"] = "fill_pattern";
key_translation_map["filename_format"] = "output_filename_format";
key_translation_map["support_base_pattern"] = "support_material_pattern";
key_translation_map["support_interface_pattern"] = "support_material_interface_pattern";
key_translation_map["support_interface_pattern"] = "support_material_top_interface_pattern";
key_translation_map["top_surface_pattern"] = "top_fill_pattern";
key_translation_map["support_object_xy_distance"] = "support_material_xy_spacing";
key_translation_map["fuzzy_skin_point_distance"] = "fuzzy_skin_point_dist";
Expand Down Expand Up @@ -425,7 +425,7 @@ void init()
//key_translation_map["single"]="retract_lift_above";
//key_translation_map["single"]="retract_lift_below";
//key_translation_map["single"]="wipe";
//patern
//pattern
value_translation_map["fill_pattern"]["monotonicline"] = "monotoniclines"; //2.7
value_translation_map["fill_pattern"]["zig-zag"] = "rectilinear";
value_translation_map["fill_pattern"]["tri-hexagon"] = "stars";
Expand All @@ -435,15 +435,17 @@ void init()
value_translation_map["solid_fill_pattern"] = value_translation_map["fill_pattern"];
value_translation_map["brim_ears_pattern"] = value_translation_map["fill_pattern"];
value_translation_map["bridge_fill_pattern"] = value_translation_map["fill_pattern"];
value_translation_map["support_material_interface_pattern"] = value_translation_map["fill_pattern"];
value_translation_map["support_material_top_interface_pattern"] = value_translation_map["fill_pattern"];
value_translation_map["support_material_bottom_interface_pattern"] = value_translation_map["fill_pattern"];
//specific
value_translation_map["fill_pattern"]["default"] = "gyroid";
value_translation_map["top_fill_pattern"]["default"] = "monotonic";
value_translation_map["bottom_fill_pattern"]["default"] = "monotonic";
value_translation_map["solid_fill_pattern"]["default"] = "rectilinear";
value_translation_map["brim_ears_pattern"]["default"] = "concentric";
value_translation_map["bridge_fill_pattern"]["default"] = "rectilinear";
value_translation_map["support_material_interface_pattern"]["default"] = "auto";
value_translation_map["support_material_top_interface_pattern"]["default"] = "auto";
value_translation_map["support_material_bottom_interface_pattern"]["default"] = "auto";
//value_translation_map["support_material_interface_pattern"]["rectilinear_interlaced"] = "???"; //can't convert let the config_substitutions emit the warning

//others
Expand Down Expand Up @@ -508,8 +510,12 @@ void complicated_convert(t_config_option_key &opt_key, std::string &value, const
value = "1";
}
}
if ("enable_overhang_speed") {

//if ("enable_overhang_speed") {
//
//}
if ("support_material_top_interface_pattern" == opt_key || "support_interface_pattern" == opt_key) {
output["support_material_top_interface_pattern"] = value;
output["support_material_bottom_interface_pattern"] = value;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Geometry/MedialAxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3120,7 +3120,7 @@ unsafe_variable_width(const ThickPolyline& polyline, const ExtrusionRole role, c
const coordf_t new_length = prev_line.a.distance_to(line.b);
assert(sum_length - new_length > -0.0000000001);
// only merge if the distance is almost the sum (90° = 0.707)
if(new_length < sum_length * 0.9)
if(new_length < std::max(sum_length * 0.9, std::max(prev_line_len + line_len/2 , prev_line_len /2 + line_len)))
continue;
assert(new_length > prev_line_len && new_length > line_len);
coordf_t width = prev_line_len * (prev_line.a_width + prev_line.b_width) / 2;
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ static std::vector<std::string> s_Preset_print_options {
"support_material_angle",
"support_material_angle_height",
"support_material_interface_layers", "support_material_bottom_interface_layers",
"support_material_interface_pattern",
"support_material_top_interface_pattern",
"support_material_bottom_interface_pattern",
"support_material_interface_angle",
"support_material_interface_angle_increment",
"support_material_interface_spacing",
Expand Down
41 changes: 35 additions & 6 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5766,11 +5766,36 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvancedE | comPrusa;
def->set_default_value(new ConfigOptionEnum<SupportMaterialPattern>(smpRectilinear));

def = this->add("support_material_interface_pattern", coEnum);
def->label = L("Pattern");
def->full_label = L("Support interface pattern");
def = this->add("support_material_bottom_interface_pattern", coEnum);
def->label = L("Bottom Pattern");
def->full_label = L("Support bottom interface pattern");
def->category = OptionCategory::support;
def->tooltip = L("Pattern for the bottom interface layers (the ones that start on the object)."
"\nDefault pattern is the same as the top interface, unless it's Hilbert Curve or Ironing."
"\nNote that 'Hilbert', 'Ironing' , '(filled)' patterns are really discouraged, and meant to be used with soluble supports and 100% fill interface layer.");
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->enum_values.push_back("auto");
def->enum_values.push_back("rectilinear");
def->enum_values.push_back("monotonic");
def->enum_values.push_back("concentric");
def->enum_values.push_back("hilbertcurve");
def->enum_values.push_back("concentricgapfill");
def->enum_values.push_back("smooth");
def->enum_labels.push_back(L("Default"));
def->enum_labels.push_back(L("Rectilinear"));
def->enum_labels.push_back(L("Monotonic"));
def->enum_labels.push_back(L("Concentric"));
def->enum_labels.push_back(L("Hilbert Curve"));
def->enum_labels.push_back(L("Concentric (filled)"));
def->enum_labels.push_back(L("Ironing"));
def->mode = comAdvancedE | comSuSi;
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipAuto));

def = this->add("support_material_top_interface_pattern", coEnum);
def->label = L("Top Pattern");
def->full_label = L("Support top interface pattern");
def->category = OptionCategory::support;
def->tooltip = L("Pattern for interface layers."
def->tooltip = L("Pattern for the top interface layers."
"\nNote that 'Hilbert', 'Ironing' and '(filled)' patterns are meant to be used with soluble supports and 100% fill interface layer.");
def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
def->enum_values.push_back("auto");
Expand All @@ -5791,6 +5816,7 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("Ironing"));
def->mode = comAdvancedE | comPrusa;
def->set_default_value(new ConfigOptionEnum<InfillPattern>(ipRectilinear));
def->aliases = {"support_material_interface_pattern"};

def = this->add("support_material_layer_height", coFloatOrPercent);
def->label = L("Support layer height");
Expand Down Expand Up @@ -7923,7 +7949,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
// some changes has occurs between rectilineargapfill and monotonicgapfill. Set them at the right value for each type
if (value == "rectilineargapfill" && (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern") )
value = "monotonicgapfill";
if (opt_key == "fill_pattern" || opt_key == "support_material_interface_pattern") {
if (opt_key == "fill_pattern" || opt_key == "support_material_interface_pattern" || opt_key == "support_material_top_interface_pattern" || opt_key == "support_material_bottom_interface_pattern") {
if (value == "rectilineargapfill") {
value = "rectilinear";
} else if (value == "monotonicgapfill") {
Expand Down Expand Up @@ -8540,7 +8566,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = {
"support_material_interface_angle_increment",
"support_material_interface_fan_speed",
"support_material_interface_layer_height",
"support_material_interface_pattern",
"support_material_bottom_interface_pattern",
"support_material_layer_height",
"thin_perimeters_all",
"thin_perimeters",
Expand Down Expand Up @@ -8622,6 +8648,9 @@ std::map<std::string, std::string> PrintConfigDef::to_prusa(t_config_option_key&
&& ("fill_pattern" == opt_key || "top_fill_pattern" == opt_key)) {
value = "alignedrectilinear";
}
if ("support_material_top_interface_pattern" == opt_key) {
opt_key = "support_material_interface_pattern";
}
} else if ("seam_position" == opt_key) {
if ("cost" == value) {
value = "nearest";
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/PrintConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloatOrPercent, support_material_contact_distance))
// support_material_bottom_contact_distance (PS 2.4) == support_material_contact_distance_bottom (SuSi 2.3 &-)
((ConfigOptionFloatOrPercent, support_material_bottom_contact_distance))
((ConfigOptionEnum<InfillPattern>, support_material_bottom_interface_pattern))
((ConfigOptionInt, support_material_enforce_layers))
((ConfigOptionInt, support_material_extruder))
((ConfigOptionFloatOrPercent, support_material_extrusion_width))
Expand All @@ -797,7 +798,6 @@ PRINT_CONFIG_CLASS_DEFINE(
// Spacing between interface lines (the hatching distance). Set zero to get a solid interface.
((ConfigOptionFloat, support_material_interface_spacing))
((ConfigOptionFloatOrPercent, support_material_interface_speed))
((ConfigOptionEnum<InfillPattern>, support_material_interface_pattern))
((ConfigOptionEnum<SupportMaterialPattern>, support_material_pattern))
// Morphological closing of support areas. Only used for "sung" supports.
((ConfigOptionFloat, support_material_closing_radius))
Expand All @@ -809,6 +809,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, support_material_synchronize_layers))
// Overhang angle threshold.
((ConfigOptionInt, support_material_threshold))
((ConfigOptionEnum<InfillPattern>, support_material_top_interface_pattern))
((ConfigOptionBool, support_material_with_sheath))
((ConfigOptionFloatOrPercent, support_material_xy_spacing))
((ConfigOptionBool, thin_walls_merge))
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/PrintObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -838,14 +838,15 @@ FillLightning::GeneratorPtr PrintObject::prepare_lightning_infill_data()
|| opt_key == "support_material_extrusion_width"
|| opt_key == "support_material_interface_layers"
|| opt_key == "support_material_bottom_interface_layers"
|| opt_key == "support_material_bottom_interface_pattern"
|| opt_key == "support_material_interface_angle"
|| opt_key == "support_material_interface_angle_increment"
|| opt_key == "support_material_interface_contact_loops"
|| opt_key == "support_material_interface_extruder"
|| opt_key == "support_material_interface_pattern"
|| opt_key == "support_material_interface_spacing"
|| opt_key == "support_material_pattern"
|| opt_key == "support_material_style"
|| opt_key == "support_material_top_interface_pattern"
|| opt_key == "support_material_xy_spacing"
|| opt_key == "support_material_spacing"
|| opt_key == "support_material_closing_radius"
Expand Down
40 changes: 27 additions & 13 deletions src/libslic3r/SupportMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,14 +427,26 @@ PrintObjectSupportMaterial::PrintObjectSupportMaterial(const PrintObject *object
support_pattern == smpHoneycomb ? ipHoneycomb :
m_support_params.support_density > 0.95 || m_support_params.with_sheath ? ipRectilinear : ipSupportBase;
m_support_params.interface_fill_pattern = (m_support_params.interface_density > 0.95 ? ipRectilinear : ipSupportBase);
m_support_params.contact_fill_pattern = m_object_config->support_material_interface_pattern;
if (m_support_params.contact_fill_pattern == ipAuto)
m_support_params.contact_top_fill_pattern = m_object_config->support_material_top_interface_pattern;
m_support_params.contact_bottom_fill_pattern = m_object_config->support_material_bottom_interface_pattern;
if (m_support_params.contact_top_fill_pattern == ipAuto)
if (m_slicing_params->soluble_interface)
m_support_params.contact_fill_pattern = ipConcentric;
m_support_params.contact_top_fill_pattern = ipConcentric;
else if (m_support_params.interface_density > 0.95)
m_support_params.contact_fill_pattern = ipRectilinear;
m_support_params.contact_top_fill_pattern = ipRectilinear;
else
m_support_params.contact_fill_pattern = ipSupportBase;
m_support_params.contact_top_fill_pattern = ipSupportBase;
if (m_support_params.contact_bottom_fill_pattern == ipAuto)
if(m_support_params.contact_top_fill_pattern != ipHilbertCurve
&& m_support_params.contact_top_fill_pattern != ipSmooth
&& m_support_params.contact_top_fill_pattern != ipSawtooth)
m_support_params.contact_bottom_fill_pattern = m_support_params.contact_top_fill_pattern;
else if (m_slicing_params->soluble_interface)
m_support_params.contact_bottom_fill_pattern = ipConcentric;
else if (m_support_params.interface_density > 0.95)
m_support_params.contact_bottom_fill_pattern = ipRectilinear;
else
m_support_params.contact_bottom_fill_pattern = ipSupportBase;
}

// Using the std::deque as an allocator.
Expand Down Expand Up @@ -4167,16 +4179,16 @@ void PrintObjectSupportMaterial::generate_toolpaths(
SupportLayer &support_layer = *support_layers[support_layer_id];
assert(support_layer.support_fills.entities().empty());
MyLayer &raft_layer = *raft_layers[support_layer_id];

std::unique_ptr<Fill> filler_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.contact_fill_pattern)); //m_support_params.interface_fill_pattern)); FIXME choose
std::unique_ptr<Fill> filler_support = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.base_fill_pattern));
std::unique_ptr<Fill> filler_top_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.contact_top_fill_pattern));
std::unique_ptr<Fill> filler_support = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.base_fill_pattern));
std::unique_ptr<FillWithPerimeter> filler_support_with_sheath = std::make_unique<FillWithPerimeter>((Fill::new_from_type(m_support_params.base_fill_pattern)));
filler_support_with_sheath->overlap = m_support_params.gap_xy == 0 ? 0 : 1; // allow periemter overlap is not touching perimeters
filler_support_with_sheath->ratio_fill_inside = 0.2f;
std::unique_ptr<FillWithPerimeter> filler_dense = std::make_unique<FillWithPerimeter>((Fill::new_from_type(ipRectilinear)));
filler_dense->overlap = m_support_params.gap_xy == 0 ? 0 : 1;
filler_dense->ratio_fill_inside = 0.2f;
filler_interface->set_bounding_box(bbox_object);
filler_top_interface->set_bounding_box(bbox_object);
filler_support->set_bounding_box(bbox_object);

// Print the support base below the support columns, or the support base for the support columns plus the contacts.
Expand Down Expand Up @@ -4207,7 +4219,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
}
}

Fill *filler = filler_interface.get();
Fill *filler = filler_top_interface.get();
Flow flow = m_support_params.first_layer_flow;
float density = 0.f;
double spacing = 0.f;
Expand Down Expand Up @@ -4283,7 +4295,8 @@ 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);
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_top_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.contact_top_fill_pattern));
std::unique_ptr<Fill> filler_bottom_interface = std::unique_ptr<Fill>(Fill::new_from_type(m_support_params.contact_bottom_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).
std::unique_ptr<Fill> filler_base_interface = std::unique_ptr<Fill>(base_interface_layers.empty() ? nullptr :
Expand All @@ -4296,7 +4309,8 @@ void PrintObjectSupportMaterial::generate_toolpaths(
} else {
filler_support.reset(Fill::new_from_type(m_support_params.base_fill_pattern));
}
filler_interface->set_bounding_box(bbox_object);
filler_top_interface->set_bounding_box(bbox_object);
filler_bottom_interface->set_bounding_box(bbox_object);
filler_intermediate_interface->set_bounding_box(bbox_object);
if (range.begin() == 0)
filler_first_layer_ptr->set_bounding_box(bbox_object);
Expand Down Expand Up @@ -4399,7 +4413,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
Flow interface_flow = layer_ex.layer->bridging ?
Flow::bridging_flow(layer_ex.layer->height, m_support_params.support_material_bottom_interface_flow.nozzle_diameter()) :
(interface_as_base ? &m_support_params.support_material_flow : &m_support_params.support_material_interface_flow)->with_height(float(layer_ex.layer->height));
Fill *filler = i == 2 ? filler_intermediate_interface.get() : filler_interface.get();
Fill *filler = (i == 0) ? filler_top_interface.get() : (i == 1 ? filler_bottom_interface.get() : filler_intermediate_interface.get());
//filler->layer_id = support_layer_id; // don't do that, or the filler will rotate thigns from that layerid
filler->z = support_layer.print_z;
float supp_density = m_support_params.interface_density;
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/SupportMaterial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ class PrintObjectSupportMaterial

InfillPattern base_fill_pattern;
InfillPattern interface_fill_pattern;
InfillPattern contact_fill_pattern;
InfillPattern contact_top_fill_pattern;
InfillPattern contact_bottom_fill_pattern;
bool with_sheath;
};

Expand Down
Loading

0 comments on commit 2b8811c

Please sign in to comment.