Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
Modify combing to avoid supports
Browse files Browse the repository at this point in the history
Combing feature has "avoid printed parts" option
which makes it go around other parts when travelling.
This patch adds another option - avoid supports that
enables avoiding supports when doing travel moves.
  • Loading branch information
maximkulkin committed May 9, 2018
1 parent fb30714 commit 2719def
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions meta/new settings master
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ support_roof_line_width

travel_avoid_distance
travel_avoid_other_parts
travel_avoid_supports
travel_compensate_overlapping_walls_enabled

z_seam_type
Expand Down
10 changes: 6 additions & 4 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
fan_speed_layer_time_settings.cool_fan_speed_0 = regular_fan_speed; // ignore initial layer fan speed stuff
}

LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_height, extruder_nr, fan_speed_layer_time_settings_per_extruder_raft_base, combing_mode, comb_offset, train->getSettingInMicrons("line_width"), train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_height, extruder_nr, fan_speed_layer_time_settings_per_extruder_raft_base, combing_mode, comb_offset, train->getSettingInMicrons("line_width"), train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingBoolean("travel_avoid_supports"), train->getSettingInMicrons("travel_avoid_distance"));
gcode_layer.setIsInside(true);

gcode_layer.setExtruder(extruder_nr);
Expand Down Expand Up @@ -625,7 +625,7 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
fan_speed_layer_time_settings.cool_fan_speed_0 = regular_fan_speed; // ignore initial layer fan speed stuff
}

LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_height, current_extruder_nr, fan_speed_layer_time_settings_per_extruder_raft_interface, combing_mode, comb_offset, train->getSettingInMicrons("line_width"), train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_height, current_extruder_nr, fan_speed_layer_time_settings_per_extruder_raft_interface, combing_mode, comb_offset, train->getSettingInMicrons("line_width"), train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingBoolean("travel_avoid_supports"), train->getSettingInMicrons("travel_avoid_distance"));
gcode_layer.setIsInside(true);

gcode_layer.setExtruder(extruder_nr); // reset to extruder number, because we might have primed in the last layer
Expand Down Expand Up @@ -680,7 +680,7 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
fan_speed_layer_time_settings.cool_fan_speed_0 = regular_fan_speed; // ignore initial layer fan speed stuff
}

LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_height, extruder_nr, fan_speed_layer_time_settings_per_extruder_raft_surface, combing_mode, comb_offset, train->getSettingInMicrons("line_width"), train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_height, extruder_nr, fan_speed_layer_time_settings_per_extruder_raft_surface, combing_mode, comb_offset, train->getSettingInMicrons("line_width"), train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingBoolean("travel_avoid_supports"), train->getSettingInMicrons("travel_avoid_distance"));
gcode_layer.setIsInside(true);

// make sure that we are using the correct extruder to print raft
Expand Down Expand Up @@ -772,6 +772,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, int lay
}

bool avoid_other_parts = false;
bool avoid_supports = false;
coord_t avoid_distance = 0; // minimal avoid distance is zero
coord_t line_width = 0;
const std::vector<bool> extruder_is_used = storage.getExtrudersUsed();
Expand All @@ -784,6 +785,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, int lay
if (extr->getSettingBoolean("travel_avoid_other_parts"))
{
avoid_other_parts = true;
avoid_supports |= extr->getSettingBoolean("travel_avoid_supports");
avoid_distance = std::max(avoid_distance, extr->getSettingInMicrons("travel_avoid_distance"));
}
line_width = extr->getSettingInMicrons("line_width");
Expand All @@ -809,7 +811,7 @@ LayerPlan& FffGcodeWriter::processLayer(const SliceDataStorage& storage, int lay
:
extruder_order_per_layer[layer_nr];

LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_thickness, extruder_order.front(), fan_speed_layer_time_settings_per_extruder, getSettingAsCombingMode("retraction_combing"), comb_offset_from_outlines, line_width, avoid_other_parts, avoid_distance);
LayerPlan& gcode_layer = *new LayerPlan(storage, layer_nr, z, layer_thickness, extruder_order.front(), fan_speed_layer_time_settings_per_extruder, getSettingAsCombingMode("retraction_combing"), comb_offset_from_outlines, line_width, avoid_other_parts, avoid_supports, avoid_distance);

if (include_helper_parts && layer_nr == 0)
{ // process the skirt or the brim of the starting extruder.
Expand Down
4 changes: 2 additions & 2 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void LayerPlan::forceNewPathStart()
paths[paths.size()-1].done = true;
}

