Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed May 15, 2024
2 parents fb42e44 + dac85c2 commit 126843f
Show file tree
Hide file tree
Showing 18 changed files with 212 additions and 158 deletions.
7 changes: 4 additions & 3 deletions resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,14 @@ group:label_width$8:sidetext_width$7:Speed for print moves
setting:width$4:bridge_speed_internal
setting:width$4:overhangs_speed
line:Gap fill speed
setting:width$4:label$maximum speed:gap_fill_speed
setting:width$4:label$Maximum speed:gap_fill_speed
setting:width$4:label$Cap with:sidetext$% of perimeter flow:sidetext_width$20:gap_fill_flow_match_perimeter
line:Other speed
setting:width$4:thin_walls_speed
setting:width$4:ironing_speed
setting:wipe_tower_speed
setting:wipe_tower_wipe_starting_speed
line:Wipe tower
setting:width$4:label$Main speed:wipe_tower_speed
setting:width$4:label$Wipe starting speed:wipe_tower_wipe_starting_speed
group:Speed for non-print moves
line:Travel speed
setting:label$xy:travel_speed
Expand Down
4 changes: 3 additions & 1 deletion src/libslic3r/Fill/Fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,8 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:

//adjust the bridge density
if (surface_fill.params.flow.bridge() && surface_fill.params.density > 0.99 /*&& layerm->region()->config().bridge_overlap.get_abs_value(1) != 1*/) {
// bridge have their own spacing, don't try to align it with normal infill.
surface_fill.params.max_sparse_infill_spacing = 0;
////varies the overlap to have the best coverage for the bridge
//surface_fill.params.density *= float(layerm->region()->config().bridge_overlap.get_abs_value(1));
double min_spacing = 0.999 * surface_fill.params.spacing / surface_fill.params.config->bridge_overlap.get_abs_value(surface_fill.params.density);
Expand Down Expand Up @@ -716,7 +718,7 @@ void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive:
double area = unscaled(unscaled(real_surface));
assert(compute_volume.volume <= area * surface_fill.params.layer_height * 1.001 || f->debug_verify_flow_mult <= 0.8);
if(compute_volume.volume > 0) //can fail for thin regions
assert(compute_volume.volume >= area * surface_fill.params.layer_height * 0.999 || f->debug_verify_flow_mult >= 1.3
assert(compute_volume.volume >= area * surface_fill.params.layer_height * 0.999 || f->debug_verify_flow_mult >= 1.3 || f->debug_verify_flow_mult == 0 // sawtooth output more filament,as it's 3D (debug_verify_flow_mult==0)
|| area < std::max(1.,surface_fill.params.config->solid_infill_below_area.value) || area < std::max(1.,surface_fill.params.config->solid_infill_below_layer_area.value));
}
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/libslic3r/Format/3mf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1899,15 +1899,15 @@ namespace Slic3r {
} else if (m_curr_metadata_name == SLIC3RPE_FDM_SUPPORTS_PAINTING_VERSION) {
m_fdm_supports_painting_version = (unsigned int) atoi(m_curr_characters.c_str());
check_painting_version(m_fdm_supports_painting_version, FDM_SUPPORTS_PAINTING_VERSION,
_(L("The selected 3MF contains FDM supports painted object using a newer version of PrusaSlicer and is not compatible.")));
_(L("The selected 3MF contains FDM supports painted object using a newer version of the slicer and is not compatible.")));
} else if (m_curr_metadata_name == SLIC3RPE_SEAM_PAINTING_VERSION) {
m_seam_painting_version = (unsigned int) atoi(m_curr_characters.c_str());
check_painting_version(m_seam_painting_version, SEAM_PAINTING_VERSION,
_(L("The selected 3MF contains seam painted object using a newer version of PrusaSlicer and is not compatible.")));
_(L("The selected 3MF contains seam painted object using a newer version of the slicer and is not compatible.")));
} else if (m_curr_metadata_name == SLIC3RPE_MM_PAINTING_VERSION) {
m_mm_painting_version = (unsigned int) atoi(m_curr_characters.c_str());
check_painting_version(m_mm_painting_version, MM_PAINTING_VERSION,
_(L("The selected 3MF contains multi-material painted object using a newer version of PrusaSlicer and is not compatible.")));
_(L("The selected 3MF contains multi-material painted object using a newer version of the slicer and is not compatible.")));
}

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4843,8 +4843,8 @@ void GCode::add_wipe_points(const std::vector<THING>& paths) {
break; // Do not perform a wipe on bridges.

assert(it->polyline.size() >= 2);
assert(m_wipe.path.points.back() == it->last_point());
if (m_wipe.path.points.back() != it->last_point())
assert(m_wipe.path.points.back().coincides_with_epsilon(it->last_point()));
if (!m_wipe.path.points.back().coincides_with_epsilon(it->last_point()))
break; // ExtrusionMultiPath is interrupted in some place.

m_wipe.path.points.insert(m_wipe.path.points.end(), it->polyline.get_points().rbegin() + 1, it->polyline.get_points().rend());
Expand Down
12 changes: 6 additions & 6 deletions src/libslic3r/GCode/FanMover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ void FanMover::_put_in_middle_G1(std::list<BufferData>::iterator item_to_split,
}
}

