Compare commits

...
Author SHA1 Message Date
Hanif Koh f5bd05d20d Stop Exporting Names Through Usings in GUI and Voronoi Headers
Each of these headers put a using or namespace alias at global or
namespace scope, which every includer inherited:

- BBLTopbar.hpp: "using namespace Slic3r::GUI;" at global scope, reached
  through MainFrame.hpp. Seven source files used GUI names unqualified
  outside the namespace because of it, one of them as "::RadioBox".
- IMSlider.hpp and TickCode.hpp: "using namespace CustomGCode;" inside
  Slic3r.
- ProjectTask.hpp, Jobs/PrintJob.hpp and ConfigWizard_private.hpp:
  "namespace fs = boost::filesystem;". PresetBundle.cpp and GUI_App.cpp
  had no alias of their own.
- VoronoiUtils.hpp: "using VD = Slic3r::Geometry::VoronoiDiagram;" at
  global scope.

The headers now spell the names out. Source files that used them get
the qualifier, or a using of their own where there are many uses.
2026-10-07 01:38:53 +08:00
Rodrigo Faselli 13d4a0d922 Avoid center plug for internal solid infill (spiral inset) (#15705)
avoid center plug for internal solid infill
2026-10-06 11:41:25 -03:00
Ian Bassi c74ac8a6c3 Keep FPS/timings overlay below the toolbar on narrow canvases (#16215) 2026-10-06 11:36:47 -03:00
Ian Bassi 2d90345d1e Move fill-pattern-tops wiki under 3D Honeycomb (#16214) 2026-10-06 10:34:28 -03:00
Ioannis Giannakas 5a8eb3f14e Fix one wall on top dropping inner walls of narrow Arachne walls (#16174)
* Fix one wall on top dropping inner walls of narrow Arachne walls

* Fix clang tidy errors on the test suite
2026-10-06 14:07:01 +01:00
Kris Austin e7d6f5e6c0 fix: crash in LAN mode when the printer type is not known yet (#16191)
* fix: crash in LAN mode when the printer type is not known yet

InputIpAddressDialog::set_machine_obj() built the help image name from
the printer config with no fallback. If the printer type is empty or
unknown, for example before the first push_all arrives on a flaky LAN
link, the lookup returns "" and create_scaled_bitmap("_en") throws.
The dialog is opened by the "LAN Connection Failed" handlers in
MediaPlayCtrl and MediaFilePanel, where nothing catches the exception,
so the app crashes.

Use input_access_code_x1 when there is no image, and the _cn image for
zh_CN, the same as ConnectPrinterDialog::init_bitmap().

Ported from Bambu Studio 52ca2ec5d1.

* fix: return an empty bitmap for an empty icon name

create_scaled_bitmap() threw when a caller passed an empty name. That
happens when a printer config lookup has no entry, for example in
AMSSetting::update_ams_img() for a printer type with no AMS image.
Log an error and return wxNullBitmap instead.

Ported from Bambu Studio 52ca2ec5d1.
2026-10-06 09:55:25 -03:00
30 changed files with 355 additions and 109 deletions
+10
View File
@@ -352,6 +352,16 @@ void FillSpiralInset::_fill_surface_single(const FillParams& params,
assert(params.use_arachne); assert(params.use_arachne);
assert(this->print_config != nullptr && this->print_object_config != nullptr); assert(this->print_config != nullptr && this->print_object_config != nullptr);
// Internal solid infill must not add Arachne's standalone thin walls: one of those walls can
// become the extra centre point after the spiral has finished. Top and bottom surfaces keep
// Arachne, including the centre plug handled by generate_spiral_insets().
if (params.extrusion_role == erSolidInfill) {
Polylines polylines;
this->_fill_surface_single(params, thickness_layers, direction, expolygon, polylines);
append(thick_polylines_out, to_thick_polylines(std::move(polylines), scaled<coord_t>(this->spacing)));
return;
}
// Only a solid surface is worth the variable width walls; a sparse one falls back to plain loops. // Only a solid surface is worth the variable width walls; a sparse one falls back to plain loops.
if (params.density <= 0.9999f || params.dont_adjust) { if (params.density <= 0.9999f || params.dont_adjust) {
Polylines polylines; Polylines polylines;
+1
View File
@@ -16,6 +16,7 @@
namespace Slic3r::Geometry { namespace Slic3r::Geometry {
using VD = VoronoiDiagram;
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator; using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
using LinesIt = Lines::iterator; using LinesIt = Lines::iterator;
using ColoredLinesConstIt = ColoredLines::const_iterator; using ColoredLinesConstIt = ColoredLines::const_iterator;
+1
View File
@@ -20,6 +20,7 @@
namespace Slic3r::Geometry { namespace Slic3r::Geometry {
using VD = VoronoiDiagram;
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator; using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
using LinesIt = Lines::iterator; using LinesIt = Lines::iterator;
using ColoredLinesIt = ColoredLines::iterator; using ColoredLinesIt = ColoredLines::iterator;
+14 -16
View File
@@ -10,8 +10,6 @@
#include "libslic3r/Point.hpp" #include "libslic3r/Point.hpp"
#include "libslic3r/libslic3r.h" #include "libslic3r/libslic3r.h"
using VD = Slic3r::Geometry::VoronoiDiagram;
namespace Slic3r::Geometry { namespace Slic3r::Geometry {
// Represent trapezoid Voronoi cell around segment. // Represent trapezoid Voronoi cell around segment.
@@ -19,8 +17,8 @@ template<typename PT> struct SegmentCellRange
{ {
const PT source_segment_start_point; // The start point of the source segment of this cell. const PT source_segment_start_point; // The start point of the source segment of this cell.
const PT source_segment_end_point; // The end point of the source segment of this cell. const PT source_segment_end_point; // The end point of the source segment of this cell.
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
SegmentCellRange() = delete; SegmentCellRange() = delete;
explicit SegmentCellRange(const PT &source_segment_start_point, const PT &source_segment_end_point) explicit SegmentCellRange(const PT &source_segment_start_point, const PT &source_segment_end_point)
@@ -34,8 +32,8 @@ template<typename PT> struct SegmentCellRange
template<typename PT> struct PointCellRange template<typename PT> struct PointCellRange
{ {
const PT source_point; // The source point of this cell. const PT source_point; // The source point of this cell.
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts. const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends. const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
PointCellRange() = delete; PointCellRange() = delete;
explicit PointCellRange(const PT &source_point) : source_point(source_point) {} explicit PointCellRange(const PT &source_point) : source_point(source_point) {}
@@ -46,20 +44,20 @@ template<typename PT> struct PointCellRange
class VoronoiUtils class VoronoiUtils
{ {
public: public:
static Vec2i64 to_point(const VD::vertex_type *vertex); static Vec2i64 to_point(const VoronoiDiagram::vertex_type *vertex);
static Vec2i64 to_point(const VD::vertex_type &vertex); static Vec2i64 to_point(const VoronoiDiagram::vertex_type &vertex);
static bool is_finite(const VD::vertex_type &vertex); static bool is_finite(const VoronoiDiagram::vertex_type &vertex);
static VD::vertex_type make_rotated_vertex(VD::vertex_type &vertex, double angle); static VoronoiDiagram::vertex_type make_rotated_vertex(VoronoiDiagram::vertex_type &vertex, double angle);
template<typename SegmentIterator> template<typename SegmentIterator>
static typename boost::polygon::enable_if< static typename boost::polygon::enable_if<
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept< typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type, typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
typename std::iterator_traits<SegmentIterator>::reference>::type typename std::iterator_traits<SegmentIterator>::reference>::type
get_source_segment(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); get_source_segment(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
template<typename SegmentIterator> template<typename SegmentIterator>
static typename boost::polygon::enable_if< static typename boost::polygon::enable_if<
@@ -73,7 +71,7 @@ public:
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept< typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type, typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
Arachne::PolygonsPointIndex>::type Arachne::PolygonsPointIndex>::type
get_source_point_index(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); get_source_point_index(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
/** /**
* Discretize a parabola based on (approximate) step size. * Discretize a parabola based on (approximate) step size.
@@ -113,7 +111,7 @@ public:
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type, typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
Geometry::SegmentCellRange< Geometry::SegmentCellRange<
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
compute_segment_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); compute_segment_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
/** /**
* Compute the range of line segments that surround a cell of the skeletal * Compute the range of line segments that surround a cell of the skeletal
@@ -140,19 +138,19 @@ public:
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type, typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
Geometry::PointCellRange< Geometry::PointCellRange<
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
compute_point_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end); compute_point_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
template<typename T> static bool is_in_range(double value) template<typename T> static bool is_in_range(double value)
{ {
return double(std::numeric_limits<T>::lowest()) <= value && value <= double(std::numeric_limits<T>::max()); return double(std::numeric_limits<T>::lowest()) <= value && value <= double(std::numeric_limits<T>::max());
} }
template<typename T> static bool is_in_range(const VD::vertex_type &vertex) template<typename T> static bool is_in_range(const VoronoiDiagram::vertex_type &vertex)
{ {
return VoronoiUtils::is_finite(vertex) && is_in_range<T>(vertex.x()) && is_in_range<T>(vertex.y()); return VoronoiUtils::is_finite(vertex) && is_in_range<T>(vertex.x()) && is_in_range<T>(vertex.y());
} }
template<typename T> static bool is_in_range(const VD::edge_type &edge) template<typename T> static bool is_in_range(const VoronoiDiagram::edge_type &edge)
{ {
if (edge.vertex0() == nullptr || edge.vertex1() == nullptr) if (edge.vertex0() == nullptr || edge.vertex1() == nullptr)
return false; return false;
@@ -63,6 +63,7 @@ namespace Slic3r { enum class EnforcerBlockerType : int8_t; }
namespace Slic3r { namespace Slic3r {
using boost::polygon::voronoi_diagram; using boost::polygon::voronoi_diagram;
using VD = Geometry::VoronoiDiagram;
static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; } static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; }
+125 -26
View File
@@ -759,6 +759,59 @@ static void clip_inner_walls_over_top(std::vector<Arachne::VariableWidthLines> &
} }
} }
// ORCA: only_one_wall_top - widest bead of the given walls.
static coord_t widest_bead(const std::vector<Arachne::VariableWidthLines> &walls)
{
coord_t widest = 0;
for (const Arachne::VariableWidthLines &group : walls)
for (const Arachne::ExtrusionLine &el : group)
for (const Arachne::ExtrusionJunction &j : el.junctions)
widest = std::max(widest, j.w);
return widest;
}
// ORCA: only_one_wall_top - length of the walls running further than tolerance from the reference walls, outside the
// excluded area.
static double length_off_reference(const std::vector<Arachne::VariableWidthLines> &walls, const Arachne::VariableWidthLines &reference,
const ExPolygons &excluded, coord_t tolerance)
{
auto append_centerlines = [](const Arachne::VariableWidthLines &lines, Polylines &out) {
for (const Arachne::ExtrusionLine &el : lines) {
if (el.junctions.size() < 2)
continue;
Polyline &centerline = out.emplace_back();
centerline.points.reserve(el.junctions.size());
for (const Arachne::ExtrusionJunction &j : el.junctions)
centerline.points.emplace_back(j.p);
}
};
Polylines wall_centerlines;
Polylines reference_centerlines;
for (const Arachne::VariableWidthLines &group : walls)
append_centerlines(group, wall_centerlines);
append_centerlines(reference, reference_centerlines);
Polylines off_reference = diff_pl(wall_centerlines, offset(reference_centerlines, float(tolerance)));
if (! excluded.empty())
off_reference = diff_pl(off_reference, excluded);
return total_length(off_reference);
}
// ORCA: only_one_wall_top - area covered by the given walls at their local widths.
static Polygons walls_footprint(const Arachne::VariableWidthLines &walls)
{
Polygons footprint;
for (const Arachne::ExtrusionLine &el : walls)
for (size_t i = 1; i < el.junctions.size(); ++ i) {
const Arachne::ExtrusionJunction &a = el.junctions[i - 1];
const Arachne::ExtrusionJunction &b = el.junctions[i];
const coord_t width = std::max(a.w, b.w);
if (width > 0)
append(footprint, offset(Polyline(a.p, b.p), float(width) / 2.f));
}
return union_(footprint);
}
void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExPolygons &top_fills, void PerimeterGenerator::split_top_surfaces(const ExPolygons &orig_polygons, ExPolygons &top_fills,
ExPolygons &non_top_polygons, ExPolygons &fill_clip) const { ExPolygons &non_top_polygons, ExPolygons &fill_clip) const {
// other perimeters // other perimeters
@@ -2546,44 +2599,90 @@ void PerimeterGenerator::process_arachne()
if (inner_loop_number >= 0) { if (inner_loop_number >= 0) {
assert(upper_slices != nullptr); assert(upper_slices != nullptr);
// Infill contour bounding box.
BoundingBox infill_contour_bbox = get_extents(infill_contour);
infill_contour_bbox.offset(SCALED_EPSILON);
coord_t perimeter_width = this->perimeter_flow.scaled_width(); coord_t perimeter_width = this->perimeter_flow.scaled_width();
// Get top ExPolygons from current infill contour. // Filter out areas that are too thin and expand top surface polygons a bit to hide the wall line.
Polygons upper_slices_clipped; // ORCA: skip if the top surface area is smaller than "min_width_top_surface"
if (object_config->interface_shells) { const float top_surface_min_width = std::max<float>(float(ext_perimeter_spacing) / 4.f + scaled<float>(0.00001), float(scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))) / 4.f);
auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces);
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, infill_contour_bbox);
} else
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, infill_contour_bbox);
top_expolygons = diff_ex(infill_contour, upper_slices_clipped); // Get top ExPolygons from the given contour. uncovered reports whether the upper layer leaves any of the
// contour uncovered, before bridges and too thin areas are filtered out.
auto get_top_expolygons = [&](const ExPolygons &contour, bool &uncovered) {
// Contour bounding box.
BoundingBox contour_bbox = get_extents(contour);
contour_bbox.offset(SCALED_EPSILON);
Polygons upper_slices_clipped;
if (object_config->interface_shells) {
auto upper_slicer_same_region = to_expolygons(this->upper_slices_same_region->surfaces);
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(upper_slicer_same_region, contour_bbox);
} else
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, contour_bbox);
ExPolygons top = diff_ex(contour, upper_slices_clipped);
uncovered = !top.empty();
if (top.empty())
return top;
if (!top_expolygons.empty()) {
if (lower_slices != nullptr) { if (lower_slices != nullptr) {
const float bridge_offset = float(std::max<coord_t>(ext_perimeter_spacing, perimeter_width)); const float bridge_offset = float(std::max<coord_t>(ext_perimeter_spacing, perimeter_width));
const Polygons lower_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*lower_slices, infill_contour_bbox); const Polygons lower_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*lower_slices, contour_bbox);
const ExPolygons current_slices_bridges = offset_ex(diff_ex(top_expolygons, lower_slices_clipped), bridge_offset); const ExPolygons current_slices_bridges = offset_ex(diff_ex(top, lower_slices_clipped), bridge_offset);
// Remove bridges from top surface polygons. // Remove bridges from top surface polygons.
top_expolygons = diff_ex(top_expolygons, current_slices_bridges); top = diff_ex(top, current_slices_bridges);
} }
// Filter out areas that are too thin and expand top surface polygons a bit to hide the wall line.
// ORCA: skip if the top surface area is smaller than "min_width_top_surface"
const float top_surface_min_width = std::max<float>(float(ext_perimeter_spacing) / 4.f + scaled<float>(0.00001), float(scale_(config->min_width_top_surface.get_abs_value(unscale_(perimeter_width)))) / 4.f);
// Shrink the polygon to remove the small areas, then expand it back out plus a maragin to hide the wall line a little. // Shrink the polygon to remove the small areas, then expand it back out plus a maragin to hide the wall line a little.
// ORCA: Expand the polygon with half the perimeter width in addition to the contracted amount, // ORCA: Expand the polygon with half the perimeter width in addition to the contracted amount,
// not the full perimeter width as PS does, to enable thin lettering to print on the top surface without nozzle collisions // not the full perimeter width as PS does, to enable thin lettering to print on the top surface without nozzle collisions
// due to thin lines being generated // due to thin lines being generated
top_expolygons = offset2_ex(top_expolygons, -top_surface_min_width, top_surface_min_width + float(perimeter_width * 0.85)); top = offset2_ex(top, -top_surface_min_width, top_surface_min_width + float(perimeter_width * 0.85));
// Get final top ExPolygons (bridges were excluded above, so they stay walled). // Get final top ExPolygons (bridges were excluded above, so they stay walled).
top_expolygons = intersection_ex(top_expolygons, infill_contour); return intersection_ex(top, contour);
};
// Walls with the full count, as generated when the single perimeter feature is disabled. Generated on first use.
std::vector<Arachne::VariableWidthLines> full_perimeters;
Polygons full_inner_contour;
bool full_perimeters_generated = false;
auto generate_full_perimeters = [&]() {
if (full_perimeters_generated)
return;
Arachne::WallToolPaths full_tool_paths(last_p, bead_width_0, perimeter_spacing, coord_t(inner_loop_number + 2), wall_0_inset, layer_height, input_params_tmp);
full_perimeters = full_tool_paths.getToolPaths();
full_inner_contour = full_tool_paths.getInnerContour();
full_perimeters_generated = true;
};
// ORCA: the single wall pass allows Arachne 2 beads across a wall, so it fills a wall narrower than 3 outer wall
// widths by widening both, where the full pass adds a middle bead. Over the top surface that is the intent;
// anywhere else it leaves no room for the inner walls. When the single wall pass's outer walls run away from
// the full pass's outside the top surface, take the full pass's outer walls and the area inside them instead.
// Walls closer than outer_wall_tolerance count as the same wall: a widened bead's centerline moves by half
// the width added, and only beads widened by more than twice the tolerance are looked for.
const coord_t outer_wall_tolerance = bead_width_0 / 10;
if (widest_bead(perimeters) > bead_width_0 + 2 * outer_wall_tolerance) {
// The single wall pass's inner contour where it widens no bead: inside nominal width outer walls.
const ExPolygons nominal_infill_contour = offset_ex(last, -float(bead_width_0 + wall_0_inset));
bool nominal_uncovered = false;
// Grown by an outer wall width to take in the outer walls bordering the top surface.
const ExPolygons top_zone = offset_ex(get_top_expolygons(nominal_infill_contour, nominal_uncovered), float(bead_width_0));
if (nominal_uncovered) {
generate_full_perimeters();
if (! full_perimeters.empty() && ! full_perimeters.front().empty() &&
length_off_reference(perimeters, full_perimeters.front(), top_zone, outer_wall_tolerance) > double(perimeter_width)) {
perimeters = { full_perimeters.front() };
infill_contour = diff_ex(nominal_infill_contour, walls_footprint(full_perimeters.front()), ApplySafetyOffset::Yes);
}
}
}
bool uncovered = false;
top_expolygons = get_top_expolygons(infill_contour, uncovered);
if (uncovered) {
// ORCA: onion the real region (inside the outer wall) so the remaining walls follow the actual // ORCA: onion the real region (inside the outer wall) so the remaining walls follow the actual
// geometry, then cut away the parts over the top surface. Re-onioning the non-top complement // geometry, then cut away the parts over the top surface. Re-onioning the non-top complement
// instead - the fallback when there is no top fill - walls the top/non-top interface and rings // instead - the fallback when there is no top fill - walls the top/non-top interface and rings
@@ -2612,11 +2711,11 @@ void PerimeterGenerator::process_arachne()
perimeters.insert(perimeters.end(), inner_perimeters.begin(), inner_perimeters.end()); perimeters.insert(perimeters.end(), inner_perimeters.begin(), inner_perimeters.end());
infill_contour = union_ex(top_expolygons, inner_wall_tool_paths.getInnerContour()); infill_contour = union_ex(top_expolygons, inner_wall_tool_paths.getInnerContour());
} else { } else {
// There is no top surface ExPolygon, so we call Arachne again with parameters // There is no top surface ExPolygon, so use the walls generated like when the single perimeter
// like when the single perimeter feature is disabled. // feature is disabled.
Arachne::WallToolPaths no_single_perimeter_tool_paths(last_p, bead_width_0, perimeter_spacing, coord_t(inner_loop_number + 2), wall_0_inset, layer_height, input_params_tmp); generate_full_perimeters();
perimeters = no_single_perimeter_tool_paths.getToolPaths(); perimeters = std::move(full_perimeters);
infill_contour = union_ex(no_single_perimeter_tool_paths.getInnerContour()); infill_contour = union_ex(full_inner_contour);
} }
} }
//PS //PS
+2
View File
@@ -80,6 +80,8 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
namespace fs = boost::filesystem;
// Mark string for localization and translate. // Mark string for localization and translate.
#define L(s) Slic3r::I18N::translate(s) #define L(s) Slic3r::I18N::translate(s)
+2 -4
View File
@@ -11,8 +11,6 @@
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
namespace Slic3r { namespace Slic3r {
class BBLProject; class BBLProject;
@@ -208,7 +206,7 @@ public:
std::string task_profile_id; /* profile id*/ std::string task_profile_id; /* profile id*/
std::string task_name; /* task name, generally filename as task name */ std::string task_name; /* task name, generally filename as task name */
std::string task_file; /* local full file path of 3mf or gcode */ std::string task_file; /* local full file path of 3mf or gcode */
fs::path task_path; /* local path of 3mf or gcode */ boost::filesystem::path task_path; /* local path of 3mf or gcode */
std::string task_gcode_in_3mf; /* gcode in 3mf */ std::string task_gcode_in_3mf; /* gcode in 3mf */
std::string task_create_time; /* time created by cloud */ std::string task_create_time; /* time created by cloud */
std::string task_thumbnail_url; /* url of task thumbnail */ std::string task_thumbnail_url; /* url of task thumbnail */
@@ -326,7 +324,7 @@ public:
std::string project_url_md5; /* md5 of project url file */ std::string project_url_md5; /* md5 of project url file */
std::string project_name; std::string project_name;
std::string project_3mf_file; std::string project_3mf_file;
fs::path project_path; boost::filesystem::path project_path;
std::string project_content; std::string project_content;
std::string project_country_code; std::string project_country_code;
+1
View File
@@ -41,6 +41,7 @@
#define TOPBAR_TITLE_WIDTH 300 #define TOPBAR_TITLE_WIDTH 300
using namespace Slic3r; using namespace Slic3r;
using namespace Slic3r::GUI;
enum CUSTOM_ID enum CUSTOM_ID
{ {
-2
View File
@@ -18,8 +18,6 @@ class wxMouseCaptureLostEvent;
class wxMouseEvent; class wxMouseEvent;
class wxWindow; class wxWindow;
using namespace Slic3r::GUI;
class CenteredTitle : public wxControl class CenteredTitle : public wxControl
{ {
public: public:
+2 -2
View File
@@ -218,7 +218,7 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f
void BackgroundSlicingProcess::process_fff() void BackgroundSlicingProcess::process_fff()
{ {
assert(m_print == m_fff_print); assert(m_print == m_fff_print);
PresetBundle& preset_bundle = *wxGetApp().preset_bundle; PresetBundle& preset_bundle = *GUI::wxGetApp().preset_bundle;
m_fff_print->is_BBL_printer() = preset_bundle.is_bbl_vendor(); m_fff_print->is_BBL_printer() = preset_bundle.is_bbl_vendor();
// BBS: add the logic to process from an existed gcode file // BBS: add the logic to process from an existed gcode file
if (m_print->finished()) { if (m_print->finished()) {
@@ -727,7 +727,7 @@ StringObjectException BackgroundSlicingProcess::validate(std::vector<StringObjec
assert(m_print != nullptr); assert(m_print != nullptr);
assert(m_print == m_fff_print); assert(m_print == m_fff_print);
m_fff_print->is_BBL_printer() = wxGetApp().preset_bundle->is_bbl_vendor(); m_fff_print->is_BBL_printer() = GUI::wxGetApp().preset_bundle->is_bbl_vendor();
return m_print->validate(warnings, collison_polygons, height_polygons); return m_print->validate(warnings, collison_polygons, height_polygons);
} }
+1 -3
View File
@@ -43,8 +43,6 @@
#include <wx/types.h> #include <wx/types.h>
namespace fs = boost::filesystem;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@@ -88,7 +86,7 @@ struct Bundle
// cache or its profile JSONs, whichever is usable. // cache or its profile JSONs, whichever is usable.
// Returns false if not loaded. Reason for that is logged as boost::log error. // Returns false if not loaded. Reason for that is logged as boost::log error.
//BBS: set BBL as default //BBS: set BBL as default
bool load(fs::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false); bool load(boost::filesystem::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
const std::string& vendor_id() const { return vendor_profile->id; } const std::string& vendor_id() const { return vendor_profile->id; }
}; };
+5 -5
View File
@@ -3622,7 +3622,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
if (extruder_id + 1 != static_cast<unsigned char>(item.extruder)) if (extruder_id + 1 != static_cast<unsigned char>(item.extruder))
continue; continue;
if (item.type != ColorChange) if (item.type != CustomGCode::ColorChange)
continue; continue;
if (!zs_built) { if (!zs_built) {
@@ -4789,10 +4789,10 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGui::SameLine(); ImGui::SameLine();
switch (custom_gcode.type) { switch (custom_gcode.type) {
case PausePrint: imgui.text(cgcode_pause_str); break; case CustomGCode::PausePrint: imgui.text(cgcode_pause_str); break;
case Template: imgui.text(cgcode_template_str); break; case CustomGCode::Template: imgui.text(cgcode_template_str); break;
case ToolChange: imgui.text(cgcode_toolchange_str); break; case CustomGCode::ToolChange: imgui.text(cgcode_toolchange_str); break;
case Custom: imgui.text(cgcode_custom_str); break; case CustomGCode::Custom: imgui.text(cgcode_custom_str); break;
default: imgui.text(cgcode_unknown_str); break; default: imgui.text(cgcode_unknown_str); break;
} }
ImGui::SameLine(max_len); ImGui::SameLine(max_len);
+9 -2
View File
@@ -184,12 +184,12 @@ static Slic3r::ColorRGBA DEFAULT_BG_LIGHT_COLOR_DARK = { 0.329f, 0.329f, 0.353f,
static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR = { 0.753f, 0.192f, 0.039f, 1.0f }; static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR = { 0.753f, 0.192f, 0.039f, 1.0f };
static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR_DARK = { 0.753f, 0.192f, 0.039f, 1.0f }; static Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR_DARK = { 0.753f, 0.192f, 0.039f, 1.0f };
void GLCanvas3D::update_render_colors() void Slic3r::GUI::GLCanvas3D::update_render_colors()
{ {
DEFAULT_BG_LIGHT_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_3D_Background]); DEFAULT_BG_LIGHT_COLOR = ImGuiWrapper::from_ImVec4(RenderColor::colors[RenderCol_3D_Background]);
} }
void GLCanvas3D::load_render_colors() void Slic3r::GUI::GLCanvas3D::load_render_colors()
{ {
RenderColor::colors[RenderCol_3D_Background] = ImGuiWrapper::to_ImVec4(DEFAULT_BG_LIGHT_COLOR); RenderColor::colors[RenderCol_3D_Background] = ImGuiWrapper::to_ImVec4(DEFAULT_BG_LIGHT_COLOR);
} }
@@ -7970,9 +7970,16 @@ void GLCanvas3D::_render_fps_overlay(int fps) const
const float margin = 10.0f * get_scale(); const float margin = 10.0f * get_scale();
const ImVec2 display_size = ImGui::GetIO().DisplaySize; const ImVec2 display_size = ImGui::GetIO().DisplaySize;
ImVec2 pos(display_size.x - margin, margin); ImVec2 pos(display_size.x - margin, margin);
// Last frame's size; zero until the overlay has been shown once.
const ImGuiWindow* self = ImGui::FindWindowByName("###fps_overlay");
const float left = pos.x - (self != nullptr ? self->Size.x : 0.0f);
// The Preview legend takes the top-right corner. // The Preview legend takes the top-right corner.
if (const ImGuiWindow* legend = ImGui::FindWindowByName("Legend"); m_canvas_type == ECanvasType::CanvasPreview && legend != nullptr && legend->Active) if (const ImGuiWindow* legend = ImGui::FindWindowByName("Legend"); m_canvas_type == ECanvasType::CanvasPreview && legend != nullptr && legend->Active)
pos = ImVec2(legend->Pos.x - margin, legend->Pos.y); pos = ImVec2(legend->Pos.x - margin, legend->Pos.y);
// The toolbar row can reach the corner on a narrow canvas; stack the overlay below it then.
else if (m_main_toolbar.is_enabled() &&
get_main_toolbar_offset() + m_main_toolbar.get_width() + m_separator_toolbar.get_width() + m_gizmos.get_scaled_total_width() + m_assemble_view_toolbar.get_width() > left)
pos.y = std::max(m_main_toolbar.get_height(), m_gizmos.get_scaled_total_height()) + margin;
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(1.0f, 0.0f)); ImGui::SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(1.0f, 0.0f));
ImGui::SetNextWindowBgAlpha(0.35f); ImGui::SetNextWindowBgAlpha(0.35f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f * get_scale()); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f * get_scale());
+1
View File
@@ -309,6 +309,7 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)(
#include <gtk/gtk.h> #include <gtk/gtk.h>
#endif #endif
namespace fs = boost::filesystem;
using namespace std::literals; using namespace std::literals;
namespace pt = boost::property_tree; namespace pt = boost::property_tree;
+1 -1
View File
@@ -396,7 +396,7 @@ void Preview::sys_color_changed()
// m_layers_slider->sys_color_changed(); // m_layers_slider->sys_color_changed();
} }
void Preview::on_tick_changed(Type type) void Preview::on_tick_changed(CustomGCode::Type type)
{ {
//if (type == Type::PausePrint) { //if (type == Type::PausePrint) {
// m_schedule_background_process(); // m_schedule_background_process();
+2
View File
@@ -46,6 +46,8 @@
namespace Slic3r { namespace Slic3r {
using namespace CustomGCode;
namespace GUI { namespace GUI {
// equal to 25 mm2 // equal to 25 mm2
+12 -13
View File
@@ -20,7 +20,6 @@ struct IMGUI_API ImRect;
namespace Slic3r { namespace Slic3r {
using namespace CustomGCode;
class PrintObject; class PrintObject;
class Layer; class Layer;
@@ -89,8 +88,8 @@ public:
void SetSliderValues(const std::vector<double> &values); void SetSliderValues(const std::vector<double> &values);
void SetSliderAlternateValues(const std::vector<double> &values) { m_alternate_values = values; } void SetSliderAlternateValues(const std::vector<double> &values) { m_alternate_values = values; }
Info GetTicksValues() const; CustomGCode::Info GetTicksValues() const;
void SetTicksValues(const Info &custom_gcode_per_print_z); void SetTicksValues(const CustomGCode::Info &custom_gcode_per_print_z);
void SetLayersTimes(const std::vector<float> &layers_times, float total_time); void SetLayersTimes(const std::vector<float> &layers_times, float total_time);
void SetLayersTimes(const std::vector<double> &layers_times); void SetLayersTimes(const std::vector<double> &layers_times);
@@ -98,8 +97,8 @@ public:
void SetDrawMode(DrawMode mode) { m_draw_mode = mode; } void SetDrawMode(DrawMode mode) { m_draw_mode = mode; }
//BBS //BBS
void SetExtraStyle(long style) { m_extra_style = style; } void SetExtraStyle(long style) { m_extra_style = style; }
void SetManipulationMode(Mode mode) { m_mode = mode; } void SetManipulationMode(CustomGCode::Mode mode) { m_mode = mode; }
Mode GetManipulationMode() const { return m_mode; } CustomGCode::Mode GetManipulationMode() const { return m_mode; }
void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder, bool can_change_color); void SetModeAndOnlyExtruder(const bool is_one_extruder_printed_model, const int only_extruder, bool can_change_color);
void SetExtruderColors(const std::vector<std::string> &extruder_colors); void SetExtruderColors(const std::vector<std::string> &extruder_colors);
@@ -117,8 +116,8 @@ public:
void UseDefaultColors(bool def_colors_on) { m_ticks.set_default_colors(def_colors_on); } void UseDefaultColors(bool def_colors_on) { m_ticks.set_default_colors(def_colors_on); }
void on_mouse_wheel(wxMouseEvent& evt); void on_mouse_wheel(wxMouseEvent& evt);
void post_ticks_changed_event(Type type = Unknown); void post_ticks_changed_event(CustomGCode::Type type = CustomGCode::Unknown);
bool check_ticks_changed_event(Type type); bool check_ticks_changed_event(CustomGCode::Type type);
bool switch_one_layer_mode(); bool switch_one_layer_mode();
void show_go_to_layer(bool show) { m_show_go_to_layer_dialog = show; } void show_go_to_layer(bool show) { m_show_go_to_layer_dialog = show; }
@@ -130,9 +129,9 @@ public:
bool is_need_post_tick_event() { return m_is_need_post_tick_changed_event; } bool is_need_post_tick_event() { return m_is_need_post_tick_changed_event; }
void reset_post_tick_event(bool val = false) { void reset_post_tick_event(bool val = false) {
m_is_need_post_tick_changed_event = val; m_is_need_post_tick_changed_event = val;
m_tick_change_event_type = Type::Unknown; m_tick_change_event_type = CustomGCode::Type::Unknown;
} }
Type get_post_tick_event_type() { return m_tick_change_event_type; } CustomGCode::Type get_post_tick_event_type() { return m_tick_change_event_type; }
float m_scale = 1.0; float m_scale = 1.0;
void set_scale(float scale = 1.0); void set_scale(float scale = 1.0);
@@ -143,7 +142,7 @@ public:
protected: protected:
void add_custom_gcode(std::string custom_gcode); void add_custom_gcode(std::string custom_gcode);
void add_code_as_tick(Type type, int selected_extruder = -1); void add_code_as_tick(CustomGCode::Type type, int selected_extruder = -1);
void delete_tick(const TickCode& tick); void delete_tick(const TickCode& tick);
void do_go_to_layer(size_t layer_number); //menu void do_go_to_layer(size_t layer_number); //menu
void correct_lower_value(); void correct_lower_value();
@@ -156,7 +155,7 @@ protected:
void render_edit_menu(const TickCode& tick); //menu void render_edit_menu(const TickCode& tick); //menu
void draw_background_and_groove(const ImRect& bg_rect, const ImRect& groove); void draw_background_and_groove(const ImRect& bg_rect, const ImRect& groove);
void draw_colored_band(const ImRect& groove, const ImRect& slideable_region); void draw_colored_band(const ImRect& groove, const ImRect& slideable_region);
void draw_custom_label_block(const ImVec2 anchor, Type type); void draw_custom_label_block(const ImVec2 anchor, CustomGCode::Type type);
void draw_ticks(const ImRect& slideable_region); void draw_ticks(const ImRect& slideable_region);
void draw_tick_on_mouse_position(const ImRect& slideable_region); void draw_tick_on_mouse_position(const ImRect& slideable_region);
void show_tooltip(const TickCode& tick); //menu void show_tooltip(const TickCode& tick); //menu
@@ -217,7 +216,7 @@ private:
void *m_delete_icon_id; void *m_delete_icon_id;
DrawMode m_draw_mode = dmRegular; DrawMode m_draw_mode = dmRegular;
Mode m_mode = SingleExtruder; CustomGCode::Mode m_mode = CustomGCode::SingleExtruder;
int m_only_extruder = -1; int m_only_extruder = -1;
long m_style; long m_style;
@@ -232,7 +231,7 @@ private:
bool m_can_change_color; bool m_can_change_color;
std::string m_print_obj_idxs; std::string m_print_obj_idxs;
bool m_is_need_post_tick_changed_event { false }; bool m_is_need_post_tick_changed_event { false };
Type m_tick_change_event_type; CustomGCode::Type m_tick_change_event_type;
std::vector<double> m_alternate_values; std::vector<double> m_alternate_values;
+3 -5
View File
@@ -12,8 +12,6 @@
#include "Job.hpp" #include "Job.hpp"
#include "slic3r/GUI/DeviceCore/DevStorage.h" #include "slic3r/GUI/DeviceCore/DevStorage.h"
namespace fs = boost::filesystem;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@@ -26,9 +24,9 @@ class PrintPrepareData
public: public:
bool is_from_plater = true; bool is_from_plater = true;
int plate_idx; int plate_idx;
fs::path _3mf_path; boost::filesystem::path _3mf_path;
fs::path _3mf_config_path; boost::filesystem::path _3mf_config_path;
fs::path _temp_path; boost::filesystem::path _temp_path;
PrintPrepareData() { PrintPrepareData() {
plate_idx = 0; plate_idx = 0;
} }
+3 -3
View File
@@ -8111,13 +8111,13 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); }); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); }); preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_COLLAPSE_SIDEBAR, [this](SimpleEvent&) { this->q->collapse_sidebar(!this->q->is_sidebar_collapsed()); });
preview->get_wxglcanvas()->Bind(EVT_CUSTOMEVT_TICKSCHANGED, [this](wxCommandEvent& event) { preview->get_wxglcanvas()->Bind(EVT_CUSTOMEVT_TICKSCHANGED, [this](wxCommandEvent& event) {
Type tick_event_type = (Type)event.GetInt(); CustomGCode::Type tick_event_type = (CustomGCode::Type)event.GetInt();
Model& model = wxGetApp().plater()->model(); Model& model = wxGetApp().plater()->model();
//BBS: replace model custom gcode with current plate custom gcode //BBS: replace model custom gcode with current plate custom gcode
model.plates_custom_gcodes[model.curr_plate_index] = preview->get_canvas3d()->get_gcode_viewer().get_layers_slider()->GetTicksValues(); model.plates_custom_gcodes[model.curr_plate_index] = preview->get_canvas3d()->get_gcode_viewer().get_layers_slider()->GetTicksValues();
// BBS set to invalid state only // BBS set to invalid state only
if (tick_event_type == Type::ToolChange || tick_event_type == Type::Custom || tick_event_type == Type::Template || tick_event_type == Type::PausePrint) { if (tick_event_type == CustomGCode::Type::ToolChange || tick_event_type == CustomGCode::Type::Custom || tick_event_type == CustomGCode::Type::Template || tick_event_type == CustomGCode::Type::PausePrint) {
PartPlate *plate = this->q->get_partplate_list().get_curr_plate(); PartPlate *plate = this->q->get_partplate_list().get_curr_plate();
if (plate) { if (plate) {
plate->update_slice_result_valid_state(false); plate->update_slice_result_valid_state(false);
@@ -20544,7 +20544,7 @@ void Plater::on_filaments_delete(size_t num_filaments, size_t filament_id, int r
// update customize gcode // update customize gcode
for (auto item = p->model.plates_custom_gcodes.begin(); item != p->model.plates_custom_gcodes.end(); ++item) { for (auto item = p->model.plates_custom_gcodes.begin(); item != p->model.plates_custom_gcodes.end(); ++item) {
auto iter = std::remove_if(item->second.gcodes.begin(), item->second.gcodes.end(), [filament_id](const Item& gcode_item) { auto iter = std::remove_if(item->second.gcodes.begin(), item->second.gcodes.end(), [filament_id](const CustomGCode::Item& gcode_item) {
return (gcode_item.type == CustomGCode::Type::ToolChange && gcode_item.extruder == filament_id + 1); return (gcode_item.type == CustomGCode::Type::ToolChange && gcode_item.extruder == filament_id + 1);
}); });
if (replace_filament_id == -1) if (replace_filament_id == -1)
+1 -1
View File
@@ -2177,7 +2177,7 @@ void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt)
wxPostEvent(m_parent, e); wxPostEvent(m_parent, e);
} }
void PlaterPresetComboBox::sys_color_changed() void GUI::PlaterPresetComboBox::sys_color_changed()
{ {
PresetComboBox::sys_color_changed(); PresetComboBox::sys_color_changed();
if (clr_picker) { if (clr_picker) {
+2 -2
View File
@@ -1752,8 +1752,8 @@ void ElegooPrintHostSendDialog::init() {
} }
{ {
auto radioBoxA = new ::RadioBox(this); auto radioBoxA = new RadioBox(this);
auto radioBoxB = new ::RadioBox(this); auto radioBoxB = new RadioBox(this);
if (m_BedType == BedType::btPC) if (m_BedType == BedType::btPC)
radioBoxB->SetValue(true); radioBoxB->SetValue(true);
else else
+4 -1
View File
@@ -1816,7 +1816,10 @@ void InputIpAddressDialog::set_machine_obj(MachineObject* obj)
m_input_printer_name->GetTextCtrl()->SetLabelText(m_obj->get_dev_name()); m_input_printer_name->GetTextCtrl()->SetLabelText(m_obj->get_dev_name());
std::string img_str = DevPrinterConfigUtil::get_printer_connect_help_img(m_obj->printer_type); std::string img_str = DevPrinterConfigUtil::get_printer_connect_help_img(m_obj->printer_type);
auto diagram_bmp = create_scaled_bitmap(img_str + "_en", this, 198); if (img_str.empty()) { img_str = "input_access_code_x1"; }
std::string language = wxGetApp().app_config->get("language");
auto diagram_bmp = create_scaled_bitmap(img_str + (language == "zh_CN" ? "_cn" : "_en"), this, 198);
m_img_help->SetBitmap(diagram_bmp); m_img_help->SetBitmap(diagram_bmp);
+1 -1
View File
@@ -2928,7 +2928,7 @@ void TabPrint::build()
optgroup->append_single_option_line("skin_infill_line_width", "strength_settings_patterns#locked-zag"); optgroup->append_single_option_line("skin_infill_line_width", "strength_settings_patterns#locked-zag");
optgroup->append_single_option_line("skeleton_infill_line_width", "strength_settings_patterns#locked-zag"); optgroup->append_single_option_line("skeleton_infill_line_width", "strength_settings_patterns#locked-zag");
optgroup->append_single_option_line("symmetric_infill_y_axis", "strength_settings_infill#symmetric-infill-y-axis"); optgroup->append_single_option_line("symmetric_infill_y_axis", "strength_settings_infill#symmetric-infill-y-axis");
optgroup->append_single_option_line("infill_complete_top", "strength_settings_infill#infill-complete-top"); optgroup->append_single_option_line("infill_complete_top", "strength_settings_patterns#fill-pattern-tops");
optgroup->append_single_option_line("infill_shift_step", "strength_settings_patterns#cross-hatch"); optgroup->append_single_option_line("infill_shift_step", "strength_settings_patterns#cross-hatch");
optgroup->append_single_option_line("lateral_lattice_angle_1", "strength_settings_patterns#lateral-lattice"); optgroup->append_single_option_line("lateral_lattice_angle_1", "strength_settings_patterns#lateral-lattice");
optgroup->append_single_option_line("lateral_lattice_angle_2", "strength_settings_patterns#lateral-lattice"); optgroup->append_single_option_line("lateral_lattice_angle_2", "strength_settings_patterns#lateral-lattice");
+3
View File
@@ -6,6 +6,9 @@
#include <set> #include <set>
namespace Slic3r { namespace Slic3r {
using namespace CustomGCode;
namespace GUI { namespace GUI {
std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int extruder) std::string TickCodeInfo::get_color_for_tick(TickCode tick, Type type, const int extruder)
{ {
+8 -9
View File
@@ -7,7 +7,6 @@
#include <vector> #include <vector>
namespace Slic3r { namespace Slic3r {
using namespace CustomGCode;
namespace GUI { namespace GUI {
struct TickCode struct TickCode
@@ -16,7 +15,7 @@ struct TickCode
bool operator>(const TickCode& other) const { return other.tick < this->tick; } bool operator>(const TickCode& other) const { return other.tick < this->tick; }
int tick = 0; int tick = 0;
Type type = ColorChange; CustomGCode::Type type = CustomGCode::ColorChange;
int extruder = 0; int extruder = 0;
std::string color; std::string color;
std::string extra; std::string extra;
@@ -31,22 +30,22 @@ class TickCodeInfo
std::vector<std::string>* m_colors{ nullptr };// reference to IMSlider::m_extruder_colors std::vector<std::string>* m_colors{ nullptr };// reference to IMSlider::m_extruder_colors
std::string get_color_for_tick(TickCode tick, Type type, const int extruder); std::string get_color_for_tick(TickCode tick, CustomGCode::Type type, const int extruder);
public: public:
std::set<TickCode> ticks{}; std::set<TickCode> ticks{};
Mode mode = Undef; CustomGCode::Mode mode = CustomGCode::Undef;
bool empty() const { return ticks.empty(); } bool empty() const { return ticks.empty(); }
void set_pause_print_msg(const std::string& message) { pause_print_msg = message; } void set_pause_print_msg(const std::string& message) { pause_print_msg = message; }
bool add_tick(const int tick, Type type, int extruder, double print_z); bool add_tick(const int tick, CustomGCode::Type type, int extruder, double print_z);
bool edit_tick(std::set<TickCode>::iterator it, double print_z); bool edit_tick(std::set<TickCode>::iterator it, double print_z);
void switch_code(Type type_from, Type type_to); void switch_code(CustomGCode::Type type_from, CustomGCode::Type type_to);
bool switch_code_for_tick(std::set<TickCode>::iterator it, Type type_to, const int extruder); bool switch_code_for_tick(std::set<TickCode>::iterator it, CustomGCode::Type type_to, const int extruder);
void erase_all_ticks_with_code(Type type); void erase_all_ticks_with_code(CustomGCode::Type type);
bool has_tick_with_code(Type type); bool has_tick_with_code(CustomGCode::Type type);
bool has_tick(int tick); bool has_tick(int tick);
void suppress_plus(bool suppress) { m_suppress_plus = suppress; } void suppress_plus(bool suppress) { m_suppress_plus = suppress; }
+7
View File
@@ -456,6 +456,13 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
const vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material) const vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material)
{ {
static Slic3r::GUI::BitmapCache cache; static Slic3r::GUI::BitmapCache cache;
// An empty name means the caller's icon lookup failed
if (bmp_name_in.empty() || bmp_name_in == ".png") {
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": empty bitmap name";
return wxNullBitmap;
}
if (bitmap2) { if (bitmap2) {
return create_scaled_bitmap2(bmp_name_in, cache, win, px_cnt, grayscale, resize, array_new_color); return create_scaled_bitmap2(bmp_name_in, cache, win, px_cnt, grayscale, resize, array_new_color);
} }
+1 -1
View File
@@ -115,7 +115,7 @@ static void set_auth(Http& http, const std::string& access_token) { http.header(
static bool should_open_in_external_browser() static bool should_open_in_external_browser()
{ {
const auto& app = wxGetApp(); const auto& app = GUI::wxGetApp();
if (app.preset_bundle->use_bbl_device_tab()) { if (app.preset_bundle->use_bbl_device_tab()) {
// When using bbl device tab, we always need to open external browser // When using bbl device tab, we always need to open external browser
+12 -12
View File
@@ -565,7 +565,7 @@ void progress_close(int id)
}); });
} }
void plater_notification(NotificationManager::NotificationLevel notification_level, const std::string& text, void plater_notification(GUI::NotificationManager::NotificationLevel notification_level, const std::string& text,
const std::string& hypertext, py::object on_click) const std::string& hypertext, py::object on_click)
{ {
const std::string plugin_key = PluginAuditManager::instance().current_plugin(); const std::string plugin_key = PluginAuditManager::instance().current_plugin();
@@ -600,7 +600,7 @@ void plater_notification(NotificationManager::NotificationLevel notification_lev
} }
run_on_ui_blocking([notification_level, text, hypertext, callback = std::move(callback)]() mutable { run_on_ui_blocking([notification_level, text, hypertext, callback = std::move(callback)]() mutable {
wxGetApp().plater()->get_notification_manager()->push_notification(NotificationType::CustomNotification, notification_level, text, GUI::wxGetApp().plater()->get_notification_manager()->push_notification(GUI::NotificationType::CustomNotification, notification_level, text,
hypertext, std::move(callback)); hypertext, std::move(callback));
}); });
} }
@@ -713,16 +713,16 @@ void PluginHostUi::RegisterBindings(pybind11::module_& host)
py::arg("maximum") = 100, py::arg("style") = wxPD_APP_MODAL | wxPD_AUTO_HIDE, py::arg("maximum") = 100, py::arg("style") = wxPD_APP_MODAL | wxPD_AUTO_HIDE,
"Create a native progress dialog and return a ProgressDialog handle."); "Create a native progress dialog and return a ProgressDialog handle.");
py::enum_<NotificationManager::NotificationLevel>(ui, "NotificationLevel") py::enum_<GUI::NotificationManager::NotificationLevel>(ui, "NotificationLevel")
.value("ProgressBarNotificationLevel", NotificationManager::NotificationLevel::ProgressBarNotificationLevel) .value("ProgressBarNotificationLevel", GUI::NotificationManager::NotificationLevel::ProgressBarNotificationLevel)
.value("HintNotificationLevel", NotificationManager::NotificationLevel::HintNotificationLevel) .value("HintNotificationLevel", GUI::NotificationManager::NotificationLevel::HintNotificationLevel)
.value("RegularNotificationLevel", NotificationManager::NotificationLevel::RegularNotificationLevel) .value("RegularNotificationLevel", GUI::NotificationManager::NotificationLevel::RegularNotificationLevel)
.value("PrintInfoNotificationLevel", NotificationManager::NotificationLevel::PrintInfoNotificationLevel) .value("PrintInfoNotificationLevel", GUI::NotificationManager::NotificationLevel::PrintInfoNotificationLevel)
.value("PrintInfoShortNotificationLevel", NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel) .value("PrintInfoShortNotificationLevel", GUI::NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel)
.value("ImportantNotificationLevel", NotificationManager::NotificationLevel::ImportantNotificationLevel) .value("ImportantNotificationLevel", GUI::NotificationManager::NotificationLevel::ImportantNotificationLevel)
.value("WarningNotificationLevel", NotificationManager::NotificationLevel::WarningNotificationLevel) .value("WarningNotificationLevel", GUI::NotificationManager::NotificationLevel::WarningNotificationLevel)
.value("SeriousWarningNotificationLevel", NotificationManager::NotificationLevel::SeriousWarningNotificationLevel) .value("SeriousWarningNotificationLevel", GUI::NotificationManager::NotificationLevel::SeriousWarningNotificationLevel)
.value("ErrorNotificationLevel", NotificationManager::NotificationLevel::ErrorNotificationLevel) .value("ErrorNotificationLevel", GUI::NotificationManager::NotificationLevel::ErrorNotificationLevel)
.export_values(); .export_values();
ui.def("push_notification", &plater_notification, py::arg("notification_level"), py::arg("text"), ui.def("push_notification", &plater_notification, py::arg("notification_level"), py::arg("text"),
+120
View File
@@ -19,8 +19,10 @@
#include <cstddef> #include <cstddef>
#include "libslic3r/libslic3r.h" #include "libslic3r/libslic3r.h"
#include "libslic3r/BoundingBox.hpp" #include "libslic3r/BoundingBox.hpp"
#include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/ExPolygon.hpp" #include "libslic3r/ExPolygon.hpp"
#include "libslic3r/Point.hpp" #include "libslic3r/Point.hpp"
#include "libslic3r/Polyline.hpp"
#include <limits> #include <limits>
#include <string> #include <string>
#include <utility> #include <utility>
@@ -275,6 +277,124 @@ TEST_CASE("Only one wall on the first layer needs a bottom shell", "[Perimeters]
namespace { namespace {
// The last layer of the tab, whose top surface shares an island with the tube walls rising past it.
const double tab_top_z = 5.0;
// With the widths below the tube walls are 1.10mm wide once the precise outer wall offset (0.043mm a side) is
// taken off. That is narrower than 3 outer wall spacings (3 x 0.377 = 1.131mm), so an Arachne pass limited to a
// single wall fills it by widening its 2 beads, yet wide enough for the full 2 wall pass to add a middle wall
// (from 1.062mm).
const double narrow_wall = 1.186;
// A 20x30x10 tube with narrow_wall thick walls, and a 20x8x5 tab against its -Y side.
Print &tube_with_tab(Print &print, Model &model, const DynamicPrintConfig &config)
{
ModelObject *object = model.add_object();
object->name = "tube_with_tab.stl";
object->add_volume(make_cube(20., 30., 10.), ModelVolumeType::MODEL_PART, false);
// Overlaps the tube wall by 0.5mm so the two parts slice as one island.
TriangleMesh tab = make_cube(20., 8.5, 5.);
tab.translate(0.f, -8.f, 0.f);
object->add_volume(std::move(tab), ModelVolumeType::MODEL_PART, false);
TriangleMesh bore = make_cube(20. - 2. * narrow_wall, 30. - 2. * narrow_wall, 12.);
bore.translate(float(narrow_wall), float(narrow_wall), -1.f);
object->add_volume(std::move(bore), ModelVolumeType::NEGATIVE_VOLUME, false);
object->add_instance();
object->ensure_on_bed();
print.auto_assign_extruders(object);
print.apply(model, config);
print.validate();
print.set_status_silent();
return print;
}
// Every width the narrow_wall arithmetic depends on, so none of them rests on a default.
DynamicPrintConfig narrow_wall_config(bool only_one_wall_top, double top_surface_expansion)
{
DynamicPrintConfig config = base_config("arachne");
config.set_deserialize_strict({
{ "wall_loops", 2 },
{ "nozzle_diameter", "0.4" },
{ "line_width", 0.42 },
{ "outer_wall_line_width", 0.42 },
{ "inner_wall_line_width", 0.45 },
{ "min_bead_width", "85%" },
{ "precise_outer_wall", true },
{ "wall_sequence", "inner wall/outer wall" },
{ "only_one_wall_top", only_one_wall_top },
{ "top_surface_expansion", top_surface_expansion },
});
return config;
}
// Inner wall length the layer at print_z extrudes within 3mm of its +Y edge: the tube wall facing away from the tab.
double far_wall_inner_wall_length(const Print &print, double print_z)
{
for (const Layer *layer : print.objects().front()->layers()) {
if (std::abs(layer->print_z - print_z) > EPSILON)
continue;
BoundingBox band = get_extents(layer->lslices);
band.min.y() = band.max.y() - scaled<coord_t>(3.);
Polylines inner_walls;
auto collect = [&inner_walls](const ExtrusionPaths &paths) {
for (const ExtrusionPath &path : paths)
if (path.role() == erPerimeter)
inner_walls.emplace_back(path.as_polyline());
};
for (const LayerRegion *region : layer->regions()) {
const ExtrusionEntityCollection walls = region->perimeters.flatten();
for (const ExtrusionEntity *entity : walls.entities) {
if (const auto *loop = dynamic_cast<const ExtrusionLoop*>(entity))
collect(loop->paths);
else if (const auto *multi_path = dynamic_cast<const ExtrusionMultiPath*>(entity))
collect(multi_path->paths);
else if (const auto *path = dynamic_cast<const ExtrusionPath*>(entity))
collect({ *path });
}
}
return unscaled<double>(total_length(intersection_pl(inner_walls, band.polygon())));
}
return 0.;
}
} // namespace
// only_one_wall_top first lays out an island with a single Arachne wall and generates the inner walls inside it.
// On a wall narrower than 3 outer wall spacings that single wall pass widens its 2 beads to fill the wall and leaves
// no room for the middle wall, which is only intended over the top surface. The tube walls away from the tab are not
// under the tab's top surface, so on the tab's last layer they keep the inner wall they get with the option off.
TEST_CASE("Only one wall on top surfaces keeps the inner walls of narrow walls away from the top surface", "[Perimeters]")
{
// 0 re-onions the region beside the top surface, 2 clips the inner walls over it.
const double top_surface_expansion = GENERATE(0.0, 2.0);
CAPTURE(top_surface_expansion);
struct TabTopLayer {
double perimeters;
double far_wall_inner_walls;
};
auto tab_top_layer_for = [top_surface_expansion](bool only_one_wall_top) {
Print print;
Model model;
tube_with_tab(print, model, narrow_wall_config(only_one_wall_top, top_surface_expansion));
print.process();
REQUIRE_FALSE(print.objects().empty());
return TabTopLayer{ perimeter_length_at(print, tab_top_z), far_wall_inner_wall_length(print, tab_top_z) };
};
const TabTopLayer plain = tab_top_layer_for(false);
const TabTopLayer one_wall = tab_top_layer_for(true);
// The option acts on this layer: the inner walls under the tab's top surface are gone.
REQUIRE(plain.far_wall_inner_walls > 10.);
CHECK(one_wall.perimeters < plain.perimeters);
CHECK_THAT(one_wall.far_wall_inner_walls, Catch::Matchers::WithinAbs(plain.far_wall_inner_walls, 1.0));
}
namespace {
// The layer that closes the cavity of box_over_cavity(), the first one printed over air. // The layer that closes the cavity of box_over_cavity(), the first one printed over air.
const double cavity_ceiling_z = 6.2; const double cavity_ceiling_z = 6.2;