Added min_layer_height, max_layer_height per nozzle settings

for controlling the support layer height & variable layer height.
Added an experimental "rear" seam option.
This commit is contained in:
bubnikv 2017-02-07 18:46:02 +01:00
parent 64c752ff9d
commit 957803e60c
4 changed files with 64 additions and 19 deletions

View file

@ -1402,7 +1402,7 @@ sub _extruders_count_changed {
$self->_on_value_change('extruders_count', $extruders_count); $self->_on_value_change('extruders_count', $extruders_count);
} }
sub _extruder_options { qw(nozzle_diameter extruder_offset retract_length retract_lift retract_lift_above retract_lift_below retract_speed retract_restart_extra retract_before_travel wipe sub _extruder_options { qw(nozzle_diameter min_layer_height max_layer_height extruder_offset retract_length retract_lift retract_lift_above retract_lift_below retract_speed retract_restart_extra retract_before_travel wipe
retract_layer_change retract_length_toolchange retract_restart_extra_toolchange) } retract_layer_change retract_length_toolchange retract_restart_extra_toolchange) }
sub _build_extruder_pages { sub _build_extruder_pages {
@ -1431,6 +1431,11 @@ sub _build_extruder_pages {
my $optgroup = $page->new_optgroup('Size'); my $optgroup = $page->new_optgroup('Size');
$optgroup->append_single_option_line('nozzle_diameter', $extruder_idx); $optgroup->append_single_option_line('nozzle_diameter', $extruder_idx);
} }
{
my $optgroup = $page->new_optgroup('Limits');
$optgroup->append_single_option_line($_, $extruder_idx)
for qw(min_layer_height max_layer_height);
}
{ {
my $optgroup = $page->new_optgroup('Position (for multi-extruder printers)'); my $optgroup = $page->new_optgroup('Position (for multi-extruder printers)');
$optgroup->append_single_option_line('extruder_offset', $extruder_idx); $optgroup->append_single_option_line('extruder_offset', $extruder_idx);

View file

@ -565,31 +565,42 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
bool was_clockwise = loop.make_counter_clockwise(); bool was_clockwise = loop.make_counter_clockwise();
SeamPosition seam_position = this->config.seam_position; SeamPosition seam_position = this->config.seam_position;
if (loop.role == elrSkirt) seam_position = spNearest; if (loop.role == elrSkirt)
seam_position = spNearest;
// find the point of the loop that is closest to the current extruder position // find the point of the loop that is closest to the current extruder position
// or randomize if requested // or randomize if requested
Point last_pos = this->last_pos(); Point last_pos = this->last_pos();
if (this->config.spiral_vase) { if (this->config.spiral_vase) {
loop.split_at(last_pos, false); loop.split_at(last_pos, false);
} else if (seam_position == spNearest || seam_position == spAligned) { } else if (seam_position == spNearest || seam_position == spAligned || seam_position == spRear) {
Polygon polygon = loop.polygon(); Polygon polygon = loop.polygon();
const coordf_t nozzle_dmr = EXTRUDER_CONFIG(nozzle_diameter); const coordf_t nozzle_dmr = EXTRUDER_CONFIG(nozzle_diameter);
const coord_t nozzle_r = scale_(0.5*nozzle_dmr); const coord_t nozzle_r = scale_(0.5*nozzle_dmr);
// Retrieve the last start position for this object. // Retrieve the last start position for this object.
float last_pos_weight = 1.f; float last_pos_weight = 1.f;
if (seam_position == spAligned && this->layer != NULL && this->_seam_position.count(this->layer->object()) > 0) { switch (seam_position) {
last_pos = this->_seam_position[this->layer->object()]; case spAligned:
// Seam is aligned to the seam at the preceding layer.
if (this->layer != NULL && this->_seam_position.count(this->layer->object()) > 0) {
last_pos = this->_seam_position[this->layer->object()];
last_pos_weight = 5.f;
}
break;
case spRear:
last_pos = this->layer->object()->bounding_box().center();
last_pos.y += coord_t(3. * this->layer->object()->bounding_box().radius());
last_pos_weight = 5.f; last_pos_weight = 5.f;
break;
} }
// Insert a projection of last_pos into the polygon. // Insert a projection of last_pos into the polygon.
size_t last_pos_proj_idx; size_t last_pos_proj_idx;
{ {
Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r); Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r);
last_pos_proj_idx = it - polygon.points.begin(); last_pos_proj_idx = it - polygon.points.begin();
} }
Point last_pos_proj = polygon.points[last_pos_proj_idx]; Point last_pos_proj = polygon.points[last_pos_proj_idx];
// Parametrize the polygon by its length. // Parametrize the polygon by its length.
std::vector<float> lengths = polygon_parameter_by_length(polygon); std::vector<float> lengths = polygon_parameter_by_length(polygon);
@ -661,8 +672,8 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
{ {
static int iRun = 0; static int iRun = 0;
SVG svg(debug_out_path("GCode_extrude_loop-%d.svg", iRun ++)); SVG svg(debug_out_path("GCode_extrude_loop-%d.svg", iRun ++));
if (this->layer->lower_layer != NULL) if (this->layer->lower_layer != NULL)
svg.draw(this->layer->lower_layer->slices.expolygons); svg.draw(this->layer->lower_layer->slices.expolygons);
for (size_t i = 0; i < loop.paths.size(); ++ i) for (size_t i = 0; i < loop.paths.size(); ++ i)
svg.draw(loop.paths[i].as_polyline(), "red"); svg.draw(loop.paths[i].as_polyline(), "red");
Polylines polylines; Polylines polylines;
@ -673,9 +684,9 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
coord_t delta = scale_(0.5*nozzle_dmr); coord_t delta = scale_(0.5*nozzle_dmr);
Slic3r::offset(polylines, &polygons, delta); Slic3r::offset(polylines, &polygons, delta);
// for (size_t i = 0; i < polygons.size(); ++ i) svg.draw((Polyline)polygons[i], "blue"); // for (size_t i = 0; i < polygons.size(); ++ i) svg.draw((Polyline)polygons[i], "blue");
svg.draw(last_pos, "green", 3); svg.draw(last_pos, "green", 3);
svg.draw(polygon.points[idx_min], "yellow", 3); svg.draw(polygon.points[idx_min], "yellow", 3);
svg.Close(); svg.Close();
} }
#endif #endif
@ -696,6 +707,7 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
last_pos = Point(polygon.bounding_box().max.x, centroid.y); last_pos = Point(polygon.bounding_box().max.x, centroid.y);
last_pos.rotate(fmod((float)rand()/16.0, 2.0*PI), centroid); last_pos.rotate(fmod((float)rand()/16.0, 2.0*PI), centroid);
} }
// Find the closest point, avoid overhangs.
loop.split_at(last_pos, true); loop.split_at(last_pos, true);
} }

