Skip to content

Commit

Permalink
fixes: typos, gcode viewer offset, no-seam layers.
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Jul 2, 2024
2 parents 2f4f2cd + b85ac37 commit f4351d2
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 10 deletions.
2 changes: 1 addition & 1 deletion resources/ui_layout/default/filament.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ group:Fan speed - default
setting:id$0:label_width$12:label$Interface:support_material_interface_fan_speed
line:Bridges fan speed
setting:id$0:label_width$12:label$Bridges:bridge_fan_speed
setting:id$0:label_width$12:label$Internal bridges:bridge_internal_fan_speed
setting:id$0:label_width$12:label$Internal bridges:internal_bridge_fan_speed
line:Overhangs Perimeter fan speed
setting:id$0:label_width$12:label$Overhangs:overhangs_fan_speed
line:Gap fill fan speed
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ group:label_width$9:sidetext_width$8:Acceleration control (advanced)
setting:width$4:brim_acceleration
line:Bridge acceleration
setting:width$4:bridge_acceleration
setting:width$4:bridge_internal_acceleration
setting:width$4:internal_bridge_acceleration
setting:width$4:overhangs_acceleration
line:Other extrusions acceleration
setting:width$4:gap_fill_acceleration
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/example/filament.ui
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ group:Fan speed - default
setting:id$0:label_width$12:label$Interface:support_material_interface_fan_speed
line:Bridges fan speed
setting:id$0:label_width$12:label$Bridges:bridge_fan_speed
setting:id$0:label_width$12:label$Internal bridges:bridge_internal_fan_speed
setting:id$0:label_width$12:label$Internal bridges:internal_bridge_fan_speed
line:Overhangs Perimeter fan speed
setting:id$0:label_width$12:label$Overhangs:overhangs_fan_speed
line:Gap fill fan speed
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/example/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ group:label_width$9:sidetext_width$8:Acceleration control (advanced)
setting:width$4:brim_acceleration
line:Bridge acceleration
setting:width$4:bridge_acceleration
setting:width$4:bridge_internal_acceleration
setting:width$4:internal_bridge_acceleration
setting:width$4:overhangs_acceleration
line:Other extrusions acceleration
setting:width$4:gap_fill_acceleration
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1427,8 +1427,8 @@ void GCode::_do_export(Print& print_mod, GCodeOutputStream &file, ThumbnailsGene

//klipper can hide gcode into a macro, so add guessed init gcode to the processor.
if (this->config().start_gcode_manual) {
std::string gcode = m_writer.preamble();
m_processor.process_string(gcode, this->m_throw_if_canceled);
// from m_writer.preamble();
m_processor.process_preamble(true/*unit_mm*/, true/*absolute_coords*/, m_writer.config.use_relative_e_distances.value, 0/*G92*/);
}

if (! print.config().gcode_substitutions.empty()) {
Expand Down
25 changes: 25 additions & 0 deletions src/libslic3r/GCode/GCodeProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,31 @@ void GCodeProcessor::process_string(const std::string& gcode, std::function<void
});
}

void GCodeProcessor::process_preamble(bool unit_mm, bool absolute_coords, bool absolute_extrusion, float set_G92_value)
{
if (unit_mm) {
m_units = EUnits::Millimeters;
} else {
m_units = EUnits::Inches;
}

if (absolute_coords) {
m_global_positioning_type = EPositioningType::Absolute;
} else {
m_global_positioning_type = EPositioningType::Relative;
}

if (absolute_extrusion) {
m_e_local_positioning_type = EPositioningType::Absolute;
} else {
m_e_local_positioning_type = EPositioningType::Relative;
}

{
m_origin[E] = m_end_position[E] = set_G92_value * (m_units == EUnits::Inches) ? INCHES_TO_MM : 1.0f;
}
}

static inline const char* skip_whitespaces(const char *begin, const char *end) {
for (; begin != end && (*begin == ' ' || *begin == '\t'); ++ begin);
return begin;
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/GCode/GCodeProcessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ namespace Slic3r {
// throws CanceledException through print->throw_if_canceled() (sent by the caller as callback).
void process_file(const std::string& filename, std::function<void()> cancel_callback = nullptr);
void process_string(const std::string& gcode, std::function<void()> cancel_callback = nullptr);
void process_preamble(bool unit_mm, bool absolute_coords, bool absolute_extrusion, float set_G92_value);

// Streaming interface, for processing G-codes just generated by PrusaSlicer in a pipelined fashion.
void initialize(const std::string& filename);
Expand Down
10 changes: 9 additions & 1 deletion src/libslic3r/GCode/SeamPlacer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,8 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
//path.polygons_covered_by_width(*polygons, SCALED_EPSILON);
assert(corresponding_regions_out->size() == polylines->size());
polylines->emplace_back(path.polyline.get_points(), true, true, PolylineWithEnd::PolyDir::BOTH); // TODO: more point for arcs
assert(path.polyline.front() != path.polyline.back());
assert(path.polyline.size() > 1);
//while (corresponding_regions_out->size() < polylines->size()) {
corresponding_regions_out->push_back(current_layer_region);
//}
Expand All @@ -490,6 +492,7 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
loop.collect_points(pts);
pts.push_back(pts.front()); //polygon
assert(corresponding_regions_out->size() == polylines->size());
assert(pts.size() > 1);
polylines->emplace_back(std::move(pts), true, false, is_ccw ? PolylineWithEnd::PolyDir::CCW : PolylineWithEnd::PolyDir::CW);
corresponding_regions_out->push_back(current_layer_region);
return;
Expand All @@ -504,6 +507,7 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
if(!previous_collected)
polys.emplace_back(false, false, is_ccw ? PolylineWithEnd::PolyDir::CCW : PolylineWithEnd::PolyDir::CW);
path.collect_points(polys.back().points);
assert(polys.back().size() > 1);
count_paths_collected++;
current_collected = true;
}
Expand All @@ -512,6 +516,7 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
if(!previous_collected)
polys.emplace_back(false, false, is_ccw ? PolylineWithEnd::PolyDir::CCW : PolylineWithEnd::PolyDir::CW);
path.collect_points(polys.back().points);
assert(polys.back().size() > 1);
count_paths_collected++;
current_collected = true;
}
Expand Down Expand Up @@ -545,6 +550,8 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
idx == 0 ? true : false,
idx + 1 < collection.size() ? false : true,
PolylineWithEnd::PolyDir::BOTH); // TODO: more points for arcs
assert(path.polyline.front() != path.polyline.back());
assert(path.polyline.size() > 1);
corresponding_regions_out->push_back(current_layer_region);
}
}
Expand Down Expand Up @@ -576,6 +583,7 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
// what to do in this case?
Points pts;
ex_entity->collect_points(pts);
assert(pts.front() != pts.back());
polylines.emplace_back(std::move(pts), true, pts.front() != pts.back(), PolylineWithEnd::PolyDir::BOTH);
corresponding_regions_out.push_back(layer_region);
}
Expand All @@ -586,7 +594,7 @@ PolylineWithEnds extract_perimeter_polylines(const Layer *layer, const SeamPosit
}
if (polylines.empty()) { // If there are no perimeter polylines/polygons for whatever reason (disabled perimeters .. ) insert dummy point
// it is easier than checking everywhere if the layer is not emtpy, no seam will be placed to this layer anyway
polylines.emplace_back(std::vector{ Point { 0, 0 } }, true, true, PolylineWithEnd::PolyDir::BOTH);
polylines.emplace_back(std::vector<Point>{ /*Point { 0, 0 }*/ }, true, true, PolylineWithEnd::PolyDir::BOTH);
corresponding_regions_out.push_back(nullptr);
}
assert(corresponding_regions_out.size() == polylines.size());
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5920,7 +5920,7 @@ void PrintConfigDef::init_fff_params()
def->set_default_value(new ConfigOptionInt(0));

def = this->add("print_first_layer_temperature", coInt);
def->label = L("Temperature");
def->label = L("First Layer Temperature");
def->category = OptionCategory::filament;
def->tooltip = L("Override the temperature of the extruder (for the first layer). Avoid making too many changes, it won't stop for cooling/heating. 0 to disable (using print_temperature if defined). May only work on Height range modifiers.");
def->mode = comExpert | comSuSi;
Expand Down
4 changes: 2 additions & 2 deletions src/slic3r/GUI/CalibrationPressureAdvDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ void CalibrationPressureAdvDialog::create_geometry(wxCommandEvent& event_args) {
{"BridgeInfill", "bridge_acceleration"},
{"ExternalPerimeter", "external_perimeter_acceleration"},
{"GapFill", "gap_fill_acceleration"},
{"InternalBridgeInfill", "bridge_internal_acceleration"},
{"InternalBridgeInfill", "internal_bridge_acceleration"},
{"Ironing", "ironing_acceleration"},
{"OverhangPerimeter", "overhangs_acceleration"},
{"Perimeter", "perimeter_acceleration"},
Expand Down Expand Up @@ -307,7 +307,7 @@ struct ExtrusionSettings {// think a struct is better instead of all the maps ?
//{"BridgeInfill", {"placeholder", "bridge_acceleration", "placeholder"}},//special calc required
{"ExternalPerimeter", {"external_perimeter_extrusion_width", "external_perimeter_acceleration"}},
//{"GapFill", {"placeholder", "gap_fill_acceleration"}},//special calc required
//{"InternalBridgeInfill", {"placeholder", "bridge_internal_acceleration"}},//special calc required
//{"InternalBridgeInfill", {"placeholder", "internal_bridge_acceleration"}},//special calc required
{"Ironing", {"top_infill_extrusion_width", "ironing_acceleration"}},
{"OverhangPerimeter", {"overhangs_width", "overhangs_acceleration"}},
{"Perimeter", {"perimeter_extrusion_width", "perimeter_acceleration"}},
Expand Down

0 comments on commit f4351d2

Please sign in to comment.