mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 21:57:18 +08:00
Spiral vase: allow to choose the seam start position.
supermerill/SuperSlicer#2114
This commit is contained in:
parent
0c92076a14
commit
f0548ab5f7
@ -3199,8 +3199,9 @@ void GCode::split_at_seam_pos(ExtrusionLoop& loop, std::unique_ptr<EdgeGrid::Gri
|
|||||||
// find the point of the loop that is closest to the current extruder position
|
// find the point of the loop that is closest to the current extruder position
|
||||||
// or randomize if requested
|
// or randomize if requested
|
||||||
Point last_pos = this->last_pos();
|
Point last_pos = this->last_pos();
|
||||||
if (m_config.spiral_vase) {
|
//for first spiral, choose the seam, as the position will be very relevant.
|
||||||
loop.split_at(last_pos, false);
|
if (m_config.spiral_vase && !m_spiral_vase->is_transition_layer()) {
|
||||||
|
loop.split_at(last_pos, false);
|
||||||
} else {
|
} else {
|
||||||
const EdgeGrid::Grid* edge_grid_ptr = (lower_layer_edge_grid && *lower_layer_edge_grid)
|
const EdgeGrid::Grid* edge_grid_ptr = (lower_layer_edge_grid && *lower_layer_edge_grid)
|
||||||
? lower_layer_edge_grid->get()
|
? lower_layer_edge_grid->get()
|
||||||
|
@ -55,9 +55,12 @@ std::string SpiralVase::process_layer(const std::string &gcode)
|
|||||||
// Tapering the absolute extruder distances requires to process every extrusion value after the first transition
|
// Tapering the absolute extruder distances requires to process every extrusion value after the first transition
|
||||||
// layer.
|
// layer.
|
||||||
bool transition = m_transition_layer && m_config->use_relative_e_distances.value;
|
bool transition = m_transition_layer && m_config->use_relative_e_distances.value;
|
||||||
|
if (transition)
|
||||||
|
new_gcode += "; Began spiral\n";
|
||||||
|
bool keep_first_travel = m_transition_layer;
|
||||||
float layer_height_factor = layer_height / total_layer_length;
|
float layer_height_factor = layer_height / total_layer_length;
|
||||||
float len = 0.f;
|
float len = 0.f;
|
||||||
m_reader.parse_buffer(gcode, [&new_gcode, &z, total_layer_length, layer_height_factor, transition, &len]
|
m_reader.parse_buffer(gcode, [&keep_first_travel , &new_gcode, &z, total_layer_length, layer_height_factor, transition, &len]
|
||||||
(GCodeReader &reader, GCodeReader::GCodeLine line) {
|
(GCodeReader &reader, GCodeReader::GCodeLine line) {
|
||||||
if (line.cmd_is("G1")) {
|
if (line.cmd_is("G1")) {
|
||||||
if (line.has_z()) {
|
if (line.has_z()) {
|
||||||
@ -71,12 +74,16 @@ std::string SpiralVase::process_layer(const std::string &gcode)
|
|||||||
if (dist_XY > 0) {
|
if (dist_XY > 0) {
|
||||||
// horizontal move
|
// horizontal move
|
||||||
if (line.extruding(reader)) {
|
if (line.extruding(reader)) {
|
||||||
|
keep_first_travel = false;
|
||||||
len += dist_XY;
|
len += dist_XY;
|
||||||
line.set(reader, Z, z + len * layer_height_factor);
|
line.set(reader, Z, z + len * layer_height_factor);
|
||||||
if (transition && line.has(E))
|
if (transition && line.has(E))
|
||||||
// Transition layer, modulate the amount of extrusion from zero to the final value.
|
// Transition layer, modulate the amount of extrusion from zero to the final value.
|
||||||
line.set(reader, E, line.value(E) * len / total_layer_length);
|
line.set(reader, E, line.value(E) * len / total_layer_length);
|
||||||
new_gcode += line.raw() + '\n';
|
new_gcode += line.raw() + '\n';
|
||||||
|
} else if (keep_first_travel) {
|
||||||
|
//we can travel until the first spiral extrusion
|
||||||
|
new_gcode += line.raw() + '\n';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -19,7 +19,9 @@ public:
|
|||||||
m_enabled = en;
|
m_enabled = en;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string process_layer(const std::string &gcode);
|
std::string process_layer(const std::string& gcode);
|
||||||
|
|
||||||
|
bool is_transition_layer() { return m_transition_layer; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const PrintConfig *m_config;
|
const PrintConfig *m_config;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user