Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/xs
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-02-07 20:46:02 +0300
committerbubnikv <bubnikv@gmail.com>2017-02-07 20:46:02 +0300
commit957803e60c74584991efdaa90ed72bbeb651ed3e (patch)
tree7dc7aa22a16502ec25a0e7421627310a3751ed0f /xs
parent64c752ff9dda67f240fddec5abe886ebdb631d1b (diff)
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.
Diffstat (limited to 'xs')
-rw-r--r--xs/src/libslic3r/GCode.cpp40
-rw-r--r--xs/src/libslic3r/PrintConfig.cpp28
-rw-r--r--xs/src/libslic3r/PrintConfig.hpp8
3 files changed, 58 insertions, 18 deletions
diff --git a/xs/src/libslic3r/GCode.cpp b/xs/src/libslic3r/GCode.cpp
index 6f3d3296f..2aeb7fc60 100644
--- a/xs/src/libslic3r/GCode.cpp
+++ b/xs/src/libslic3r/GCode.cpp
@@ -565,31 +565,42 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
bool was_clockwise = loop.make_counter_clockwise();
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
// or randomize if requested
Point last_pos = this->last_pos();
if (this->config.spiral_vase) {
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();
const coordf_t nozzle_dmr = EXTRUDER_CONFIG(nozzle_diameter);
const coord_t nozzle_r = scale_(0.5*nozzle_dmr);
// Retrieve the last start position for this object.
float last_pos_weight = 1.f;
- if (seam_position == spAligned && this->layer != NULL && this->_seam_position.count(this->layer->object()) > 0) {
- last_pos = this->_seam_position[this->layer->object()];
+ switch (seam_position) {
+ 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;
+ break;
}
// Insert a projection of last_pos into the polygon.
- size_t last_pos_proj_idx;
- {
- Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r);
- last_pos_proj_idx = it - polygon.points.begin();
- }
+ size_t last_pos_proj_idx;
+ {
+ Points::iterator it = project_point_to_polygon_and_insert(polygon, last_pos, 0.1 * nozzle_r);
+ last_pos_proj_idx = it - polygon.points.begin();
+ }
Point last_pos_proj = polygon.points[last_pos_proj_idx];
// Parametrize the polygon by its length.
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;
SVG svg(debug_out_path("GCode_extrude_loop-%d.svg", iRun ++));
- if (this->layer->lower_layer != NULL)
- svg.draw(this->layer->lower_layer->slices.expolygons);
+ if (this->layer->lower_layer != NULL)
+ svg.draw(this->layer->lower_layer->slices.expolygons);
for (size_t i = 0; i < loop.paths.size(); ++ i)
svg.draw(loop.paths[i].as_polyline(), "red");
Polylines polylines;
@@ -673,9 +684,9 @@ GCode::extrude(ExtrusionLoop loop, std::string description, double speed)
coord_t delta = scale_(0.5*nozzle_dmr);
Slic3r::offset(polylines, &polygons, delta);
// for (size_t i = 0; i < polygons.size(); ++ i) svg.draw((Polyline)polygons[i], "blue");
- svg.draw(last_pos, "green", 3);
- svg.draw(polygon.points[idx_min], "yellow", 3);
- svg.Close();
+ svg.draw(last_pos, "green", 3);
+ svg.draw(polygon.points[idx_min], "yellow", 3);
+ svg.Close();
}
#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.rotate(fmod((float)rand()/16.0, 2.0*PI), centroid);
}
+ // Find the closest point, avoid overhangs.
loop.split_at(last_pos, true);
}
diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp
index 9b4a0e7e4..9a8915db0 100644
--- a/xs/src/libslic3r/PrintConfig.cpp
+++ b/xs/src/libslic3r/PrintConfig.cpp
@@ -618,6 +618,18 @@ PrintConfigDef::PrintConfigDef()
def->max = 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->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.";
@@ -661,6 +673,18 @@ PrintConfigDef::PrintConfigDef()
def->max = 100;
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->label = "Min print 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("nearest");
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("Nearest");
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);
#if 0
diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp
index c8933bcd9..53a211f5d 100644
--- a/xs/src/libslic3r/PrintConfig.hpp
+++ b/xs/src/libslic3r/PrintConfig.hpp
@@ -39,7 +39,7 @@ enum SupportMaterialPattern {
};
enum SeamPosition {
- spRandom, spNearest, spAligned //, spPreferred
+ spRandom, spNearest, spAligned, spRear
};
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["nearest"] = spNearest;
keys_map["aligned"] = spAligned;
-// keys_map["preferred"] = spPreferred;
+ keys_map["rear"] = spRear;
return keys_map;
}
@@ -404,7 +404,9 @@ class PrintConfig : public GCodeConfig
ConfigOptionFloat infill_acceleration;
ConfigOptionBool infill_first;
ConfigOptionInt max_fan_speed;
+ ConfigOptionFloats max_layer_height;
ConfigOptionInt min_fan_speed;
+ ConfigOptionFloats min_layer_height;
ConfigOptionFloat min_print_speed;
ConfigOptionFloat min_skirt_length;
ConfigOptionString notes;
@@ -461,7 +463,9 @@ class PrintConfig : public GCodeConfig
OPT_PTR(infill_acceleration);
OPT_PTR(infill_first);
OPT_PTR(max_fan_speed);
+ OPT_PTR(max_layer_height);
OPT_PTR(min_fan_speed);
+ OPT_PTR(min_layer_height);
OPT_PTR(min_print_speed);
OPT_PTR(min_skirt_length);
OPT_PTR(notes);