Merge branch 'main' into enh-port-edit-gcode-dlg

This commit is contained in:
SoftFever 2024-01-15 22:35:36 +08:00 committed by GitHub
commit 95adb899a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 6290 additions and 6063 deletions

View file

@ -76,6 +76,16 @@ Generator::Generator(const PrintObject &print_object, const std::function<void()
const double layer_thickness = scaled<double>(object_config.layer_height.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
// Orca: fix lightning infill divide by zero when infill line width is set to 0.
// firstly attempt to set it to the default line width. If that is not provided either, set it to a sane default
// based on the nozzle diameter.
if (m_infill_extrusion_width < EPSILON)
m_infill_extrusion_width = scaled<float>(
object_config.line_width.get_abs_value(max_nozzle_diameter) < EPSILON ?
default_infill_extrusion_width :
object_config.line_width.get_abs_value(max_nozzle_diameter)
);
m_supporting_radius = coord_t(m_infill_extrusion_width) * 100 / region_config.sparse_infill_density;
const double lightning_infill_overhang_angle = M_PI / 4; // 45 degrees
@ -102,6 +112,15 @@ Generator::Generator(PrintObject* m_object, std::vector<Polygons>& contours, std
const double layer_thickness = scaled<double>(object_config.layer_height.value);
m_infill_extrusion_width = scaled<float>(region_config.sparse_infill_line_width.get_abs_value(max_nozzle_diameter));
// Orca: fix lightning infill divide by zero when infill line width is set to 0.
// firstly attempt to set it to the default line width. If that is not provided either, set it to a sane default
// based on the nozzle diameter.
if (m_infill_extrusion_width < EPSILON)
m_infill_extrusion_width = scaled<float>(
object_config.line_width.get_abs_value(max_nozzle_diameter) < EPSILON ?
default_infill_extrusion_width :
object_config.line_width.get_abs_value(max_nozzle_diameter)
);
//m_supporting_radius: against to the density of lightning, failures may happen if set to high density
//higher density lightning makes support harder, more time-consuming on computing and printing, but more reliable on supporting overhangs
//lower density lightning performs opposite

View file

@ -126,7 +126,9 @@ std::string SpiralVase::process_layer(const std::string &gcode, bool last_layer)
m_reader.parse_buffer(gcode, [&new_gcode, &z, total_layer_length, layer_height, transition_in, &len, &current_layer, &previous_layer, &transition_gcode, transition_out, smooth_spiral, &max_xy_dist_for_smoothing, &last_point]
(GCodeReader &reader, GCodeReader::GCodeLine line) {
if (line.cmd_is("G1")) {
if (line.has_z()) {
// Orca: Filter out retractions at layer change
if (line.retracting(reader) || (line.extruding(reader) && line.dist_XY(reader) < EPSILON)) return;
if (line.has_z() && !line.retracting(reader)) {
// If this is the initial Z move of the layer, replace it with a
// (redundant) move to the last Z of previous layer.
line.set(reader, Z, z);

View file

@ -160,9 +160,9 @@ std::unique_ptr<CompressedImageBuffer> compress_thumbnail_colpic(const Thumbnail
b = int(pixels[pix_idx + 2]) >> 3;
a = int(pixels[pix_idx + 3]);
if (a == 0) {
r = 239 >> 3;
g = 243 >> 2;
b = 247 >> 3;
r = 46 >> 3;
g = 51 >> 2;
b = 72 >> 3;
}
rgb = (r << 11) | (g << 5) | b;
color16_buf[time--] = rgb;
@ -529,4 +529,4 @@ int ColPic_EncodeStr(unsigned short* fromcolor16, int picw, int pich, unsigned c
return qty;
}
} // namespace Slic3r::GCodeThumbnails
} // namespace Slic3r::GCodeThumbnails