Просмотр исходного кода

split external_fill_pattern to top/bottom

remi 7 лет назад
Родитель
Сommit
c9f1574c7d

+ 17 - 9
xs/src/libslic3r/Fill/Fill.cpp

@@ -69,8 +69,9 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
                 if (surface.is_solid() && (!surface.is_bridge() || layerm.layer()->id() == 0)) {
                     group_attrib[i].is_solid = true;
                     group_attrib[i].flow_width = (surface.surface_type == stTop) ? top_solid_infill_flow.width : solid_infill_flow.width;
-                    group_attrib[i].pattern = surface.is_external() ? layerm.region()->config.external_fill_pattern.value : ipRectilinear;
-                }
+					group_attrib[i].pattern = (surface.surface_type == stTop && surface.is_external()) ? layerm.region()->config.top_fill_pattern.value : ipRectilinear;
+					group_attrib[i].pattern = (surface.surface_type == stBottom && surface.is_external()) ? layerm.region()->config.bottom_fill_pattern.value : ipRectilinear;
+				}
             }
             // Loop through solid groups, find compatible groups and append them to this one.
             for (size_t i = 0; i < groups.size(); ++ i) {
@@ -157,13 +158,20 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
         FlowRole role = (surface.surface_type == stTop) ? frTopSolidInfill :
             (surface.is_solid() ? frSolidInfill : frInfill);
         bool is_bridge = layerm.layer()->id() > 0 && surface.is_bridge();
-        
-        if (surface.is_solid()) {
-            density = 100.;
-            fill_pattern = (surface.is_external() && ! is_bridge) ? 
-                layerm.region()->config.external_fill_pattern.value :
-                ipRectilinear;
-        } else if (density <= 0)
+
+		if (surface.is_solid()) {
+			density = 100.;
+			fill_pattern = (surface.is_external() && surface.surface_type == stTop && !is_bridge) ?
+				layerm.region()->config.top_fill_pattern.value :
+				ipRectilinear;
+		}
+		else if (surface.is_solid()) {
+			density = 100.;
+			fill_pattern = (surface.is_external() && surface.surface_type == stBottom && !is_bridge) ?
+				layerm.region()->config.bottom_fill_pattern.value :
+				ipRectilinear;
+		}
+		else if (density <= 0)
             continue;
         
         // get filler object

+ 58 - 30
xs/src/libslic3r/PrintConfig.cpp

@@ -238,26 +238,45 @@ PrintConfigDef::PrintConfigDef()
     def->cli = "ensure-vertical-shell-thickness!";
     def->default_value = new ConfigOptionBool(false);
 
-    def = this->add("external_fill_pattern", coEnum);
-    def->label = "Top/bottom fill pattern";
-    def->category = "Infill";
-    def->tooltip = "Fill pattern for top/bottom infill. This only affects the external visible layer, "
-                   "and not its adjacent solid shells.";
-    def->cli = "external-fill-pattern|solid-fill-pattern=s";
-    def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
-    def->enum_values.push_back("rectilinear");
-    def->enum_values.push_back("concentric");
-    def->enum_values.push_back("hilbertcurve");
-    def->enum_values.push_back("archimedeanchords");
-    def->enum_values.push_back("octagramspiral");
-    def->enum_labels.push_back("Rectilinear");
-    def->enum_labels.push_back("Concentric");
-    def->enum_labels.push_back("Hilbert Curve");
-    def->enum_labels.push_back("Archimedean Chords");
-    def->enum_labels.push_back("Octagram Spiral");
-    // solid_fill_pattern is an obsolete equivalent to external_fill_pattern.
-    def->aliases.push_back("solid_fill_pattern");
-    def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
+	def = this->add("top_fill_pattern", coEnum);
+	def->label = "Top fill pattern";
+	def->category = "Infill";
+	def->tooltip = "Fill pattern for top infill. This only affects the external visible layer, "
+		"and not its adjacent solid shells.";
+	def->cli = "external-fill-pattern|solid-fill-pattern=s";
+	def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
+	def->enum_values.push_back("rectilinear");
+	def->enum_values.push_back("concentric");
+	def->enum_values.push_back("hilbertcurve");
+	def->enum_values.push_back("archimedeanchords");
+	def->enum_values.push_back("octagramspiral");
+	def->enum_labels.push_back("Rectilinear");
+	def->enum_labels.push_back("Concentric");
+	def->enum_labels.push_back("Hilbert Curve");
+	def->enum_labels.push_back("Archimedean Chords");
+	def->enum_labels.push_back("Octagram Spiral");
+	// solid_fill_pattern is an obsolete equivalent to external_fill_pattern (now top_fill_pattern and bottom_fill_pattern).
+	def->aliases.push_back("solid_fill_pattern");
+	def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
+
+	def = this->add("bottom_fill_pattern", coEnum);
+	def->label = "bottom fill pattern";
+	def->category = "Infill";
+	def->tooltip = "Fill pattern for bottom infill. This only affects the external visible layer, "
+		"and not its adjacent solid shells.";
+	def->cli = "external-fill-pattern|solid-fill-pattern=s";
+	def->enum_keys_map = &ConfigOptionEnum<InfillPattern>::get_enum_values();
+	def->enum_values.push_back("rectilinear");
+	def->enum_values.push_back("concentric");
+	def->enum_values.push_back("hilbertcurve");
+	def->enum_values.push_back("archimedeanchords");
+	def->enum_values.push_back("octagramspiral");
+	def->enum_labels.push_back("Rectilinear");
+	def->enum_labels.push_back("Concentric");
+	def->enum_labels.push_back("Hilbert Curve");
+	def->enum_labels.push_back("Archimedean Chords");
+	def->enum_labels.push_back("Octagram Spiral");
+	def->default_value = new ConfigOptionEnum<InfillPattern>(ipRectilinear);
 
     def = this->add("external_perimeter_extrusion_width", coFloatOrPercent);
     def->label = "External perimeters";
@@ -1935,16 +1954,25 @@ std::string FullPrintConfig::validate()
     // --fill-pattern
     if (! print_config_def.get("fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
         return "Invalid value for --fill-pattern";
-    
-    // --external-fill-pattern
-    if (! print_config_def.get("external_fill_pattern")->has_enum_value(this->external_fill_pattern.serialize()))
-        return "Invalid value for --external-fill-pattern";
-
-    // --fill-density
-    if (fabs(this->fill_density.value - 100.) < EPSILON &&
-        ! print_config_def.get("external_fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
-        return "The selected fill pattern is not supposed to work at 100% density";
-    
+
+	// --top-fill-pattern
+	if (!print_config_def.get("top_fill_pattern")->has_enum_value(this->top_fill_pattern.serialize()))
+		return "Invalid value for --top_fill_pattern";
+
+	// --fill-density
+	if (fabs(this->fill_density.value - 100.) < EPSILON &&
+		!print_config_def.get("top_fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
+		return "The selected fill pattern is not supposed to work at 100% density";
+
+	// --bottom-fill-pattern
+	if (!print_config_def.get("bottom_fill_pattern")->has_enum_value(this->bottom_fill_pattern.serialize()))
+		return "Invalid value for --bottom_fill_pattern";
+
+	// --fill-density
+	if (fabs(this->fill_density.value - 100.) < EPSILON &&
+		!print_config_def.get("bottom_fill_pattern")->has_enum_value(this->fill_pattern.serialize()))
+		return "The selected fill pattern is not supposed to work at 100% density";
+
     // --infill-every-layers
     if (this->infill_every_layers < 1)
         return "Invalid value for --infill-every-layers";

+ 6 - 4
xs/src/libslic3r/PrintConfig.hpp

@@ -375,8 +375,9 @@ public:
     ConfigOptionInt                 bottom_solid_layers;
     ConfigOptionFloat               bridge_flow_ratio;
     ConfigOptionFloat               bridge_speed;
-    ConfigOptionBool                ensure_vertical_shell_thickness;
-    ConfigOptionEnum<InfillPattern> external_fill_pattern;
+	ConfigOptionBool                ensure_vertical_shell_thickness;
+	ConfigOptionEnum<InfillPattern> top_fill_pattern;
+	ConfigOptionEnum<InfillPattern> bottom_fill_pattern;
     ConfigOptionFloatOrPercent      external_perimeter_extrusion_width;
     ConfigOptionFloatOrPercent      external_perimeter_speed;
     ConfigOptionBool                external_perimeters_first;
@@ -413,8 +414,9 @@ protected:
         OPT_PTR(bottom_solid_layers);
         OPT_PTR(bridge_flow_ratio);
         OPT_PTR(bridge_speed);
-        OPT_PTR(ensure_vertical_shell_thickness);
-        OPT_PTR(external_fill_pattern);
+		OPT_PTR(ensure_vertical_shell_thickness);
+		OPT_PTR(top_fill_pattern);
+		OPT_PTR(bottom_fill_pattern);
         OPT_PTR(external_perimeter_extrusion_width);
         OPT_PTR(external_perimeter_speed);
         OPT_PTR(external_perimeters_first);

+ 3 - 2
xs/src/libslic3r/PrintObject.cpp

@@ -198,8 +198,9 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
             || opt_key == "bridge_angle") {
             steps.emplace_back(posPrepareInfill);
         } else if (
-               opt_key == "external_fill_pattern"
-            || opt_key == "external_fill_link_max_length"
+               opt_key == "top_fill_pattern"
+			|| opt_key == "bottom_fill_pattern"
+			|| opt_key == "external_fill_link_max_length"
             || opt_key == "fill_angle"
             || opt_key == "fill_pattern"
             || opt_key == "fill_link_max_length"

+ 1 - 1
xs/src/slic3r/GUI/Preset.cpp

@@ -180,7 +180,7 @@ const std::vector<std::string>& Preset::print_options()
     static std::vector<std::string> s_opts {
         "layer_height", "first_layer_height", "perimeters", "spiral_vase", "top_solid_layers", "bottom_solid_layers", 
         "extra_perimeters", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters", "thin_walls", "overhangs", 
-        "seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "external_fill_pattern", 
+		"seam_position", "external_perimeters_first", "fill_density", "fill_pattern", "top_fill_pattern", "bottom_fill_pattern",
         "infill_every_layers", "infill_only_where_needed", "solid_infill_every_layers", "fill_angle", "bridge_angle", 
         "solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first", "max_print_speed", 
         "max_volumetric_speed", "max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",