Implementation of "XY size Compensation for first layer"

https://github.com/prusa3d/Slic3r/issues/190
This commit is contained in:
bubnikv 2017-06-26 16:28:10 +02:00
parent 32fa84c5a5
commit 8160db23cc
5 changed files with 21 additions and 2 deletions

View file

@ -163,6 +163,15 @@ PrintConfigDef::PrintConfigDef()
def->min = 0;
def->default_value = new ConfigOptionFloat(6);
def = this->add("elefant_foot_compensation", coFloat);
def->label = "Elefant foot compensation";
def->category = "Advanced";
def->tooltip = "The first layer will be shrunk in the XY plane by the configured value to compensate for the 1st layer squish aka an Elefant Foot effect.";
def->sidetext = "mm";
def->cli = "elefant-foot-compensation=f";
def->min = 0;
def->default_value = new ConfigOptionFloat(0);
def = this->add("end_gcode", coString);
def->label = "End G-code";
def->tooltip = "This end procedure is inserted at the end of the output file. Note that you can use placeholder variables for all Slic3r settings.";

View file

@ -165,6 +165,7 @@ class PrintObjectConfig : public virtual StaticPrintConfig
public:
ConfigOptionBool clip_multipart_objects;
ConfigOptionBool dont_support_bridges;
ConfigOptionFloat elefant_foot_compensation;
ConfigOptionFloatOrPercent extrusion_width;
ConfigOptionFloatOrPercent first_layer_height;
ConfigOptionBool infill_only_where_needed;
@ -203,6 +204,7 @@ public:
virtual ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) {
OPT_PTR(clip_multipart_objects);
OPT_PTR(dont_support_bridges);
OPT_PTR(elefant_foot_compensation);
OPT_PTR(extrusion_width);
OPT_PTR(first_layer_height);
OPT_PTR(infill_only_where_needed);

View file

@ -160,6 +160,7 @@ bool PrintObject::invalidate_state_by_config_options(const std::vector<t_config_
}
else if (
opt_key == "clip_multipart_objects"
|| opt_key == "elefant_foot_compensation"
|| opt_key == "support_material_contact_distance"
|| opt_key == "xy_size_compensation") {
steps.emplace_back(posSlice);
@ -1164,6 +1165,8 @@ end:
Layer *layer = this->layers[layer_id];
// Apply size compensation and perform clipping of multi-part objects.
float delta = float(scale_(this->config.xy_size_compensation.value));
if (layer_id == 0)
delta -= float(scale_(this->config.elefant_foot_compensation.value));
bool scale = delta != 0.f;
bool clip = this->config.clip_multipart_objects.value || delta > 0.f;
if (layer->regions.size() == 1) {