LayerPlan::LayerPlan(const SliceDataStorage& storage, int layer_nr, int z, int layer_thickness, unsigned int start_extruder, const std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, coord_t comb_move_inside_distance, bool travel_avoid_other_parts, int64_t travel_avoid_distance)
LayerPlan::LayerPlan(const SliceDataStorage& storage, int layer_nr, int z, int layer_thickness, unsigned int start_extruder, const std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, coord_t comb_move_inside_distance, bool travel_avoid_other_parts, bool travel_avoid_supports, int64_t travel_avoid_distance)
: storage(storage)
, configs_storage(storage, layer_nr, layer_thickness)
, z(z)
Expand All @@ -95,7 +95,7 @@ LayerPlan::LayerPlan(const SliceDataStorage& storage, int layer_nr, int z, int l
is_inside = false; // assumes the next move will not be to inside a layer part (overwritten just before going into a layer part)
if (combing_mode != CombingMode::OFF)
{
comb = new Comb(storage, layer_nr, comb_boundary_inside1, comb_boundary_inside2, comb_boundary_offset, travel_avoid_other_parts, travel_avoid_distance, comb_move_inside_distance);
comb = new Comb(storage, layer_nr, comb_boundary_inside1, comb_boundary_inside2, comb_boundary_offset, travel_avoid_other_parts, travel_avoid_supports, travel_avoid_distance, comb_move_inside_distance);
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion src/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,12 @@ class LayerPlan : public NoCopy
* \param start_extruder The extruder with which this layer plan starts
* \param fan_speed_layer_time_settings_per_extruder The fan speed and layer time settings for each extruder.
* \param travel_avoid_other_parts Whether to avoid other layer parts when travaeling through air.
* \param travel_avoid_supports Whether to avoid other layer supports when travaeling through air.
* \param travel_avoid_distance The distance by which to avoid other layer parts when traveling through air.
* \param last_position The position of the head at the start of this gcode layer
* \param combing_mode Whether combing is enabled and full or within infill only.
*/
LayerPlan(const SliceDataStorage& storage, int layer_nr, int z, int layer_height, unsigned int start_extruder, const std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, coord_t comb_move_inside_distance, bool travel_avoid_other_parts, int64_t travel_avoid_distance);
LayerPlan(const SliceDataStorage& storage, int layer_nr, int z, int layer_height, unsigned int start_extruder, const std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, coord_t comb_move_inside_distance, bool travel_avoid_other_parts, bool travel_avoid_supports, int64_t travel_avoid_distance);
~LayerPlan();

void overrideFanSpeeds(double speed);
Expand Down
6 changes: 3 additions & 3 deletions src/pathPlanning/Comb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Polygons& Comb::getBoundaryOutside()
return *boundary_outside;
}

Comb::Comb(const SliceDataStorage& storage, int layer_nr, const Polygons& comb_boundary_inside_minimum, const Polygons& comb_boundary_inside_optimal, coord_t comb_boundary_offset, bool travel_avoid_other_parts, coord_t travel_avoid_distance, coord_t move_inside_distance)
Comb::Comb(const SliceDataStorage& storage, int layer_nr, const Polygons& comb_boundary_inside_minimum, const Polygons& comb_boundary_inside_optimal, coord_t comb_boundary_offset, bool travel_avoid_other_parts, bool travel_avoid_supports, coord_t travel_avoid_distance, coord_t move_inside_distance)
: storage(storage)
, layer_nr(layer_nr)
, offset_from_outlines(comb_boundary_offset) // between second wall and infill / other walls
Expand All @@ -39,9 +39,9 @@ Comb::Comb(const SliceDataStorage& storage, int layer_nr, const Polygons& comb_b
, inside_loc_to_line_minimum(PolygonUtils::createLocToLineGrid(boundary_inside_minimum, comb_boundary_offset))
, inside_loc_to_line_optimal(PolygonUtils::createLocToLineGrid(boundary_inside_optimal, comb_boundary_offset))
, boundary_outside(
[&storage, layer_nr, travel_avoid_distance]()
[&storage, layer_nr, travel_avoid_supports, travel_avoid_distance]()
{
return storage.getLayerOutlines(layer_nr, false).offset(travel_avoid_distance);
return storage.getLayerOutlines(layer_nr, travel_avoid_supports).offset(travel_avoid_distance);
}
)
, outside_loc_to_line(
Expand Down
3 changes: 2 additions & 1 deletion src/pathPlanning/Comb.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ class Comb
* \param comb_boundary_inside_minimum The minimum comb boundary within which to comb within layer parts.
* \param offset_from_outlines The offset from the outline polygon, to create the combing boundary in case there is no second wall.
* \param travel_avoid_other_parts Whether to avoid other layer parts when traveling through air.
* \param travel_avoid_supports Whether to avoid other layer supports when traveling through air.
* \param travel_avoid_distance The distance by which to avoid other layer parts when traveling through air.
* \param move_inside_distance When using comb_boundary_inside_minimum for combing it tries to move points inside by this amount after calculating the path to move it from the border a bit.
*/
Comb(const SliceDataStorage& storage, int layer_nr, const Polygons& comb_boundary_inside_minimum, const Polygons& comb_boundary_inside_optimal, coord_t offset_from_outlines, bool travel_avoid_other_parts, coord_t travel_avoid_distance, coord_t move_inside_distance);
Comb(const SliceDataStorage& storage, int layer_nr, const Polygons& comb_boundary_inside_minimum, const Polygons& comb_boundary_inside_optimal, coord_t offset_from_outlines, bool travel_avoid_other_parts, bool travel_avoid_supports, coord_t travel_avoid_distance, coord_t move_inside_distance);

~Comb();

Expand Down

0 comments on commit 2719def

Please sign in to comment.