View file

@ -618,6 +618,18 @@ PrintConfigDef::PrintConfigDef()
def->max = 100; def->max = 100;
def->default_value = new ConfigOptionInt(100); def->default_value = new ConfigOptionInt(100);
def = this->add("max_layer_height", coFloats);
def->label = "Max";
def->tooltip = "This is the highest printable layer height for this extruder, used to cap the variable layer height and support layer height. Maximum recommended layer height is 75% of the extrusion width to achieve reasonable inter-layer adhesion. If set to 0, layer height is limited to 75% of the nozzle diameter.";
def->sidetext = "mm";
def->cli = "max-layer-height=f@";
def->min = 0;
{
ConfigOptionFloats* opt = new ConfigOptionFloats();
opt->values.push_back(0);
def->default_value = opt;
}
def = this->add("max_print_speed", coFloat); def = this->add("max_print_speed", coFloat);
def->label = "Max print speed"; def->label = "Max print speed";
def->tooltip = "When setting other speed settings to 0 Slic3r will autocalculate the optimal speed in order to keep constant extruder pressure. This experimental setting is used to set the highest print speed you want to allow."; def->tooltip = "When setting other speed settings to 0 Slic3r will autocalculate the optimal speed in order to keep constant extruder pressure. This experimental setting is used to set the highest print speed you want to allow.";
@ -661,6 +673,18 @@ PrintConfigDef::PrintConfigDef()
def->max = 100; def->max = 100;
def->default_value = new ConfigOptionInt(35); def->default_value = new ConfigOptionInt(35);
def = this->add("min_layer_height", coFloats);
def->label = "Min";
def->tooltip = "This is the lowest printable layer height for this extruder and limits the resolution for variable layer height. Typical values are between 0.05 mm and 0.1 mm.";
def->sidetext = "mm";
def->cli = "min-layer-height=f@";
def->min = 0;
{
ConfigOptionFloats* opt = new ConfigOptionFloats();
opt->values.push_back(0.07);
def->default_value = opt;
}
def = this->add("min_print_speed", coFloat); def = this->add("min_print_speed", coFloat);
def->label = "Min print speed"; def->label = "Min print speed";
def->tooltip = "Slic3r will not scale speed down below this speed."; def->tooltip = "Slic3r will not scale speed down below this speed.";
@ -942,11 +966,11 @@ PrintConfigDef::PrintConfigDef()
def->enum_values.push_back("random"); def->enum_values.push_back("random");
def->enum_values.push_back("nearest"); def->enum_values.push_back("nearest");
def->enum_values.push_back("aligned"); def->enum_values.push_back("aligned");
// def->enum_values.push_back("preferred"); def->enum_values.push_back("rear");
def->enum_labels.push_back("Random"); def->enum_labels.push_back("Random");
def->enum_labels.push_back("Nearest"); def->enum_labels.push_back("Nearest");
def->enum_labels.push_back("Aligned"); def->enum_labels.push_back("Aligned");
// def->enum_labels.push_back("Preferred Direction"); def->enum_labels.push_back("Rear");
def->default_value = new ConfigOptionEnum<SeamPosition>(spAligned); def->default_value = new ConfigOptionEnum<SeamPosition>(spAligned);
#if 0 #if 0

