Comparar commits
11 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 1730923083 | |||
| 8e5a936522 | |||
| d29da8f7f8 | |||
| ad56ce8866 | |||
| 565b09e37d | |||
| edc9767912 | |||
| ce6f58f136 | |||
| 5b941d07ff | |||
| 350b42052a | |||
| 0ba152d081 | |||
| 2c70c2ecb7 |
@@ -312,8 +312,7 @@ void FffGcodeWriter::processRaft(SliceDataStorage& storage, unsigned int total_l
|
||||
int layer_height = train->getSettingInMicrons("raft_base_thickness");
|
||||
z += layer_height;
|
||||
int64_t comb_offset = train->getSettingInMicrons("raft_base_line_spacing");
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_height, last_position_planned, current_extruder_planned, is_inside_mesh_layer_part, fan_speed_layer_time_settings_per_extruder, combing_mode, comb_offset, train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
|
||||
gcode_layer.setIsInside(true);
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_height, last_position_planned, current_extruder_planned, fan_speed_layer_time_settings_per_extruder, combing_mode, comb_offset, train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
|
||||
|
||||
if (getSettingAsIndex("adhesion_extruder_nr") > 0)
|
||||
{
|
||||
@@ -335,7 +334,6 @@ void FffGcodeWriter::processRaft(SliceDataStorage& storage, unsigned int total_l
|
||||
|
||||
last_position_planned = gcode_layer.getLastPosition();
|
||||
current_extruder_planned = gcode_layer.getExtruder();
|
||||
is_inside_mesh_layer_part = gcode_layer.getIsInsideMesh();
|
||||
|
||||
ensureAllExtrudersArePrimed(storage, gcode_layer, layer_nr);
|
||||
|
||||
@@ -348,8 +346,7 @@ void FffGcodeWriter::processRaft(SliceDataStorage& storage, unsigned int total_l
|
||||
int layer_height = train->getSettingInMicrons("raft_interface_thickness");
|
||||
z += layer_height;
|
||||
int64_t comb_offset = train->getSettingInMicrons("raft_interface_line_spacing");
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_height, last_position_planned, current_extruder_planned, is_inside_mesh_layer_part, fan_speed_layer_time_settings_per_extruder, combing_mode, comb_offset, train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
|
||||
gcode_layer.setIsInside(true);
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_height, last_position_planned, current_extruder_planned, fan_speed_layer_time_settings_per_extruder, combing_mode, comb_offset, train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
|
||||
|
||||
if (CommandSocket::isInstantiated())
|
||||
{
|
||||
@@ -365,7 +362,6 @@ void FffGcodeWriter::processRaft(SliceDataStorage& storage, unsigned int total_l
|
||||
|
||||
last_position_planned = gcode_layer.getLastPosition();
|
||||
current_extruder_planned = gcode_layer.getExtruder();
|
||||
is_inside_mesh_layer_part = gcode_layer.getIsInsideMesh();
|
||||
|
||||
gcode_layer.processFanSpeedAndMinimalLayerTime();
|
||||
gcode_layer.overrideFanSpeeds(train->getSettingInPercentage("raft_interface_fan_speed"));
|
||||
@@ -378,8 +374,7 @@ void FffGcodeWriter::processRaft(SliceDataStorage& storage, unsigned int total_l
|
||||
const int layer_nr = initial_raft_layer_nr + 2 + raftSurfaceLayer - 1; // 2: 1 base layer, 1 interface layer
|
||||
z += layer_height;
|
||||
const int64_t comb_offset = train->getSettingInMicrons("raft_surface_line_spacing");
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_height, last_position_planned, current_extruder_planned, is_inside_mesh_layer_part, fan_speed_layer_time_settings_per_extruder, combing_mode, comb_offset, train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
|
||||
gcode_layer.setIsInside(true);
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_height, last_position_planned, current_extruder_planned, fan_speed_layer_time_settings_per_extruder, combing_mode, comb_offset, train->getSettingBoolean("travel_avoid_other_parts"), train->getSettingInMicrons("travel_avoid_distance"));
|
||||
|
||||
if (CommandSocket::isInstantiated())
|
||||
{
|
||||
@@ -395,8 +390,7 @@ void FffGcodeWriter::processRaft(SliceDataStorage& storage, unsigned int total_l
|
||||
|
||||
last_position_planned = gcode_layer.getLastPosition();
|
||||
current_extruder_planned = gcode_layer.getExtruder();
|
||||
is_inside_mesh_layer_part = gcode_layer.getIsInsideMesh();
|
||||
|
||||
|
||||
gcode_layer.processFanSpeedAndMinimalLayerTime();
|
||||
gcode_layer.overrideFanSpeeds(train->getSettingInPercentage("raft_surface_fan_speed"));
|
||||
}
|
||||
@@ -462,7 +456,7 @@ void FffGcodeWriter::processLayer(SliceDataStorage& storage, int layer_nr, unsig
|
||||
|
||||
|
||||
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_thickness, last_position_planned, current_extruder_planned, is_inside_mesh_layer_part, fan_speed_layer_time_settings_per_extruder, getSettingAsCombingMode("retraction_combing"), comb_offset_from_outlines, avoid_other_parts, avoid_distance);
|
||||
GCodePlanner& gcode_layer = layer_plan_buffer.emplace_back(storage, layer_nr, z, layer_thickness, last_position_planned, current_extruder_planned, fan_speed_layer_time_settings_per_extruder, getSettingAsCombingMode("retraction_combing"), comb_offset_from_outlines, avoid_other_parts, avoid_distance);
|
||||
|
||||
if (include_helper_parts && layer_nr == 0)
|
||||
{ // process the skirt or the brim of the starting extruder.
|
||||
@@ -519,8 +513,7 @@ void FffGcodeWriter::processLayer(SliceDataStorage& storage, int layer_nr, unsig
|
||||
|
||||
last_position_planned = gcode_layer.getLastPosition();
|
||||
current_extruder_planned = gcode_layer.getExtruder();
|
||||
is_inside_mesh_layer_part = gcode_layer.getIsInsideMesh();
|
||||
|
||||
|
||||
gcode_layer.processFanSpeedAndMinimalLayerTime();
|
||||
}
|
||||
|
||||
@@ -748,7 +741,7 @@ void FffGcodeWriter::addMeshLayerToGCode(SliceDataStorage& storage, SliceMeshSto
|
||||
int infill_line_distance = mesh->getSettingInMicrons("infill_line_distance");
|
||||
int infill_overlap = mesh->getSettingInMicrons("infill_overlap_mm");
|
||||
|
||||
gcode_layer.setIsInside(true); // going to print inside stuff below
|
||||
gcode_layer.setIsInside(&part); // going to print inside stuff below
|
||||
|
||||
if (mesh->getSettingBoolean("infill_before_walls"))
|
||||
{
|
||||
@@ -779,10 +772,10 @@ void FffGcodeWriter::addMeshLayerToGCode(SliceDataStorage& storage, SliceMeshSto
|
||||
//After a layer part, make sure the nozzle is inside the comb boundary, so we do not retract on the perimeter.
|
||||
if (!mesh->getSettingBoolean("magic_spiralize") || static_cast<int>(layer_nr) < mesh->getSettingAsCount("bottom_layers"))
|
||||
{
|
||||
gcode_layer.moveInsideCombBoundary(mesh->getSettingInMicrons((mesh->getSettingAsCount("wall_line_count") > 1) ? "wall_line_width_x" : "wall_line_width_0") * 1);
|
||||
gcode_layer.moveInsideCombBoundary(mesh->getSettingInMicrons((mesh->getSettingAsCount("wall_line_count") > 1) ? "wall_line_width_x" : "wall_line_width_0") * 1, part);
|
||||
}
|
||||
|
||||
gcode_layer.setIsInside(false);
|
||||
gcode_layer.setIsInside(nullptr);
|
||||
}
|
||||
if (mesh->getSettingAsSurfaceMode("magic_mesh_surface_mode") != ESurfaceMode::NORMAL)
|
||||
{
|
||||
|
||||
@@ -69,14 +69,12 @@ private:
|
||||
|
||||
Point last_position_planned; //!< The position of the head before planning the next layer
|
||||
int current_extruder_planned; //!< The extruder train in use before planning the next layer
|
||||
bool is_inside_mesh_layer_part; //!< Whether the last position was inside a layer part (used in combing)
|
||||
public:
|
||||
FffGcodeWriter(SettingsBase* settings_)
|
||||
: SettingsMessenger(settings_)
|
||||
, layer_plan_buffer(this, gcode)
|
||||
, last_position_planned(no_point)
|
||||
, current_extruder_planned(0) // changed somewhere early in FffGcodeWriter::writeGCode
|
||||
, is_inside_mesh_layer_part(false)
|
||||
{
|
||||
max_object_height = 0;
|
||||
}
|
||||
|
||||
+25
-16
@@ -93,7 +93,7 @@ void GCodePlanner::forceNewPathStart()
|
||||
paths[paths.size()-1].done = true;
|
||||
}
|
||||
|
||||
GCodePlanner::GCodePlanner(SliceDataStorage& storage, int layer_nr, int z, int layer_thickness, Point last_position, int current_extruder, bool is_inside_mesh, std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, bool travel_avoid_other_parts, int64_t travel_avoid_distance)
|
||||
GCodePlanner::GCodePlanner(SliceDataStorage& storage, int layer_nr, int z, int layer_thickness, Point last_position, int current_extruder, std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, bool travel_avoid_other_parts, int64_t travel_avoid_distance)
|
||||
: storage(storage)
|
||||
, layer_nr(layer_nr)
|
||||
, is_initial_layer(layer_nr == 0 - Raft::getTotalExtraLayers(storage))
|
||||
@@ -109,8 +109,8 @@ GCodePlanner::GCodePlanner(SliceDataStorage& storage, int layer_nr, int z, int l
|
||||
extruder_plans.reserve(storage.meshgroup->getExtruderCount());
|
||||
extruder_plans.emplace_back(current_extruder, start_position, layer_nr, is_initial_layer, layer_thickness, fan_speed_layer_time_settings_per_extruder[current_extruder], storage.retraction_config_per_extruder[current_extruder]);
|
||||
comb = nullptr;
|
||||
was_inside = is_inside_mesh;
|
||||
is_inside = false; // assumes the next move will not be to inside a layer part (overwritten just before going into a layer part)
|
||||
was_inside = storage.getPartInside(layer_nr, start_position);
|
||||
is_inside = nullptr; // 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_inside, comb_boundary_offset, travel_avoid_other_parts, travel_avoid_distance);
|
||||
@@ -139,14 +139,7 @@ Polygons GCodePlanner::computeCombBoundaryInside(CombingMode combing_mode)
|
||||
}
|
||||
if (layer_nr < 0)
|
||||
{ // when a raft is present
|
||||
if (combing_mode == CombingMode::NO_SKIN)
|
||||
{
|
||||
return Polygons();
|
||||
}
|
||||
else
|
||||
{
|
||||
return storage.raftOutline.offset(MM2INT(0.1));
|
||||
}
|
||||
return Polygons();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -174,7 +167,7 @@ Polygons GCodePlanner::computeCombBoundaryInside(CombingMode combing_mode)
|
||||
}
|
||||
}
|
||||
|
||||
void GCodePlanner::setIsInside(bool _is_inside)
|
||||
void GCodePlanner::setIsInside(SliceLayerPart* _is_inside)
|
||||
{
|
||||
is_inside = _is_inside;
|
||||
}
|
||||
@@ -185,7 +178,7 @@ bool GCodePlanner::setExtruder(int extruder)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
setIsInside(false);
|
||||
setIsInside(nullptr);
|
||||
{ // handle end position of the prev extruder
|
||||
SettingsBaseVirtual* train = getLastPlannedExtruderTrainSettings();
|
||||
bool end_pos_absolute = train->getSettingBoolean("machine_extruder_end_pos_abs");
|
||||
@@ -232,11 +225,27 @@ bool GCodePlanner::setExtruder(int extruder)
|
||||
return true;
|
||||
}
|
||||
|
||||
void GCodePlanner::moveInsideCombBoundary(int distance)
|
||||
void GCodePlanner::moveInsideCombBoundary(int distance, const SliceLayerPart& part)
|
||||
{
|
||||
int max_dist2 = MM2INT(2.0) * MM2INT(2.0); // if we are further than this distance, we conclude we are not inside even though we thought we were.
|
||||
// this function is to be used to move from the boudary of a part to inside the part
|
||||
int max_dist2 = MM2INT(2.0) * MM2INT(2.0); // if we are further than this distance, we conclude we are not inside even though we thought we were.
|
||||
Point p = lastPosition; // copy, since we are going to move p
|
||||
{ // first move inside the last part, so that the chance is higher that we move inside the same part
|
||||
const Polygons* comb_boundary_here;
|
||||
if (part.insets.size() > 1)
|
||||
{
|
||||
comb_boundary_here = &part.insets[1];
|
||||
}
|
||||
else if (part.insets.size() == 1)
|
||||
{
|
||||
comb_boundary_here = &part.insets[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
comb_boundary_here = &part.print_outline;
|
||||
}
|
||||
PolygonUtils::moveInside(*comb_boundary_here, p, distance);
|
||||
}
|
||||
if (PolygonUtils::moveInside(comb_boundary_inside, p, distance, max_dist2) != NO_INDEX)
|
||||
{
|
||||
//Move inside again, so we move out of tight 90deg corners
|
||||
@@ -328,7 +337,7 @@ GCodePath& GCodePlanner::addTravel(Point p)
|
||||
if (was_inside) // when the previous location was from printing something which is considered inside (not support or prime tower etc)
|
||||
{ // then move inside the printed part, so that we don't ooze on the outer wall while retraction, but on the inside of the print.
|
||||
assert (extr != nullptr);
|
||||
moveInsideCombBoundary(extr->getSettingInMicrons((extr->getSettingAsCount("wall_line_count") > 1) ? "wall_line_width_x" : "wall_line_width_0") * 1);
|
||||
moveInsideCombBoundary(extr->getSettingInMicrons((extr->getSettingAsCount("wall_line_count") > 1) ? "wall_line_width_x" : "wall_line_width_0") * 1, *was_inside);
|
||||
}
|
||||
path = getLatestPathWithConfig(&travel_config, SpaceFillType::None);
|
||||
path->retract = true;
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace cura
|
||||
{
|
||||
|
||||
class SliceDataStorage;
|
||||
class SliceLayerPart;
|
||||
|
||||
/*!
|
||||
* A gcode command to insert before a specific path.
|
||||
@@ -474,8 +475,8 @@ private:
|
||||
|
||||
int last_extruder_previous_layer; //!< The last id of the extruder with which was printed in the previous layer
|
||||
SettingsBaseVirtual* last_planned_extruder_setting_base; //!< The setting base of the last planned extruder.
|
||||
bool was_inside; //!< Whether the last planned (extrusion) move was inside a layer part
|
||||
bool is_inside; //!< Whether the destination of the next planned travel move is inside a layer part
|
||||
SliceLayerPart* was_inside; //!< The layer part the last planned (extrusion) move was inside (if any)
|
||||
SliceLayerPart* is_inside; //!< The layer part the destination of the next planned travel move is inside (if any)
|
||||
Polygons comb_boundary_inside; //!< The boundary within which to comb, or to move into when performing a retraction.
|
||||
Comb* comb;
|
||||
|
||||
@@ -516,7 +517,7 @@ public:
|
||||
* \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.
|
||||
*/
|
||||
GCodePlanner(SliceDataStorage& storage, int layer_nr, int z, int layer_height, Point last_position, int current_extruder, bool is_inside_mesh, std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, bool travel_avoid_other_parts, int64_t travel_avoid_distance);
|
||||
GCodePlanner(SliceDataStorage& storage, int layer_nr, int z, int layer_height, Point last_position, int current_extruder, std::vector<FanSpeedLayerTimeSettings>& fan_speed_layer_time_settings_per_extruder, CombingMode combing_mode, int64_t comb_boundary_offset, bool travel_avoid_other_parts, int64_t travel_avoid_distance);
|
||||
~GCodePlanner();
|
||||
|
||||
void overrideFanSpeeds(double speed);
|
||||
@@ -564,8 +565,9 @@ public:
|
||||
*
|
||||
* Features like infill, walls, skin etc. are considered inside.
|
||||
* Features like prime tower and support are considered outside.
|
||||
* \param inside_part The part in which the newly planned position is inside, or nullptr if not inside anything
|
||||
*/
|
||||
void setIsInside(bool going_to_comb);
|
||||
void setIsInside(SliceLayerPart* inside_part);
|
||||
|
||||
bool setExtruder(int extruder);
|
||||
|
||||
@@ -713,8 +715,9 @@ public:
|
||||
* This is supposed to be called when the nozzle is around the boundary of a layer part, not when the nozzle is in the middle of support, or in the middle of the air.
|
||||
*
|
||||
* \param distance The distance to the comb boundary after we moved inside it.
|
||||
* \param part_outline The part in which we last resided
|
||||
*/
|
||||
void moveInsideCombBoundary(int distance);
|
||||
void moveInsideCombBoundary(int distance, const SliceLayerPart& part);
|
||||
};
|
||||
|
||||
}//namespace cura
|
||||
|
||||
@@ -12,6 +12,19 @@
|
||||
|
||||
namespace cura {
|
||||
|
||||
Polygons Comb::getCombOutlines()
|
||||
{
|
||||
if (layer_nr >= 0)
|
||||
{
|
||||
bool include_helper_parts = false;
|
||||
return storage.getLayerOutlines(layer_nr, include_helper_parts);
|
||||
}
|
||||
else
|
||||
{
|
||||
return storage.raftOutline;
|
||||
}
|
||||
}
|
||||
|
||||
LocToLineGrid& Comb::getOutsideLocToLine()
|
||||
{
|
||||
return *outside_loc_to_line;
|
||||
@@ -26,13 +39,14 @@ Comb::Comb(SliceDataStorage& storage, int layer_nr, Polygons& comb_boundary_insi
|
||||
: storage(storage)
|
||||
, layer_nr(layer_nr)
|
||||
, offset_from_outlines(comb_boundary_offset) // between second wall and infill / other walls
|
||||
, max_moveInside_distance2(offset_from_outlines * 2 * offset_from_outlines * 2)
|
||||
, max_move_inside_distance2(offset_from_outlines * 2 * offset_from_outlines * 2)
|
||||
, offset_from_outlines_outside(travel_avoid_distance)
|
||||
, offset_from_inside_to_outside(offset_from_outlines + offset_from_outlines_outside)
|
||||
, max_crossing_dist2(offset_from_inside_to_outside * offset_from_inside_to_outside * 2) // so max_crossing_dist = offset_from_inside_to_outside * sqrt(2) =approx 1.5 to allow for slightly diagonal crossings and slightly inaccurate crossing computation
|
||||
, avoid_other_parts(travel_avoid_other_parts)
|
||||
, boundary_inside( comb_boundary_inside )
|
||||
, partsView_inside( boundary_inside.splitIntoPartsView() ) // WARNING !! changes the order of boundary_inside !!
|
||||
, outlines(getCombOutlines())
|
||||
, inside_loc_to_line(PolygonUtils::createLocToLineGrid(boundary_inside, comb_boundary_offset))
|
||||
, boundary_outside(
|
||||
[&storage, layer_nr, travel_avoid_distance]()
|
||||
@@ -221,15 +235,30 @@ bool Comb::moveInside(bool is_inside, Point& dest_point, unsigned int& inside_po
|
||||
{
|
||||
if (is_inside)
|
||||
{
|
||||
ClosestPolygonPoint cpp = PolygonUtils::ensureInsideOrOutside(boundary_inside, dest_point, offset_extra_start_end, max_moveInside_distance2, &boundary_inside, inside_loc_to_line);
|
||||
coord_t max_move_inside_distance2_here = std::numeric_limits<coord_t>::max(); // the distance which would make the moveInside fail
|
||||
if (storage.getSettingAsCombingMode("retraction_combing") == cura::CombingMode::NO_SKIN)
|
||||
{ // if we perform no_skin combing, then a far move inside is likely a consequence of there meing skin in between the destination point and the inside comb boundary
|
||||
// if we perform normal combing, then a far move inside is likely to be a consequence of sharp pointy segments in the layer part
|
||||
max_move_inside_distance2_here = max_move_inside_distance2;
|
||||
}
|
||||
Point original_dest_point = dest_point;
|
||||
ClosestPolygonPoint cpp = PolygonUtils::ensureInsideOrOutside(boundary_inside, dest_point, offset_extra_start_end, max_move_inside_distance2_here, &boundary_inside, inside_loc_to_line);
|
||||
if (!cpp.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
inside_poly = cpp.poly_idx;
|
||||
return true;
|
||||
if (vSize2(dest_point - original_dest_point) > max_move_inside_distance2 // only check for collision with outlines for long moves
|
||||
&& PolygonUtils::polygonCollidesWithLineSegment(outlines, dest_point, original_dest_point))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
inside_poly = cpp.poly_idx;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
const int layer_nr; //!< The layer number for the layer for which to compute the outside boundary, when needed.
|
||||
|
||||
const int64_t offset_from_outlines; //!< Offset from the boundary of a part to the comb path. (nozzle width / 2)
|
||||
const int64_t max_moveInside_distance2; //!< Maximal distance of a point to the Comb::boundary_inside which is still to be considered inside. (very sharp corners not allowed :S)
|
||||
const int64_t max_move_inside_distance2; //!< Maximal distance of a point to the Comb::boundary_inside which is still to be considered inside. (very sharp corners not allowed :S)
|
||||
const int64_t offset_from_outlines_outside; //!< Offset from the boundary of a part to a travel path which avoids it by this distance.
|
||||
const int64_t offset_from_inside_to_outside; //!< The sum of the offsets for the inside and outside boundary Comb::offset_from_outlines and Comb::offset_from_outlines_outside
|
||||
const int64_t max_crossing_dist2; //!< The maximal distance by which to cross the in_between area between inside and outside
|
||||
@@ -114,13 +114,19 @@ private:
|
||||
static const int64_t offset_extra_start_end = 100; //!< Distance to move start point and end point toward eachother to extra avoid collision with the boundaries.
|
||||
|
||||
const bool avoid_other_parts; //!< Whether to perform inverse combing a.k.a. avoid parts.
|
||||
|
||||
|
||||
Polygons& boundary_inside; //!< The boundary within which to comb.
|
||||
PartsView partsView_inside; //!< Structured indices onto boundary_inside which shows which polygons belong to which part.
|
||||
Polygons outlines; //!< The actual boundary between the model and air
|
||||
LocToLineGrid* inside_loc_to_line; //!< The SparsePointGridInclusive mapping locations to line segments of the inner boundary.
|
||||
LazyInitialization<Polygons> boundary_outside; //!< The boundary outside of which to stay to avoid collision with other layer parts. This is a pointer cause we only compute it when we move outside the boundary (so not when there is only a single part in the layer)
|
||||
LazyInitialization<LocToLineGrid, Comb*, const int64_t> outside_loc_to_line; //!< The SparsePointGridInclusive mapping locations to line segments of the outside boundary.
|
||||
|
||||
/*!
|
||||
* Get the outlines of the meshes or raft for this layer
|
||||
*/
|
||||
Polygons getCombOutlines();
|
||||
|
||||
/*!
|
||||
* Get the SparsePointGridInclusive mapping locations to line segments of the outside boundary. Calculate it when it hasn't been calculated yet.
|
||||
*/
|
||||
|
||||
@@ -110,6 +110,33 @@ SliceDataStorage::SliceDataStorage(MeshGroup* meshgroup) : SettingsMessenger(mes
|
||||
{
|
||||
}
|
||||
|
||||
SliceLayerPart* SliceDataStorage::getPartInside(int layer_nr, Point location)
|
||||
{
|
||||
if (layer_nr >= 0)
|
||||
{
|
||||
for (SliceMeshStorage& mesh : meshes)
|
||||
{
|
||||
if ((unsigned int)layer_nr >= mesh.layers.size())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
SliceLayer& layer = mesh.layers[layer_nr];
|
||||
for (SliceLayerPart& part : layer.parts)
|
||||
{
|
||||
if (part.outline.inside(location))
|
||||
{
|
||||
return ∂
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
Polygons SliceDataStorage::getLayerOutlines(int layer_nr, bool include_helper_parts, bool external_polys_only) const
|
||||
{
|
||||
if (layer_nr < 0 && layer_nr < -Raft::getFillerLayerCount(*this))
|
||||
|
||||
@@ -239,6 +239,15 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* Check in which part \p location lies, if in any.
|
||||
*
|
||||
* \param layer_nr The layer for which to check
|
||||
* \param location The location to check
|
||||
* \return The part in which \p location lie, or nullptr, if it's outside all parts.
|
||||
*/
|
||||
SliceLayerPart* getPartInside(int layer_nr, Point location);
|
||||
|
||||
/*!
|
||||
* Get all outlines within a given layer.
|
||||
*
|
||||
|
||||
@@ -97,6 +97,27 @@ bool Polygons::inside(Point p, bool border_result) const
|
||||
return (poly_count_inside % 2) == 1;
|
||||
}
|
||||
|
||||
bool PolygonsPart::inside(Point p, bool border_result) const
|
||||
{
|
||||
if (size() < 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!(*this)[0].inside(p, border_result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (unsigned int n = 1; n < paths.size(); n++)
|
||||
{
|
||||
if ((*this)[n].inside(p, !border_result))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Polygons::insideOld(Point p, bool border_result) const
|
||||
{
|
||||
const Polygons& thiss = *this;
|
||||
|
||||
+18
-15
@@ -476,6 +476,9 @@ public:
|
||||
Polygons() {}
|
||||
|
||||
Polygons(const Polygons& other) { paths = other.paths; }
|
||||
|
||||
virtual ~Polygons() {}
|
||||
|
||||
Polygons& operator=(const Polygons& other) { paths = other.paths; return *this; }
|
||||
|
||||
bool operator==(const Polygons& other) const =delete;
|
||||
@@ -549,7 +552,7 @@ public:
|
||||
* \param border_result What to return when the point is exactly on the border
|
||||
* \return Whether the point \p p is inside this polygon (or \p border_result when it is on the border)
|
||||
*/
|
||||
bool inside(Point p, bool border_result = false) const;
|
||||
virtual bool inside(Point p, bool border_result = false) const;
|
||||
|
||||
/*!
|
||||
* Check if we are inside the polygon. We do this by tracing from the point towards the positive X direction,
|
||||
@@ -893,20 +896,20 @@ public:
|
||||
Polygons& thiss = *this;
|
||||
return thiss[0];
|
||||
}
|
||||
|
||||
bool inside(Point p)
|
||||
{
|
||||
if (size() < 1)
|
||||
return false;
|
||||
if (!(*this)[0].inside(p))
|
||||
return false;
|
||||
for(unsigned int n=1; n<paths.size(); n++)
|
||||
{
|
||||
if ((*this)[n].inside(p))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Check if we are inside the polygon.
|
||||
*
|
||||
* We do this by counting the number of polygons inside which this point lies.
|
||||
* An odd number is inside, while an even number is outside.
|
||||
*
|
||||
* Returns false if outside, true if inside; if the point lies exactly on the border, will return \p border_result.
|
||||
*
|
||||
* \param p The point for which to check if it is inside this polygon
|
||||
* \param border_result What to return when the point is exactly on the border
|
||||
* \return Whether the point \p p is inside this polygon (or \p border_result when it is on the border)
|
||||
*/
|
||||
virtual bool inside(Point p, bool border_result = false) const;
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
@@ -36,9 +36,9 @@ void GCodePlannerTest::setUp()
|
||||
fan_speed_layer_time_settings.cool_min_speed = 0.5;
|
||||
std::vector<FanSpeedLayerTimeSettings> fan_speed_layer_time_settings_per_extruder;
|
||||
fan_speed_layer_time_settings_per_extruder.push_back(fan_speed_layer_time_settings);
|
||||
// Slice layer z layer last current is inside fan speed and layer combing comb travel travel avoid
|
||||
// storage nr height position extruder mesh time settings mode offset avoid distance
|
||||
gCodePlanner = new GCodePlanner(*storage, 0, 0, 0.1, Point(0,0), 0, false, fan_speed_layer_time_settings_per_extruder, CombingMode::OFF, 100, false, 50 );
|
||||
// Slice layer z layer last current fan speed and layer combing comb travel travel avoid
|
||||
// storage nr height position extruder time settings mode offset avoid distance
|
||||
gCodePlanner = new GCodePlanner(*storage, 0, 0, 0.1, Point(0,0), 0, fan_speed_layer_time_settings_per_extruder, CombingMode::OFF, 100, false, 50 );
|
||||
}
|
||||
|
||||
void GCodePlannerTest::tearDown()
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário