mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-24 19:32:18 +00:00
Configure skirt start point
This commit is contained in:
@@ -3425,6 +3425,33 @@ namespace Skirt {
|
||||
return skirt_loops_per_extruder_out;
|
||||
}
|
||||
|
||||
static Point find_start_point(ExtrusionLoop& loop, float start_angle) {
|
||||
coord_t min_x = std::numeric_limits<coord_t>::max();
|
||||
coord_t max_x = std::numeric_limits<coord_t>::min();
|
||||
coord_t min_y = min_x;
|
||||
coord_t max_y = max_x;
|
||||
|
||||
Points pts;
|
||||
loop.collect_points(pts);
|
||||
for (Point pt: pts) {
|
||||
if (pt.x() < min_x)
|
||||
min_x = pt.x();
|
||||
else if (pt.x() > max_x)
|
||||
max_x = pt.x();
|
||||
if (pt.y() < min_y)
|
||||
min_y = pt.y();
|
||||
else if (pt.y() > max_y)
|
||||
max_y = pt.y();
|
||||
}
|
||||
|
||||
Point center((min_x + max_x)/2., (min_y + max_y)/2.);
|
||||
double r = center.distance_to(Point(min_x, min_y));
|
||||
double deg = start_angle * PI / 180;
|
||||
double shift_x = r * std::cos(deg);
|
||||
double shift_y = r * std::sin(deg);
|
||||
return Point(center.x()+shift_x, center.y() + shift_y);
|
||||
}
|
||||
|
||||
} // namespace Skirt
|
||||
|
||||
// Orca: Klipper can't parse object names with spaces and other spetical characters
|
||||
@@ -3995,6 +4022,11 @@ LayerResult GCode::process_layer(
|
||||
path.height = layer_skirt_flow.height();
|
||||
path.mm3_per_mm = mm3_per_mm;
|
||||
}
|
||||
|
||||
//set skirt start point location
|
||||
if (first_layer && i==loops.first)
|
||||
this->set_last_pos(Skirt::find_start_point(loop, layer.object()->config().skirt_start_angle));
|
||||
|
||||
//FIXME using the support_speed of the 1st object printed.
|
||||
gcode += this->extrude_loop(loop, "skirt", m_config.support_speed.value);
|
||||
}
|
||||
|
||||
@@ -774,7 +774,7 @@ static std::vector<std::string> s_Preset_print_options {
|
||||
"inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
|
||||
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
|
||||
"bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
|
||||
"outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_height", "draft_shield",
|
||||
"outer_wall_acceleration", "initial_layer_acceleration", "top_surface_acceleration", "default_acceleration", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle", "skirt_height", "draft_shield",
|
||||
"brim_width", "brim_object_gap", "brim_type", "brim_ears_max_angle", "brim_ears_detection_length", "enable_support", "support_type", "support_threshold_angle", "enforce_support_layers",
|
||||
"raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion",
|
||||
"support_base_pattern", "support_base_pattern_spacing", "support_expansion", "support_style",
|
||||
|
||||
@@ -225,6 +225,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||
|| opt_key == "min_skirt_length"
|
||||
|| opt_key == "draft_shield"
|
||||
|| opt_key == "skirt_distance"
|
||||
|| opt_key == "skirt_start_angle"
|
||||
|| opt_key == "ooze_prevention"
|
||||
|| opt_key == "wipe_tower_x"
|
||||
|| opt_key == "wipe_tower_y"
|
||||
|
||||
@@ -3992,6 +3992,15 @@ void PrintConfigDef::init_fff_params()
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloat(2));
|
||||
|
||||
def = this->add("skirt_start_angle", coFloat);
|
||||
def->label = L("Skirt start point");
|
||||
def->tooltip = L("Angle from the object center to skirt start point. Zero is the most right position, counter clockwise is positive angle.");
|
||||
def->sidetext = L("°");
|
||||
def->min = -180;
|
||||
def->max = 180;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloat(-135));
|
||||
|
||||
def = this->add("skirt_height", coInt);
|
||||
def->label = L("Skirt height");
|
||||
//def->label = "Skirt height";
|
||||
|
||||
@@ -1220,6 +1220,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||
((ConfigOptionFloats, retraction_minimum_travel))
|
||||
((ConfigOptionBools, retract_when_changing_layer))
|
||||
((ConfigOptionFloat, skirt_distance))
|
||||
((ConfigOptionFloat, skirt_start_angle))
|
||||
((ConfigOptionInt, skirt_height))
|
||||
((ConfigOptionInt, skirt_loops))
|
||||
((ConfigOptionFloat, skirt_speed))
|
||||
|
||||
Reference in New Issue
Block a user