View file

@ -39,7 +39,7 @@ enum SupportMaterialPattern {
}; };
enum SeamPosition { enum SeamPosition {
spRandom, spNearest, spAligned //, spPreferred spRandom, spNearest, spAligned, spRear
}; };
template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() { template<> inline t_config_enum_values ConfigOptionEnum<GCodeFlavor>::get_enum_values() {
@ -85,7 +85,7 @@ template<> inline t_config_enum_values ConfigOptionEnum<SeamPosition>::get_enum_
keys_map["random"] = spRandom; keys_map["random"] = spRandom;
keys_map["nearest"] = spNearest; keys_map["nearest"] = spNearest;
keys_map["aligned"] = spAligned; keys_map["aligned"] = spAligned;
// keys_map["preferred"] = spPreferred; keys_map["rear"] = spRear;
return keys_map; return keys_map;
} }
@ -404,7 +404,9 @@ class PrintConfig : public GCodeConfig
ConfigOptionFloat infill_acceleration; ConfigOptionFloat infill_acceleration;
ConfigOptionBool infill_first; ConfigOptionBool infill_first;
ConfigOptionInt max_fan_speed; ConfigOptionInt max_fan_speed;
ConfigOptionFloats max_layer_height;
ConfigOptionInt min_fan_speed; ConfigOptionInt min_fan_speed;
ConfigOptionFloats min_layer_height;
ConfigOptionFloat min_print_speed; ConfigOptionFloat min_print_speed;
ConfigOptionFloat min_skirt_length; ConfigOptionFloat min_skirt_length;
ConfigOptionString notes; ConfigOptionString notes;
@ -461,7 +463,9 @@ class PrintConfig : public GCodeConfig
OPT_PTR(infill_acceleration); OPT_PTR(infill_acceleration);
OPT_PTR(infill_first); OPT_PTR(infill_first);
OPT_PTR(max_fan_speed); OPT_PTR(max_fan_speed);
OPT_PTR(max_layer_height);
OPT_PTR(min_fan_speed); OPT_PTR(min_fan_speed);
OPT_PTR(min_layer_height);
OPT_PTR(min_print_speed); OPT_PTR(min_print_speed);
OPT_PTR(min_skirt_length); OPT_PTR(min_skirt_length);
OPT_PTR(notes); OPT_PTR(notes);