void FanMover::_print_in_middle_G1(BufferData& line_to_split, float nb_sec, const std::string &line_to_write) {
if (nb_sec < line_to_split.time * 0.1) {
void FanMover::_print_in_middle_G1(BufferData& line_to_split, float nb_sec_from_item_start, const std::string &line_to_write) {
if (nb_sec_from_item_start > line_to_split.time * 0.9 && line_to_split.time < this->nb_seconds_delay / 4) {
// doesn't really need to be split, print it after
m_process_output += line_to_split.raw + "\n";
m_process_output += line_to_write + (line_to_write.back() == '\n'?"":"\n");
} else if (nb_sec > line_to_split.time * 0.9) {
} else if (nb_sec_from_item_start < line_to_split.time * 0.1 && line_to_split.time < this->nb_seconds_delay / 4) {
// doesn't really need to be split, print it before
//will also print before if line_to_split.time == 0
m_process_output += line_to_write + (line_to_write.back() == '\n' ? "" : "\n");
m_process_output += line_to_split.raw + "\n";
}else if(line_to_split.raw.size() > 2
&& line_to_split.raw[0] == 'G' && line_to_split.raw[1] == '1' && line_to_split.raw[2] == ' ') {
float percent = nb_sec / line_to_split.time;
float percent = nb_sec_from_item_start / line_to_split.time;
std::string before = line_to_split.raw;
std::string& after = line_to_split.raw;
if (line_to_split.dx != 0) {
Expand Down Expand Up @@ -379,7 +379,7 @@ void FanMover::_process_gcode_line(GCodeReader& reader, const GCodeReader::GCode
_print_in_middle_G1(m_buffer.front(), m_buffer_time_size - nb_seconds_delay, _set_fan(100));//m_writer.set_fan(100, true)); //FIXME extruder id (or use the gcode writer, but then you have to disable the multi-thread thing
remove_from_buffer(m_buffer.begin());
} else {
m_process_output += _set_fan(100);//m_writer.set_fan(100, true)); //FIXME extruder id (or use the gcode writer, but then you have to disable the multi-thread thing
m_process_output += _set_fan(100) + "\n";//m_writer.set_fan(100, true)); //FIXME extruder id (or use the gcode writer, but then you have to disable the multi-thread thing
}
//write it in the queue if possible
const float kickstart_duration = kickstart * float(fan_speed - m_front_buffer_fan_speed) / 100.f;
Expand Down Expand Up @@ -443,7 +443,7 @@ void FanMover::_process_gcode_line(GCodeReader& reader, const GCodeReader::GCode
put_in_buffer(BufferData(_set_fan(100)//m_writer.set_fan(100, true)); //FIXME extruder id (or use the gcode writer, but then you have to disable the multi-thread thing
, 0, fan_speed, true));
//kickstart!
//m_process_output += m_writer.set_fan(100, true);
//m_process_output += m_writer.set_fan(100, true) + "\n";
//add the normal speed line for the future
m_current_kickstart.fan_speed = fan_speed;
m_current_kickstart.time = kickstart_duration;
Expand Down
17 changes: 10 additions & 7 deletions src/libslic3r/GCode/SeamPlacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,8 @@ struct SeamComparator {
}

//avoid overhangs
if (a.overhang > 0.0f || b.overhang > 0.0f) {
if ((a.overhang > a.perimeter.flow_width / 4 && b.overhang == 0.0f) ||
(b.overhang > b.perimeter.flow_width / 4 && a.overhang == 0.0f)) {
return a.overhang < b.overhang;
}

Expand All @@ -881,11 +882,11 @@ struct SeamComparator {
}

// the penalites are kept close to range [0-1.x] however, it should not be relied upon
float penalty_a = a.overhang
float penalty_a = 2 * a.overhang / a.perimeter.flow_width
+ visibility_importance * a.visibility
+ angle_importance * compute_angle_penalty(a.local_ccw_angle)
+ travel_importance * distance_penalty_a;
float penalty_b = b.overhang
float penalty_b = 2 * b.overhang / b.perimeter.flow_width
+ visibility_importance * b.visibility
+ angle_importance * compute_angle_penalty(b.local_ccw_angle)
+ travel_importance * distance_penalty_b;
Expand Down Expand Up @@ -1220,10 +1221,12 @@ void SeamPlacer::calculate_overhangs_and_layer_embedding(const PrintObject *po)
for (SeamCandidate &perimeter_point : layers[layer_idx].points) {
Vec2f point = Vec2f { perimeter_point.position.head<2>() };
if (prev_layer_distancer.get() != nullptr) {
perimeter_point.overhang = prev_layer_distancer->distance_from_perimeter(point)
+ 0.6f * perimeter_point.perimeter.flow_width
- tan(SeamPlacer::overhang_angle_threshold)
* po->layers()[layer_idx]->height;
perimeter_point.overhang = prev_layer_distancer->distance_from_perimeter(point);

//perimeter_point.overhang = perimeter_point.overhang + 0.6f * perimeter_point.perimeter.flow_width
// - tan(SeamPlacer::overhang_angle_threshold)
// * po->layers()[layer_idx]->height;

perimeter_point.overhang =
perimeter_point.overhang < 0.0f ? 0.0f : perimeter_point.overhang;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCode/WipeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1267,8 +1267,8 @@ void WipeTower::toolchange_Wipe(
if (this->m_config->filament_max_speed.get_at(this->m_current_tool) > 0) {
max_speed = float(this->m_config->filament_max_speed.get_at(this->m_current_tool));
}
const float target_speed = std::min(max_speed, (is_first_layer() ? m_first_layer_speed : m_speed) * 60.f);
float wipe_speed = std::min(max_speed, std::min(target_speed, float(m_config->wipe_tower_wipe_starting_speed.get_abs_value(target_speed))));
const float target_speed = std::min(max_speed, (is_first_layer() ? m_first_layer_speed : m_speed));
float wipe_speed = std::min(max_speed, float(m_config->wipe_tower_wipe_starting_speed.get_abs_value(target_speed)));
if (wipe_speed <= 0) {
wipe_speed = target_speed;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,9 @@ std::string GCodeWriter::set_fan(const GCodeFlavor gcode_flavor, bool gcode_comm
std::ostringstream gcode;

//add fan_offset
int8_t fan_speed = int8_t(std::min(uint8_t(100), speed));
int16_t fan_speed = int8_t(std::min(uint8_t(100), speed));
fan_speed += tool_fan_offset;
fan_speed = std::max(int8_t(0), std::min(int8_t(100), fan_speed));
fan_speed = std::max(int16_t(0), std::min(int16_t(100), fan_speed));
const double fan_baseline = (is_fan_percentage ? 100.0 : 255.0);

// write it
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ ProcessSurfaceResult PerimeterGenerator::process_classic(int& contour_count, int
}
}
assert(contours.size() == contour_count);
assert(holes.size() == holes_count);
//assert(holes.size() == holes_count);
// nest loops: holes first
for (int d = 0; d < holes_count; ++d) {
PerimeterGeneratorLoops& holes_d = holes[d];
Expand Down
15 changes: 9 additions & 6 deletions src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6251,10 +6251,10 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionFloat(80.));

def = this->add("wipe_tower_wipe_starting_speed", coFloatOrPercent);
def->label = L("Wipe tower starting speed");
def->label = L("Wipe tower wipe starting speed");
def->category = OptionCategory::speed;
def->tooltip = L("Start of the wiping speed ramp up (for wipe tower)."
"\nCan be a % of the 'Wipe tower speed'."
"\nCan be a % of the 'Wipe tower main speed'."
"\nSet to 0 to disable.");
def->sidetext = L("mm/s or %");
def->mode = comAdvancedE | comSuSi;
Expand Down Expand Up @@ -7817,11 +7817,13 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
|| opt_key == "solid_fill_pattern" || opt_key == "bridge_fill_pattern" || opt_key == "support_material_interface_pattern"))
value = "monotonic";
// some changes has occurs between rectilineargapfill and monotonicgapfill. Set them at the right value for each type
if (value == "rectilineargapfill" && (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern" || opt_key == "fill_pattern" || opt_key == "support_material_interface_pattern"))
if (value == "rectilineargapfill" && (opt_key == "top_fill_pattern" || opt_key == "bottom_fill_pattern") )
value = "monotonicgapfill";
if (value == "monotonicgapfill" && (opt_key == "solid_fill_pattern"))
value = "rectilineargapfill";

if (opt_key == "fill_pattern" || opt_key == "support_material_interface_pattern")
if (value == "rectilineargapfill")
value = "rectilinear";
else if (value == "monotonicgapfill")
value = "monotonic";

if (ignore.find(opt_key) != ignore.end()) {
opt_key = "";
Expand Down Expand Up @@ -8375,6 +8377,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = {
"perimeter_overlap",
"perimeter_reverse",
"perimeter_round_corners",
"perimeters_hole",
"print_extrusion_multiplier",
"print_first_layer_temperature",
"print_custom_variables",
Expand Down
4 changes: 2 additions & 2 deletions src/slic3r/GUI/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2821,10 +2821,10 @@ void MainFrame::on_value_changed(wxCommandEvent& event)
}
}

void MainFrame::on_config_changed(DynamicPrintConfig* config) const
void MainFrame::on_config_changed(const DynamicConfig &config) const
{
if (m_plater)
m_plater->on_config_change(*config); // propagate config change events to the plater
m_plater->on_config_change(config); // propagate config change events to the plater
}

void MainFrame::add_to_recent_projects(const wxString& filename)
Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/MainFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class MainFrame : public DPIFrame
ETabType next_preview_tab();
void select_view(const std::string& direction);
// Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig
void on_config_changed(DynamicPrintConfig* cfg) const ;
void on_config_changed(const DynamicConfig &cfg) const ;

bool can_save() const;
bool can_save_as() const;
Expand Down
Loading

0 comments on commit 126843f

Please sign in to comment.