Skip to content

Commit ebdba8d

Browse files
authored
Merge branch 'main' into CURA-12474_set-fixed-0-gap-for-brim-support
2 parents 0bfd746 + a1298f1 commit ebdba8d

File tree

4 files changed

+82
-82
lines changed

4 files changed

+82
-82
lines changed

src/FffGcodeWriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,8 @@ bool FffGcodeWriter::getExtruderNeedPrimeBlobDuringFirstLayer(const SliceDataSto
13171317
// check the settings if the prime blob is disabled
13181318
if (need_prime_blob)
13191319
{
1320-
const bool is_extruder_used_overall = storage.getExtrudersUsed()[extruder_nr];
1320+
const auto& used_extruders = storage.getExtrudersUsed();
1321+
const bool is_extruder_used_overall = extruder_nr < used_extruders.size() && used_extruders[extruder_nr];
13211322
const bool extruder_prime_blob_enabled = storage.getExtruderPrimeBlobEnabled(extruder_nr);
13221323

13231324
need_prime_blob = is_extruder_used_overall && extruder_prime_blob_enabled;

src/LayerPlan.cpp

Lines changed: 77 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ LayerPlan::LayerPlan(
116116
size_t current_extruder = start_extruder;
117117
was_inside_ = true; // not used, because the first travel move is bogus
118118
is_inside_ = false; // assumes the next move will not be to inside a layer part (overwritten just before going into a layer part)
119-
if (Application::getInstance().current_slice_->scene.current_mesh_group->settings.get<CombingMode>("retraction_combing") != CombingMode::OFF)
119+
const auto& local_settings = Application::getInstance().current_slice_->scene.current_mesh_group->settings;
120+
if (local_settings.get<CombingMode>("retraction_combing") != CombingMode::OFF && local_settings.get<coord_t>("retraction_combing_avoid_distance") > 0)
120121
{
121122
comb_ = new Comb(storage, layer_nr, comb_boundary_minimum_, comb_boundary_preferred_, comb_boundary_offset, travel_avoid_distance, comb_move_inside_distance);
122123
}
@@ -1119,10 +1120,6 @@ void LayerPlan::addWallLine(
11191120
{
11201121
add_skin_extrusion(roofing_mask_, roofing_config);
11211122
}
1122-
else if (use_skin_config(flooring_mask_, flooring_config))
1123-
{
1124-
add_skin_extrusion(flooring_mask_, flooring_config);
1125-
}
11261123
else if (bridge_wall_mask_.empty())
11271124
{
11281125
// no bridges required
@@ -1137,102 +1134,102 @@ void LayerPlan::addWallLine(
11371134
GCodePathConfig::FAN_SPEED_DEFAULT,
11381135
travel_to_z);
11391136
}
1140-
else
1137+
else if (PolygonUtils::polygonCollidesWithLineSegment(bridge_wall_mask_, p0.toPoint2LL(), p1.toPoint2LL()))
11411138
{
1142-
// bridges may be required
1143-
if (PolygonUtils::polygonCollidesWithLineSegment(bridge_wall_mask_, p0.toPoint2LL(), p1.toPoint2LL()))
1144-
{
1145-
// the line crosses the boundary between supported and non-supported regions so one or more bridges are required
1139+
// the line crosses the boundary between supported and non-supported regions so one or more bridges are required
11461140

1147-
// determine which segments of the line are bridges
1141+
// determine which segments of the line are bridges
11481142

1149-
OpenLinesSet line_polys;
1150-
line_polys.addSegment(p0.toPoint2LL(), p1.toPoint2LL());
1151-
constexpr bool restitch = false; // only a single line doesn't need stitching
1152-
line_polys = bridge_wall_mask_.intersection(line_polys, restitch);
1143+
OpenLinesSet line_polys;
1144+
line_polys.addSegment(p0.toPoint2LL(), p1.toPoint2LL());
1145+
constexpr bool restitch = false; // only a single line doesn't need stitching
1146+
line_polys = bridge_wall_mask_.intersection(line_polys, restitch);
11531147

1154-
// line_polys now contains the wall lines that need to be printed using bridge_config
1148+
// line_polys now contains the wall lines that need to be printed using bridge_config
11551149

1156-
while (line_polys.size() > 0)
1150+
while (line_polys.size() > 0)
1151+
{
1152+
// find the bridge line segment that's nearest to the current point
1153+
size_t nearest = 0;
1154+
double smallest_dist2 = (cur_point - line_polys[0][0]).vSize2f();
1155+
for (size_t i = 1; i < line_polys.size(); ++i)
11571156
{
1158-
// find the bridge line segment that's nearest to the current point
1159-
size_t nearest = 0;
1160-
double smallest_dist2 = (cur_point - line_polys[0][0]).vSize2f();
1161-
for (size_t i = 1; i < line_polys.size(); ++i)
1157+
double dist2 = (cur_point - line_polys[i][0]).vSize2f();
1158+
if (dist2 < smallest_dist2)
11621159
{
1163-
double dist2 = (cur_point - line_polys[i][0]).vSize2f();
1164-
if (dist2 < smallest_dist2)
1165-
{
1166-
nearest = i;
1167-
smallest_dist2 = dist2;
1168-
}
1160+
nearest = i;
1161+
smallest_dist2 = dist2;
11691162
}
1170-
const OpenPolyline& bridge = line_polys[nearest];
1163+
}
1164+
const OpenPolyline& bridge = line_polys[nearest];
11711165

1172-
// set b0 to the nearest vertex and b1 the furthest
1173-
Point3LL b0 = bridge[0];
1174-
Point3LL b1 = bridge[1];
1166+
// set b0 to the nearest vertex and b1 the furthest
1167+
Point3LL b0 = bridge[0];
1168+
Point3LL b1 = bridge[1];
11751169

1176-
if ((cur_point - b1).vSize2f() < (cur_point - b0).vSize2f())
1177-
{
1178-
// swap vertex order
1179-
b0 = bridge[1];
1180-
b1 = bridge[0];
1181-
}
1170+
if ((cur_point - b1).vSize2f() < (cur_point - b0).vSize2f())
1171+
{
1172+
// swap vertex order
1173+
b0 = bridge[1];
1174+
b1 = bridge[0];
1175+
}
11821176

1183-
// extrude using default_config to the start of the next bridge segment
1177+
// extrude using default_config to the start of the next bridge segment
11841178

1185-
addNonBridgeLine(b0);
1179+
addNonBridgeLine(b0);
11861180

1187-
const double bridge_line_len = (b1 - cur_point).vSize();
1181+
const double bridge_line_len = (b1 - cur_point).vSize();
11881182

1189-
if (bridge_line_len >= min_bridge_line_len)
1190-
{
1191-
// extrude using bridge_config to the end of the next bridge segment
1183+
if (bridge_line_len >= min_bridge_line_len)
1184+
{
1185+
// extrude using bridge_config to the end of the next bridge segment
11921186

1193-
if (bridge_line_len > min_line_len)
1194-
{
1195-
addExtrusionMoveWithGradualOverhang(
1196-
b1,
1197-
bridge_config,
1198-
SpaceFillType::Polygons,
1199-
flow,
1200-
width_factor,
1201-
spiralize,
1202-
1.0_r,
1203-
GCodePathConfig::FAN_SPEED_DEFAULT,
1204-
travel_to_z);
1205-
non_bridge_line_volume = 0;
1206-
cur_point = b1;
1207-
// after a bridge segment, start slow and accelerate to avoid under-extrusion due to extruder lag
1208-
speed_factor = std::max(std::min(Ratio(bridge_config.getSpeed() / default_config.getSpeed()), 1.0_r), 0.5_r);
1209-
}
1210-
}
1211-
else
1187+
if (bridge_line_len > min_line_len)
12121188
{
1213-
// treat the short bridge line just like a normal line
1214-
1215-
addNonBridgeLine(b1);
1189+
addExtrusionMoveWithGradualOverhang(
1190+
b1,
1191+
bridge_config,
1192+
SpaceFillType::Polygons,
1193+
flow,
1194+
width_factor,
1195+
spiralize,
1196+
1.0_r,
1197+
GCodePathConfig::FAN_SPEED_DEFAULT,
1198+
travel_to_z);
1199+
non_bridge_line_volume = 0;
1200+
cur_point = b1;
1201+
// after a bridge segment, start slow and accelerate to avoid under-extrusion due to extruder lag
1202+
speed_factor = std::max(std::min(Ratio(bridge_config.getSpeed() / default_config.getSpeed()), 1.0_r), 0.5_r);
12161203
}
1204+
}
1205+
else
1206+
{
1207+
// treat the short bridge line just like a normal line
12171208

1218-
// finished with this segment
1219-
line_polys.removeAt(nearest);
1209+
addNonBridgeLine(b1);
12201210
}
12211211

1222-
// if we haven't yet reached p1, fill the gap with default_config line
1223-
addNonBridgeLine(p1);
1224-
}
1225-
else if (bridge_wall_mask_.inside(p0.toPoint2LL(), true) && (p0 - p1).vSize() >= min_bridge_line_len)
1226-
{
1227-
// both p0 and p1 must be above air (the result will be ugly!)
1228-
addExtrusionMoveWithGradualOverhang(p1, bridge_config, SpaceFillType::Polygons, flow, width_factor);
1229-
non_bridge_line_volume = 0;
1230-
}
1231-
else
1232-
{
1233-
// no part of the line is above air or the line is too short to print as a bridge line
1234-
addNonBridgeLine(p1);
1212+
// finished with this segment
1213+
line_polys.removeAt(nearest);
12351214
}
1215+
1216+
// if we haven't yet reached p1, fill the gap with default_config line
1217+
addNonBridgeLine(p1);
1218+
}
1219+
else if (bridge_wall_mask_.inside(p0.toPoint2LL(), true) && (p0 - p1).vSize() >= min_bridge_line_len)
1220+
{
1221+
// both p0 and p1 must be above air (the result will be ugly!)
1222+
addExtrusionMoveWithGradualOverhang(p1, bridge_config, SpaceFillType::Polygons, flow, width_factor);
1223+
non_bridge_line_volume = 0;
1224+
}
1225+
else if (use_skin_config(flooring_mask_, flooring_config))
1226+
{
1227+
add_skin_extrusion(flooring_mask_, flooring_config);
1228+
}
1229+
else
1230+
{
1231+
// no part of the line is above air or the line is too short to print as a bridge line
1232+
addNonBridgeLine(p1);
12361233
}
12371234
}
12381235

src/support.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ void AreaSupport::generateSupportAreasForMesh(
10141014
return;
10151015
}
10161016

1017-
if (ranges::all_of(
1017+
if ((! mesh.settings.get<bool>("support_mesh"))
1018+
&& ranges::all_of(
10181019
mesh.overhang_areas,
10191020
[](const Shape& overhang_area)
10201021
{

tests/FffGcodeWriterTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class FffGcodeWriterTest : public testing::Test
7676
}
7777

7878
settings->add("infill_line_distance", "10");
79+
settings->add("retraction_combing_avoid_distance", "0");
7980

8081
Application::getInstance().current_slice_->scene.extruders.emplace_back(0, settings); // Add an extruder train.
8182

0 commit comments

Comments
 (0)