Skip to content

Commit

Permalink
Update to acceleration: move to object/region & cleaning alongside it.
Browse files Browse the repository at this point in the history
 * fix all step invalidation incoherence
 * rename bridge_internal_* settings to internal_bridge (like orca)
 * reorder entries when they weren't sorted by alphanumeric order.
  • Loading branch information
supermerill committed Jun 13, 2024
1 parent 5120285 commit fb4cc66
Show file tree
Hide file tree
Showing 13 changed files with 276 additions and 213 deletions.
42 changes: 32 additions & 10 deletions src/libslic3r/Fill/Fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ struct SurfaceFillParams : FillParams
assert(this->config != nullptr);
assert(rhs.config != nullptr);
if (config != nullptr && rhs.config != nullptr) {
RETURN_COMPARE_NON_EQUAL(config->infill_acceleration);
RETURN_COMPARE_NON_EQUAL(config->infill_speed);
RETURN_COMPARE_NON_EQUAL(config->solid_infill_acceleration);
RETURN_COMPARE_NON_EQUAL(config->solid_infill_speed);
RETURN_COMPARE_NON_EQUAL(config->top_solid_infill_acceleration);
RETURN_COMPARE_NON_EQUAL(config->top_solid_infill_speed);
RETURN_COMPARE_NON_EQUAL(config->ironing_speed);
RETURN_COMPARE_NON_EQUAL(config->default_acceleration);
RETURN_COMPARE_NON_EQUAL(config->default_speed);
RETURN_COMPARE_NON_EQUAL(config->bridge_acceleration);
RETURN_COMPARE_NON_EQUAL(config->bridge_speed);
RETURN_COMPARE_NON_EQUAL(config->bridge_speed_internal);
RETURN_COMPARE_NON_EQUAL(config->internal_bridge_acceleration);
RETURN_COMPARE_NON_EQUAL(config->internal_bridge_speed);
RETURN_COMPARE_NON_EQUAL(config->gap_fill_acceleration);
RETURN_COMPARE_NON_EQUAL(config->gap_fill_speed);
RETURN_COMPARE_NON_EQUAL(config->print_extrusion_multiplier);
RETURN_COMPARE_NON_EQUAL(config->region_gcode.value);
Expand All @@ -93,14 +99,23 @@ struct SurfaceFillParams : FillParams
if ((config != nullptr) != (rhs.config != nullptr))
return false;
if(config != nullptr && (
config->infill_speed != rhs.config->infill_speed
config->infill_acceleration != rhs.config->infill_acceleration
|| config->infill_speed != rhs.config->infill_speed
|| config->solid_infill_acceleration != rhs.config->solid_infill_acceleration
|| config->solid_infill_speed != rhs.config->solid_infill_speed
|| config->top_solid_infill_acceleration != rhs.config->top_solid_infill_acceleration
|| config->top_solid_infill_speed != rhs.config->top_solid_infill_speed
|| config->ironing_speed != rhs.config->ironing_speed
|| config->default_acceleration != rhs.config->default_acceleration
|| config->default_speed != rhs.config->default_speed
|| config->bridge_acceleration != rhs.config->bridge_acceleration
|| config->bridge_speed != rhs.config->bridge_speed
|| config->bridge_speed_internal != rhs.config->bridge_speed_internal
|| config->gap_fill_speed != rhs.config->gap_fill_speed))
|| config->internal_bridge_acceleration != rhs.config->internal_bridge_acceleration
|| config->internal_bridge_speed != rhs.config->internal_bridge_speed
|| config->gap_fill_acceleration != rhs.config->gap_fill_acceleration
|| config->gap_fill_speed != rhs.config->gap_fill_speed
|| config->print_extrusion_multiplier != rhs.config->print_extrusion_multiplier
|| config->region_gcode != rhs.config->region_gcode
))
return false;
// then check params
return this->extruder == rhs.extruder &&
Expand Down Expand Up @@ -786,6 +801,7 @@ void Layer::make_ironing()
double line_spacing;
// Height of the extrusion, to calculate the extrusion flow from.
double height;
double acceleration;
double speed;
double angle;
IroningType type;
Expand All @@ -807,6 +823,10 @@ void Layer::make_ironing()
return true;
if (this->height > rhs.height)
return false;
if (this->acceleration < rhs.acceleration)
return true;
if (this->acceleration > rhs.acceleration)
return false;
if (this->speed < rhs.speed)
return true;
if (this->speed > rhs.speed)
Expand All @@ -818,11 +838,12 @@ void Layer::make_ironing()
return false;
}

bool operator==(const IroningParams &rhs) const {
bool operator==(const IroningParams &rhs) const
{
return this->extruder == rhs.extruder && this->just_infill == rhs.just_infill &&
this->line_spacing == rhs.line_spacing && this->height == rhs.height && this->speed == rhs.speed &&
this->angle == rhs.angle &&
this->type == rhs.type;
this->line_spacing == rhs.line_spacing && this->height == rhs.height &&
this->acceleration == rhs.acceleration && this->speed == rhs.speed &&
this->angle == rhs.angle && this->type == rhs.type;
}

LayerRegion *layerm = nullptr;
Expand Down Expand Up @@ -869,6 +890,7 @@ void Layer::make_ironing()
ironing_params.just_infill = false;
ironing_params.line_spacing = config.ironing_spacing;
ironing_params.height = default_layer_height * 0.01 * config.ironing_flowrate;
ironing_params.acceleration = config.ironing_acceleration;
ironing_params.speed = config.ironing_speed;
if (config.ironing_angle.value >= 0) {
ironing_params.angle = float(Geometry::deg2rad(config.ironing_angle.value));
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/Format/BBConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void init()
//key_translation_map["bridge_angle"] = "bridge_angle";
key_translation_map["bridge_density"] = "bridge_overlap_min";
key_translation_map["bridge_no_support"] = "dont_support_bridges";
key_translation_map["internal_bridge_speed"] = "bridge_speed_internal";
//key_translation_map["internal_bridge_speed"] = "internal_bridge_speed";
//key_translation_map["brim_ears"] = "brim_ears";
//key_translation_map["brim_ears_detection_length"] = "brim_ears_detection_length";
//key_translation_map["brim_ears_max_angle"] = "brim_ears_max_angle";
Expand Down
18 changes: 9 additions & 9 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ namespace DoExport {
excluded.insert(erTopSolidInfill);
if (config->option("bridge_speed") != nullptr && config->get_computed_value("bridge_speed") != 0)
excluded.insert(erBridgeInfill);
if (config->option("bridge_speed_internal") != nullptr && config->get_computed_value("bridge_speed_internal") != 0)
if (config->option("internal_bridge_speed") != nullptr && config->get_computed_value("internal_bridge_speed") != 0)
excluded.insert(erInternalBridgeInfill);
if (config->option("support_material_speed") != nullptr && config->get_computed_value("support_material_speed") != 0)
excluded.insert(erSupportMaterial);
Expand Down Expand Up @@ -5827,8 +5827,8 @@ double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath &path, double spee
speed = m_config.get_computed_value("bridge_speed");
if(comment) *comment = "bridge_speed";
} else if (path.role() == erInternalBridgeInfill) {
speed = m_config.get_computed_value("bridge_speed_internal");
if(comment) *comment = "bridge_speed_internal";
speed = m_config.get_computed_value("internal_bridge_speed");
if(comment) *comment = "internal_bridge_speed";
} else if (path.role() == erOverhangPerimeter) {
speed = m_config.get_computed_value("overhangs_speed");
if(comment) *comment = "overhangs_speed";
Expand Down Expand Up @@ -5906,8 +5906,8 @@ double_t GCode::_compute_speed_mm_per_sec(const ExtrusionPath &path, double spee
speed = m_config.bridge_speed.get_abs_value(vol_speed);
if(comment) *comment = std::string("bridge_speed ") + *comment;
} else if (path.role() == erInternalBridgeInfill) {
speed = m_config.bridge_speed_internal.get_abs_value(vol_speed);
if(comment) *comment = std::string("bridge_speed_internal ") + *comment;
speed = m_config.internal_bridge_speed.get_abs_value(vol_speed);
if(comment) *comment = std::string("internal_bridge_speed ") + *comment;
} else if (path.role() == erOverhangPerimeter) {
speed = m_config.overhangs_speed.get_abs_value(vol_speed);
if(comment) *comment = std::string("overhangs_speed ") + *comment;
Expand Down Expand Up @@ -6150,10 +6150,10 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string
}
break;
case erInternalBridgeInfill:
if (m_config.bridge_internal_acceleration.value > 0) {
double bridge_internal_acceleration = m_config.get_computed_value("bridge_internal_acceleration");
if (bridge_internal_acceleration > 0) {
acceleration = bridge_internal_acceleration;
if (m_config.internal_bridge_acceleration.value > 0) {
double internal_bridge_acceleration = m_config.get_computed_value("internal_bridge_acceleration");
if (internal_bridge_acceleration > 0) {
acceleration = internal_bridge_acceleration;
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCode/CoolingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
}
//set the fan controls
default_fan_speed[ExtrusionRole::erBridgeInfill] = EXTRUDER_CONFIG(bridge_fan_speed);
default_fan_speed[ExtrusionRole::erInternalBridgeInfill] = EXTRUDER_CONFIG(bridge_internal_fan_speed);
default_fan_speed[ExtrusionRole::erInternalBridgeInfill] = EXTRUDER_CONFIG(internal_bridge_fan_speed);
default_fan_speed[ExtrusionRole::erTopSolidInfill] = EXTRUDER_CONFIG(top_fan_speed);
default_fan_speed[ExtrusionRole::erIroning] = default_fan_speed[ExtrusionRole::erTopSolidInfill];
default_fan_speed[ExtrusionRole::erSupportMaterialInterface] = EXTRUDER_CONFIG(support_material_interface_fan_speed);
Expand Down Expand Up @@ -984,7 +984,7 @@ std::string CoolingBuffer::apply_layer_cooldown(
fan_speeds[ExtrusionRole::erBridgeInfill] = fan_speeds[0];
}

// if bridge_internal_fan is disabled, it takes the value of bridge_fan
// if internal_bridge_fan is disabled, it takes the value of bridge_fan
if (!fan_control[ExtrusionRole::erInternalBridgeInfill] && fan_control[ExtrusionRole::erBridgeInfill]) {
fan_control[ExtrusionRole::erInternalBridgeInfill] = true;
fan_speeds[ExtrusionRole::erInternalBridgeInfill] = fan_speeds[ExtrusionRole::erBridgeInfill];
Expand Down
7 changes: 6 additions & 1 deletion src/libslic3r/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ void Layer::make_perimeters()
/// if you don't do that, objects will share the same region, and the same settings.
if (config.perimeter_extruder == other_config.perimeter_extruder
&& config.perimeters == other_config.perimeters
&& config.external_perimeter_acceleration == other_config.external_perimeter_acceleration
&& config.external_perimeter_extrusion_width == other_config.external_perimeter_extrusion_width
&& config.external_perimeter_overlap == other_config.external_perimeter_overlap
&& config.external_perimeter_speed == other_config.external_perimeter_speed // it os mandatory? can't this be set at gcode.cpp?
Expand All @@ -182,6 +183,7 @@ void Layer::make_perimeters()
&& config.extra_perimeters_overhangs == other_config.extra_perimeters_overhangs
&& config.gap_fill_enabled == other_config.gap_fill_enabled
&& ((config.gap_fill_speed == other_config.gap_fill_speed) || !config.gap_fill_enabled)
&& config.gap_fill_acceleration == other_config.gap_fill_acceleration
&& config.gap_fill_last == other_config.gap_fill_last
&& config.gap_fill_flow_match_perimeter == other_config.gap_fill_flow_match_perimeter
&& config.gap_fill_extension == other_config.gap_fill_extension
Expand All @@ -196,10 +198,12 @@ void Layer::make_perimeters()
&& (this->id() == 0 || config.only_one_perimeter_first_layer == other_config.only_one_perimeter_first_layer)
&& config.only_one_perimeter_top == other_config.only_one_perimeter_top
&& config.only_one_perimeter_top_other_algo == other_config.only_one_perimeter_top_other_algo
&& config.overhangs_acceleration == other_config.overhangs_acceleration
&& config.overhangs_width_speed == other_config.overhangs_width_speed
&& config.overhangs_width == other_config.overhangs_width
&& config.overhangs_reverse == other_config.overhangs_reverse
&& config.overhangs_reverse_threshold == other_config.overhangs_reverse_threshold
&& config.perimeter_acceleration == other_config.perimeter_acceleration
&& config.perimeter_extrusion_width == other_config.perimeter_extrusion_width
&& config.perimeter_loop == other_config.perimeter_loop
&& config.perimeter_loop_seam == other_config.perimeter_loop_seam
Expand All @@ -211,11 +215,12 @@ void Layer::make_perimeters()
&& config.small_perimeter_min_length == other_config.small_perimeter_min_length
&& config.small_perimeter_max_length == other_config.small_perimeter_max_length
&& config.thin_walls == other_config.thin_walls
&& config.thin_walls_acceleration == other_config.thin_walls_acceleration
&& config.thin_walls_min_width == other_config.thin_walls_min_width
&& config.thin_walls_overlap == other_config.thin_walls_overlap
&& config.thin_walls_speed == other_config.thin_walls_speed
&& config.thin_perimeters == other_config.thin_perimeters
&& config.thin_perimeters_all == other_config.thin_perimeters_all
&& config.thin_walls_speed == other_config.thin_walls_speed
&& config.infill_overlap == other_config.infill_overlap
&& config.perimeter_loop == other_config.perimeter_loop
&& config.region_gcode == other_config.region_gcode
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/Preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ static std::vector<std::string> s_Preset_print_options {
// speeds
"default_speed",
"bridge_speed",
"bridge_speed_internal",
"internal_bridge_speed",
"brim_speed",
"external_perimeter_speed",
"first_layer_speed",
Expand Down Expand Up @@ -568,14 +568,14 @@ static std::vector<std::string> s_Preset_print_options {
"fuzzy_skin_thickness",
// acceleration
"bridge_acceleration",
"bridge_internal_acceleration",
"brim_acceleration",
"default_acceleration",
"external_perimeter_acceleration",
"first_layer_acceleration",
"first_layer_acceleration_over_raft",
"gap_fill_acceleration",
"infill_acceleration",
"internal_bridge_acceleration",
"ironing_acceleration",
"overhangs_acceleration",
"perimeter_acceleration",
Expand Down Expand Up @@ -770,10 +770,10 @@ static std::vector<std::string> s_Preset_filament_options {
"default_fan_speed",
"max_fan_speed",
"bridge_fan_speed",
"bridge_internal_fan_speed",
"external_perimeter_fan_speed",
"gap_fill_fan_speed",
"infill_fan_speed",
"internal_bridge_fan_speed",
"overhangs_fan_speed",
"perimeter_fan_speed",
"solid_infill_fan_speed",
Expand Down
Loading

0 comments on commit fb4cc66

Please sign in to comment.