Compare commits

...
Author SHA1 Message Date
Hanif Koh 1a5b372fd2 Declare json in OrcaSlicer.cpp on Every Platform
OrcaSlicer.cpp had its "using namespace nlohmann;" and the json include
inside the Linux-only include block, so on Windows and macOS it took
json from AppConfig.hpp's global directive, which is gone. The include
and a "using json = nlohmann::json;" now sit outside the block.
2026-10-07 02:45:49 +08:00
Hanif Koh d8793f8353 Stop Leaking json Through Headers and Drop Includes Kept Only for the Name
AppConfig.hpp, DeviceManager.hpp and UserManager.hpp carried a global
"using namespace nlohmann;", json_diff.hpp a global "using json =
nlohmann::json;" and PrinterFileSystem.h a global "using nlohmann::json;".
Every file that included one of them, directly or not, could write a
bare json, and 63 did without declaring it.

The last two also made the include checker treat json_diff.hpp and
PrinterFileSystem.h as the headers that provide json, so they were
included from files that use nothing else from them: 57 of the 59
includers of json_diff.hpp never name json_diff.

The five statements are removed. Headers that use the type now spell
nlohmann::json, source files declare their own "using json =
nlohmann::json;", and the includes that only supplied the name are
dropped or replaced by <nlohmann/json.hpp>.

Eight files reached json_diff.hpp only through an include that is now
gone and with it lost that header's "using namespace std;". The std
names they used unqualified are qualified.
2026-10-07 01:39:17 +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
97 changed files with 489 additions and 203 deletions
+5 -7
View File
@@ -23,7 +23,6 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "libslic3r/PrintBase.hpp" #include "libslic3r/PrintBase.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <cerrno> #include <cerrno>
#include <utility> #include <utility>
@@ -78,12 +77,10 @@
#include <condition_variable> #include <condition_variable>
#include <mutex> #include <mutex>
#include <boost/thread.hpp> #include <boost/thread.hpp>
//add json logic
#include "nlohmann/json.hpp"
using namespace nlohmann;
#endif #endif
#include "nlohmann/json.hpp"
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/nowide/args.hpp> #include <boost/nowide/args.hpp>
@@ -157,6 +154,7 @@ using namespace nlohmann;
#include <stdio.h> #include <stdio.h>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
#ifdef __WXGTK__ #ifdef __WXGTK__
#if __has_include(<X11/Xlib.h>) #if __has_include(<X11/Xlib.h>)
@@ -3524,7 +3522,7 @@ int CLI::run(int argc, char **argv)
ConfigOptionStrings *curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant"); ConfigOptionStrings *curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant");
if (!curr_variant_opt) { if (!curr_variant_opt) {
curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant", true); curr_variant_opt = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant", true);
std::vector<string>& filament_variants = curr_variant_opt->values; std::vector<std::string>& filament_variants = curr_variant_opt->values;
filament_variants.resize(filament_count, get_extruder_variant_string(etDirectDrive, nvtStandard)); filament_variants.resize(filament_count, get_extruder_variant_string(etDirectDrive, nvtStandard));
} }
const ConfigOptionStrings *new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_extruder_variant", true)); const ConfigOptionStrings *new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_extruder_variant", true));
@@ -6554,7 +6552,7 @@ int CLI::run(int argc, char **argv)
std::vector<int> result_filaments; std::vector<int> result_filaments;
//result_filaments.reserve(conflict_filaments.size()); //result_filaments.reserve(conflict_filaments.size());
std::set_intersection(conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), std::set_intersection(conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(),
unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin())); unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
conflict_filament_vector = result_filaments; conflict_filament_vector = result_filaments;
} }
} }
-2
View File
@@ -15,8 +15,6 @@
#include "libslic3r/Semver.hpp" #include "libslic3r/Semver.hpp"
#include "calib.hpp" #include "calib.hpp"
using namespace nlohmann;
#define ENV_DEV_HOST "0" #define ENV_DEV_HOST "0"
#define ENV_QAT_HOST "1" #define ENV_QAT_HOST "1"
#define ENV_PRE_HOST "2" #define ENV_PRE_HOST "2"
+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;
+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
+1
View File
@@ -87,6 +87,7 @@
#include "libslic3r/GCode/Thumbnails.hpp" #include "libslic3r/GCode/Thumbnails.hpp"
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
using boost::property_tree::ptree; using boost::property_tree::ptree;
+2
View File
@@ -87,6 +87,8 @@
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions. // This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
//#define SLIC3R_PROFILE_USE_PRESETS_SUBDIR //#define SLIC3R_PROFILE_USE_PRESETS_SUBDIR
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
// Project-level options imported from a loaded 3MF into project_config. s_project_options_published // Project-level options imported from a loaded 3MF into project_config. s_project_options_published
+1 -1
View File
@@ -1580,7 +1580,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
{ {
std::vector<int> result_filaments; std::vector<int> result_filaments;
//result_filaments.reserve(conflict_filaments.size()); //result_filaments.reserve(conflict_filaments.size());
std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), insert_iterator<vector<int>>(result_filaments, result_filaments.begin())); std::set_intersection (conflict_filament_vector.begin(), conflict_filament_vector.end(), unprintable_filament_vec[index].begin(), unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
conflict_filament_vector = result_filaments; conflict_filament_vector = result_filaments;
} }
} }
+1
View File
@@ -69,6 +69,7 @@
#include <wx/dcmemory.h> #include <wx/dcmemory.h>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
+2 -2
View File
@@ -11,7 +11,7 @@
#include "slic3r/GUI/Widgets/Button.hpp" #include "slic3r/GUI/Widgets/Button.hpp"
#include "slic3r/GUI/Widgets/ComboBox.hpp" #include "slic3r/GUI/Widgets/ComboBox.hpp"
#include <string> #include <string>
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <wx/notebook.h> #include <wx/notebook.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/sizer.h> #include <wx/sizer.h>
@@ -246,7 +246,7 @@ public:
void create_folder(wxString name = wxEmptyString); void create_folder(wxString name = wxEmptyString);
std::string replaceSpace(std::string s, std::string ts, std::string ns); std::string replaceSpace(std::string s, std::string ts, std::string ns);
void on_import_file(wxCommandEvent &event); void on_import_file(wxCommandEvent &event);
void Reload(wxString aux_path, std::map<std::string, std::vector<json>> paths); void Reload(wxString aux_path, std::map<std::string, std::vector<nlohmann::json>> paths);
void update_all_panel(); void update_all_panel();
void update_all_cover(); void update_all_cover();
+3 -1
View File
@@ -26,7 +26,7 @@
#include <memory> #include <memory>
#include "slic3r/GUI/BBLStatusBarBind.hpp" #include "slic3r/GUI/BBLStatusBarBind.hpp"
#include "slic3r/GUI/Jobs/BindJob.hpp" #include "slic3r/GUI/Jobs/BindJob.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "slic3r/GUI/Jobs/Worker.hpp" #include "slic3r/GUI/Jobs/Worker.hpp"
#include <utility> #include <utility>
@@ -54,6 +54,8 @@
#include "DeviceCore/DevManager.h" #include "DeviceCore/DevManager.h"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+3 -1
View File
@@ -25,7 +25,7 @@
#include "slic3r/GUI/Widgets/RadioBox.hpp" #include "slic3r/GUI/Widgets/RadioBox.hpp"
#include <cstdio> #include <cstdio>
#include <map> #include <map>
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <cstdlib> #include <cstdlib>
#include "slic3r/GUI/GUI_Utils.hpp" #include "slic3r/GUI/GUI_Utils.hpp"
#include "slic3r/GUI/Widgets/Label.hpp" #include "slic3r/GUI/Widgets/Label.hpp"
@@ -91,6 +91,8 @@
#define SELECT_ALL_OPTION_COLOUR wxColour("#009688") #define SELECT_ALL_OPTION_COLOUR wxColour("#009688")
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC") #define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+3 -1
View File
@@ -1,10 +1,12 @@
#include "DevAxis.h" #include "DevAxis.h"
#include "DevUtil.h" #include "DevUtil.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/DeviceCore/DevDefs.h"
using json = nlohmann::json;
namespace Slic3r namespace Slic3r
{ {
+1 -2
View File
@@ -2,7 +2,6 @@
#include <memory> #include <memory>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r { namespace Slic3r {
@@ -22,7 +21,7 @@ public:
bool IsArchCoreXY() const; bool IsArchCoreXY() const;
public: public:
void ParseAxis(const json &print_json); void ParseAxis(const nlohmann::json &print_json);
int Ctrl_GoHome(); int Ctrl_GoHome();
int Ctrl_Axis(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // xyz e int Ctrl_Axis(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // xyz e
+3 -1
View File
@@ -1,11 +1,13 @@
#include "DevAxis.h" #include "DevAxis.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
using json = nlohmann::json;
namespace Slic3r namespace Slic3r
{ {
+3 -1
View File
@@ -1,7 +1,9 @@
#include "DevBed.h" #include "DevBed.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
void DevBed::ParseV1_0(const json &print_json, DevBed *system) void DevBed::ParseV1_0(const json &print_json, DevBed *system)
+2 -3
View File
@@ -1,6 +1,5 @@
#pragma once #pragma once
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r { namespace Slic3r {
@@ -16,8 +15,8 @@ public:
public: public:
static void ParseV1_0(const json &print_json, DevBed *system); static void ParseV1_0(const nlohmann::json &print_json, DevBed *system);
static void ParseV2_0(const json &print_json, DevBed *system); static void ParseV2_0(const nlohmann::json &print_json, DevBed *system);
private: private:
+3 -1
View File
@@ -1,6 +1,6 @@
#include <algorithm> #include <algorithm>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
@@ -22,6 +22,8 @@
#include "DevFilaSystem.h" #include "DevFilaSystem.h"
#include "DevConfig.h" #include "DevConfig.h"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
static float string_to_float(const std::string &str_value) static float string_to_float(const std::string &str_value)
+7 -8
View File
@@ -2,7 +2,6 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <optional> #include <optional>
#include <vector> #include <vector>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h" #include "DevDefs.h"
@@ -86,11 +85,11 @@ public:
std::vector<FlowRatioCalibResult> GetFlowRatioResult() const {return m_flow_ratio_results; } std::vector<FlowRatioCalibResult> GetFlowRatioResult() const {return m_flow_ratio_results; }
protected: protected:
void ExtrusionCalibSetParse(const json &jj); void ExtrusionCalibSetParse(const nlohmann::json &jj);
void ExtrusionCalibSelectParse(const json &jj); void ExtrusionCalibSelectParse(const nlohmann::json &jj);
void ExtrusionCalibGetTableParse(const json &jj); void ExtrusionCalibGetTableParse(const nlohmann::json &jj);
void ExtrusionCalibGetResultParse(const json &jj); void ExtrusionCalibGetResultParse(const nlohmann::json &jj);
void FlowrateGetResultParse(const json &jj); void FlowrateGetResultParse(const nlohmann::json &jj);
private: private:
MachineObject* m_owner{nullptr}; MachineObject* m_owner{nullptr};
@@ -119,11 +118,11 @@ private:
bool m_calib_finished{false}; bool m_calib_finished{false};
public: public:
static void ParseCalibVersion(const json& j, DevCalib* system); static void ParseCalibVersion(const nlohmann::json& j, DevCalib* system);
static void ParseSupportNewAutoCalib(int flag, DevCalib* system); static void ParseSupportNewAutoCalib(int flag, DevCalib* system);
static void ParseV1_0(const json& print_json, DevCalib* system, bool key_field_only); static void ParseV1_0(const nlohmann::json& print_json, DevCalib* system, bool key_field_only);
}; };
} // namespace Slic3r } // namespace Slic3r
+3 -1
View File
@@ -3,9 +3,11 @@
#include "DevConfig.h" #include "DevConfig.h"
#include "DevUtil.h" #include "DevUtil.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); } bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); }
+3 -4
View File
@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r { namespace Slic3r {
@@ -25,10 +24,10 @@ public: // getter
public: public:
// setter // setter
void ParseChamber(const json &print_json); void ParseChamber(const nlohmann::json &print_json);
void ParseChamberV1_0(const json& print_json); void ParseChamberV1_0(const nlohmann::json& print_json);
void ParseChamberV2_0(const json& print_json); void ParseChamberV2_0(const nlohmann::json& print_json);
// control // control
int CtrlSetChamberTemp(int temp); int CtrlSetChamberTemp(int temp);
+3 -1
View File
@@ -1,8 +1,10 @@
#include "DevChamber.h" #include "DevChamber.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include <string> #include <string>
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
int DevChamber::CtrlSetChamberTemp(int temp) int DevChamber::CtrlSetChamberTemp(int temp)
-1
View File
@@ -2,7 +2,6 @@
#include "DevConfig.h" #include "DevConfig.h"
#include "DevUtil.h" #include "DevUtil.h"
#include "json_diff.hpp"
using namespace nlohmann; using namespace nlohmann;
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include <wx/string.h> #include <wx/string.h>
#include <limits> #include <limits>
@@ -47,11 +47,11 @@ public:
public: public:
/*Setters*/ /*Setters*/
void ParseConfig(const json& print_json); void ParseConfig(const nlohmann::json& print_json);
void ParseChamberConfig(const json& print_json); // chamber void ParseChamberConfig(const nlohmann::json& print_json); // chamber
void ParsePrintOptionsConfig(const json& print_json); // print options void ParsePrintOptionsConfig(const nlohmann::json& print_json); // print options
void ParseCalibrationConfig(const json& print_json); //cali void ParseCalibrationConfig(const nlohmann::json& print_json); //cali
private: private:
[[maybe_unused]] MachineObject* m_obj; [[maybe_unused]] MachineObject* m_obj;
+1 -1
View File
@@ -1,6 +1,6 @@
#include "DevConfigUtil.h" #include "DevConfigUtil.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include <string> #include <string>
-1
View File
@@ -4,7 +4,6 @@
#include "DevCtrl.h" #include "DevCtrl.h"
// TODO: remove this include // TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann; using namespace nlohmann;
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include <string> #include <string>
#include <ctime> #include <ctime>
#include <wx/string.h> #include <wx/string.h>
@@ -15,7 +15,7 @@ class DevCtrlInfo
{ {
public: public:
DevCtrlInfo() {}; DevCtrlInfo() {};
DevCtrlInfo(MachineObject* obj, int sequence_id, const json& req_json, int interval_max = 3, int interval_min = 0); DevCtrlInfo(MachineObject* obj, int sequence_id, const nlohmann::json& req_json, int interval_max = 3, int interval_min = 0);
public: public:
bool CheckCanUpdateData(const nlohmann::json& jj); bool CheckCanUpdateData(const nlohmann::json& jj);
@@ -32,7 +32,7 @@ private:
time_t m_request_time = 0; time_t m_request_time = 0;
int m_request_seq = 0; int m_request_seq = 0;
json m_request_json = json(); nlohmann::json m_request_json = nlohmann::json();
// check // check
int m_request_interval_max = 3; int m_request_interval_max = 3;
+1 -1
View File
@@ -3,7 +3,7 @@
#include <optional> #include <optional>
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include <wx/string.h> #include <wx/string.h>
#include "DevDefs.h" #include "DevDefs.h"
@@ -15,7 +15,6 @@
#include "DevFilaSystem.h" // complete type for GetFilaSystem()->GetTrayIndexMap() in GetBackupAmsSlotInGroup #include "DevFilaSystem.h" // complete type for GetFilaSystem()->GetTrayIndexMap() in GetBackupAmsSlotInGroup
// TODO: remove this include // TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
@@ -5,7 +5,7 @@
#include <unordered_map> #include <unordered_map>
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include <vector> #include <vector>
#include <wx/string.h> #include <wx/string.h>
-1
View File
@@ -6,7 +6,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <wx/app.h> #include <wx/app.h>
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann; using namespace nlohmann;
+5 -6
View File
@@ -2,7 +2,6 @@
#include <functional> #include <functional>
#include <cstdint> #include <cstdint>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "slic3r/Utils/json_diff.hpp"
#include <map> #include <map>
#include <vector> #include <vector>
@@ -13,7 +12,7 @@ namespace Slic3r {
class MachineObject; class MachineObject;
enum AirDuctType { AIR_FAN_TYPE, AIR_DOOR_TYPE }; enum AirDuctType { AIR_FAN_TYPE, AIR_DOOR_TYPE };
typedef std::function<void(const json &)> CommandCallBack; typedef std::function<void(const nlohmann::json &)> CommandCallBack;
enum AIR_FUN : int { enum AIR_FUN : int {
FAN_HEAT_BREAK_0_IDX = 0, FAN_HEAT_BREAK_0_IDX = 0,
@@ -123,14 +122,14 @@ public:
AirDuctData GetAirDuctData() { return m_air_duct_data; }; AirDuctData GetAirDuctData() { return m_air_duct_data; };
void converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun); // Convert the data to duct type to make the newand old protocols consistent void converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun); // Convert the data to duct type to make the newand old protocols consistent
int command_handle_response(const json &response); int command_handle_response(const nlohmann::json &response);
int command_control_fan(int fan_type, int val); // Old protocol int command_control_fan(int fan_type, int val); // Old protocol
int command_control_fan_new(int fan_id, int val); // New protocol int command_control_fan_new(int fan_id, int val); // New protocol
int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb); int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb);
void ParseV1_0(const json &print_json); void ParseV1_0(const nlohmann::json &print_json);
void ParseV2_0(const json &print_json); void ParseV2_0(const nlohmann::json &print_json);
void ParseV3_0(const json &print_json); void ParseV3_0(const nlohmann::json &print_json);
public: public:
bool GetSupportAirduct() { return is_support_airduct; }; bool GetSupportAirduct() { return is_support_airduct; };
@@ -1,11 +1,13 @@
#include "DevFilaAmsSetting.h" #include "DevFilaAmsSetting.h"
#include "DevFilaSystem.h" #include "DevFilaSystem.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include <string> #include <string>
#include "slic3r/GUI/DeviceCore/DevCtrl.h" #include "slic3r/GUI/DeviceCore/DevCtrl.h"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx) int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx)
{ {
@@ -14,7 +14,6 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "DevFilaBlackList.h" #include "DevFilaBlackList.h"
#include "json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "DevFilaSystem.h" #include "DevFilaSystem.h"
+2 -2
View File
@@ -5,7 +5,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <wx/string.h> #include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
namespace Slic3r namespace Slic3r
{ {
@@ -67,7 +67,7 @@ public:
static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info); static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info);
public: public:
static json filaments_blacklist; static nlohmann::json filaments_blacklist;
};// class DevFilaBlacklist };// class DevFilaBlacklist
}// namespace Slic3r }// namespace Slic3r
@@ -18,7 +18,6 @@
#include <set> #include <set>
#include <utility> #include <utility>
#include "DevFilaSystem.h" #include "DevFilaSystem.h"
#include "json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
#include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId #include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include "DevDefs.h" #include "DevDefs.h"
#include "DevFilaAmsSetting.h" #include "DevFilaAmsSetting.h"
@@ -415,9 +415,9 @@ private:
class DevFilaSystemParser class DevFilaSystemParser
{ {
public: public:
static void ParseV1_0(const json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only); static void ParseV1_0(const nlohmann::json& print_json, MachineObject* obj, DevFilaSystem* system, bool key_field_only);
static void ParseAgentFilament(const json& data, MachineObject* obj, DevFilaSystem* system); static void ParseAgentFilament(const nlohmann::json& data, MachineObject* obj, DevFilaSystem* system);
}; };
struct DevFilamentDryingPreset struct DevFilamentDryingPreset
@@ -2,7 +2,6 @@
#include <string> #include <string>
#include "DevFilaSystem.h" #include "DevFilaSystem.h"
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include #include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include
using namespace nlohmann; using namespace nlohmann;
+3 -5
View File
@@ -1,11 +1,9 @@
#pragma once #pragma once
#include "DevFirmware.h" #include "DevFirmware.h"
#include "slic3r/Utils/json_diff.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
#include <wx/string.h> #include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r { namespace Slic3r {
@@ -51,10 +49,10 @@ public:
bool isCuttingModule() const { return product_name.Contains("Cutting Module"); } bool isCuttingModule() const { return product_name.Contains("Cutting Module"); }
bool isRotary() const { return product_name.Contains("Rotary"); }// Rotary Attachment bool isRotary() const { return product_name.Contains("Rotary"); }// Rotary Attachment
bool isExtinguishSystem() const { return product_name.Contains("Extinguishing System"); }// Auto Fire Extinguishing System bool isExtinguishSystem() const { return product_name.Contains("Extinguishing System"); }// Auto Fire Extinguishing System
bool isWTM() const { return name.find("wtm") != string::npos; } // nozzle bool isWTM() const { return name.find("wtm") != std::string::npos; } // nozzle
bool isExhaustFan() const { return product_name.Contains("Exhaust Fan"); } bool isExhaustFan() const { return product_name.Contains("Exhaust Fan"); }
bool isHmshub() const { return product_name.find("Filament Buffer") != string::npos; } bool isHmshub() const { return product_name.find("Filament Buffer") != std::string::npos; }
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != string::npos; } bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != std::string::npos; }
}; };
+3 -1
View File
@@ -2,10 +2,12 @@
#include "DevHMS.h" #include "DevHMS.h"
#include <string> #include <string>
#include <cstdio> #include <cstdio>
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include <exception> #include <exception>
#include <cassert> #include <cassert>
using json = nlohmann::json;
namespace Slic3r namespace Slic3r
{ {
+3 -3
View File
@@ -1,6 +1,6 @@
#pragma once #pragma once
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include <vector> #include <vector>
#include <string> #include <string>
#include <wx/string.h> #include <wx/string.h>
@@ -18,7 +18,7 @@ public:
DevHMS(MachineObject* obj) : m_object(obj) {} DevHMS(MachineObject* obj) : m_object(obj) {}
public: public:
void ParseHMSItems(const json& hms_json); void ParseHMSItems(const nlohmann::json& hms_json);
const std::vector<DevHMSItem>& GetHMSItems() const { return m_hms_list; }; const std::vector<DevHMSItem>& GetHMSItems() const { return m_hms_list; };
private: private:
@@ -69,7 +69,7 @@ public:
bool has_read() const { return m_already_read; }; bool has_read() const { return m_already_read; };
protected: protected:
friend void DevHMS::ParseHMSItems(const json& hms_json); friend void DevHMS::ParseHMSItems(const nlohmann::json& hms_json);
bool parse_hms_info(unsigned attr, unsigned code); bool parse_hms_info(unsigned attr, unsigned code);
private: private:
@@ -3,7 +3,6 @@
#include "DevLamp.h" #include "DevLamp.h"
// TODO: remove this include // TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
using namespace nlohmann; using namespace nlohmann;
-1
View File
@@ -23,7 +23,6 @@
#include "DevUtil.h" #include "DevUtil.h"
// TODO: remove this include // TODO: remove this include
#include "json_diff.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
-1
View File
@@ -3,7 +3,6 @@
#include <mutex> #include <mutex>
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <string> #include <string>
#include <vector> #include <vector>
#include <wx/object.h> #include <wx/object.h>
@@ -6,7 +6,6 @@
#include "DevUtil.h" #include "DevUtil.h"
#include "DevUtilBackend.h" #include "DevUtilBackend.h"
#include "json_diff.hpp"
#include "libslic3r/MultiNozzleUtils.hpp" #include "libslic3r/MultiNozzleUtils.hpp"
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
+1 -1
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "libslic3r/MultiNozzleUtils.hpp" #include "libslic3r/MultiNozzleUtils.hpp"
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include "DevNozzleSystem.h" #include "DevNozzleSystem.h"
#include "DevFirmware.h" #include "DevFirmware.h"
@@ -1,7 +1,7 @@
#include "DevNozzleRack.h" #include "DevNozzleRack.h"
#include "DevExtruderSystem.h" #include "DevExtruderSystem.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/MsgDialog.hpp" #include "slic3r/GUI/MsgDialog.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
@@ -14,6 +14,8 @@
#include "slic3r/GUI/DeviceCore/DevNozzleSystem.h" #include "slic3r/GUI/DeviceCore/DevNozzleSystem.h"
using json = nlohmann::json;
namespace Slic3r namespace Slic3r
{ {
@@ -4,7 +4,7 @@
#include "DevNozzleSystem.h" #include "DevNozzleSystem.h"
#include "DevUtil.h" #include "DevUtil.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
@@ -28,6 +28,8 @@
#include <optional> #include <optional>
#include <cmath> #include <cmath>
using json = nlohmann::json;
namespace Slic3r namespace Slic3r
{ {
+2 -2
View File
@@ -4,7 +4,7 @@
#include "libslic3r/CommonDefs.hpp" #include "libslic3r/CommonDefs.hpp"
#include "libslic3r/MultiNozzleUtils.hpp" #include "libslic3r/MultiNozzleUtils.hpp"
#include "slic3r/Utils/json_diff.hpp" #include <nlohmann/json.hpp>
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include <string> #include <string>
@@ -195,6 +195,6 @@ namespace Slic3r
{ {
public: public:
static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, DevNozzleSystem* system, std::optional<int> flag_e3d); static void ParseV1_0(const nlohmann::json& nozzletype_json, const nlohmann::json& diameter_json, DevNozzleSystem* system, std::optional<int> flag_e3d);
static void ParseV2_0(const json& device_json, DevNozzleSystem* system); static void ParseV2_0(const nlohmann::json& device_json, DevNozzleSystem* system);
}; };
}; };
@@ -8,9 +8,11 @@
#include <ctime> #include <ctime>
#include <exception> #include <exception>
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
using json = nlohmann::json;
namespace Slic3r namespace Slic3r
{ {
+3 -1
View File
@@ -1,8 +1,10 @@
#include "DevStorage.h" #include "DevStorage.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include <string> #include <string>
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state) DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state)
+1 -2
View File
@@ -1,7 +1,6 @@
#pragma once #pragma once
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
#include "slic3r/Utils/json_diff.hpp"
namespace Slic3r { namespace Slic3r {
@@ -27,7 +26,7 @@ public:
SdcardState get_sdcard_state() const { return m_sdcard_state; }; SdcardState get_sdcard_state() const { return m_sdcard_state; };
SdcardState set_sdcard_state(int state); SdcardState set_sdcard_state(int state);
static void ParseV1_0(const json &print_json, DevStorage *system); static void ParseV1_0(const nlohmann::json &print_json, DevStorage *system);
bool is_timelapse_storage_low(const std::string& storage) const; bool is_timelapse_storage_low(const std::string& storage) const;
+3 -1
View File
@@ -1,7 +1,7 @@
#include "DevUpgrade.h" #include "DevUpgrade.h"
#include "DevUtil.h" #include "DevUtil.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
@@ -13,6 +13,8 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/DeviceCore/DevDefs.h"
#include <wx/string.h> #include <wx/string.h>
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
int DevUpgrade::GetUpgradeProgressInt() const int DevUpgrade::GetUpgradeProgressInt() const
+3 -4
View File
@@ -4,7 +4,6 @@
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
#include <wx/string.h> #include <wx/string.h>
#include "slic3r/Utils/json_diff.hpp"
#include "DevDefs.h" #include "DevDefs.h"
#include "DevFirmware.h" #include "DevFirmware.h"
@@ -47,8 +46,8 @@ public:
int CtrlUpgradeModule(std::string url, std::string module_type, std::string version); int CtrlUpgradeModule(std::string url, std::string module_type, std::string version);
// parser // parser
void ParseUpgrade_V1_0(const json &print_jj); void ParseUpgrade_V1_0(const nlohmann::json &print_jj);
void ParseUpgradeDisplayState(const json &upgrade_state_jj); void ParseUpgradeDisplayState(const nlohmann::json &upgrade_state_jj);
protected: protected:
DevUpgrade(MachineObject *owner) : m_owner(owner) {} DevUpgrade(MachineObject *owner) : m_owner(owner) {}
@@ -90,7 +89,7 @@ public:
public: public:
int CtrlGetVersion(bool with_retry = true); int CtrlGetVersion(bool with_retry = true);
void ParseGetVersion(const json &print_jj); void ParseGetVersion(const nlohmann::json &print_jj);
private: private:
MachineObject *m_owner; MachineObject *m_owner;
+3 -1
View File
@@ -1,10 +1,12 @@
#include "DevUpgrade.h" #include "DevUpgrade.h"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "slic3r/GUI/DeviceManager.hpp" #include "slic3r/GUI/DeviceManager.hpp"
#include <string> #include <string>
#include "slic3r/GUI/DeviceCore/DevFirmware.h" #include "slic3r/GUI/DeviceCore/DevFirmware.h"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
int DevUpgrade::CtrlUpgradeConfirm() int DevUpgrade::CtrlUpgradeConfirm()
+3 -1
View File
@@ -1,5 +1,5 @@
#include "PrinterNetworkTypes.hpp" #include "PrinterNetworkTypes.hpp"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "DeviceManager.hpp" #include "DeviceManager.hpp"
#include "HMS.hpp" #include "HMS.hpp"
#include "I18N.hpp" #include "I18N.hpp"
@@ -105,6 +105,8 @@
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/Jobs/SendJob.hpp" #include "slic3r/GUI/Jobs/SendJob.hpp"
using json = nlohmann::json;
class wxWindow; class wxWindow;
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
+9 -10
View File
@@ -63,7 +63,6 @@
#define END_SEQ_ID 30000 #define END_SEQ_ID 30000
#define SUBSCRIBE_RETRY_COUNT 5 #define SUBSCRIBE_RETRY_COUNT 5
using namespace nlohmann;
namespace Slic3r { namespace Slic3r {
namespace GUI namespace GUI
@@ -467,7 +466,7 @@ public:
std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); } std::string get_print_error_str() const { return MachineObject::get_error_code_str(this->print_error); }
std::unordered_set<GUI::DeviceErrorDialog*> m_command_error_code_dlgs; std::unordered_set<GUI::DeviceErrorDialog*> m_command_error_code_dlgs;
void add_command_error_code_dlg(int command_err, json action_json=json{}); void add_command_error_code_dlg(int command_err, nlohmann::json action_json=nlohmann::json{});
int curr_layer = 0; int curr_layer = 0;
int total_layers = 0; int total_layers = 0;
@@ -759,9 +758,9 @@ public:
int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter); int command_set_printer_nozzle2(int id, std::string nozzle_type, float diameter);
int command_get_access_code(); int command_get_access_code();
int command_start_camera(); int command_start_camera();
int command_ack_proceed(json& proceed); int command_ack_proceed(nlohmann::json& proceed);
int command_purification_disable(); int command_purification_disable();
int command_dont_remind_next_time(json& mqtt_guard_json); int command_dont_remind_next_time(nlohmann::json& mqtt_guard_json);
/* command upgrade */ /* command upgrade */
int command_upgrade_confirm(); int command_upgrade_confirm();
@@ -887,7 +886,7 @@ public:
static bool is_in_printing_status(std::string status); static bool is_in_printing_status(std::string status);
void set_print_state(std::string status); void set_print_state(std::string status);
void update_print_progress(const json& value); void update_print_progress(const nlohmann::json& value);
bool is_connected(); bool is_connected();
bool is_connecting(); bool is_connecting();
@@ -903,7 +902,7 @@ public:
/* Msg for display MsgFn */ /* Msg for display MsgFn */
typedef std::function<void(std::string topic, std::string payload)> MsgFn; typedef std::function<void(std::string topic, std::string payload)> MsgFn;
int publish_json(const json& json_item, int qos = 0, int flag = 0) ; int publish_json(const nlohmann::json& json_item, int qos = 0, int flag = 0) ;
int publish_json(const std::string& json_str, int qos = 0, int flag = 0) = delete; int publish_json(const std::string& json_str, int qos = 0, int flag = 0) = delete;
int cloud_publish_json(std::string json_str, int qos = 0, int flag = 0); int cloud_publish_json(std::string json_str, int qos = 0, int flag = 0);
int local_publish_json(std::string json_str, int qos = 0, int flag = 0); int local_publish_json(std::string json_str, int qos = 0, int flag = 0);
@@ -947,16 +946,16 @@ public:
* or scenarios where users want to bypass the AMS. * or scenarios where users want to bypass the AMS.
*/ */
std::vector<DevAmsTray> vt_slot; std::vector<DevAmsTray> vt_slot;
DevAmsTray parse_vt_tray(json vtray); DevAmsTray parse_vt_tray(nlohmann::json vtray);
/*get ams slot info*/ /*get ams slot info*/
bool contains_tray(const std::string &ams_id, const std::string &tray_id) const; bool contains_tray(const std::string &ams_id, const std::string &tray_id) const;
DevAmsTray get_tray(const std::string &ams_id, const std::string &tray_id) const;/*use contains_tray() check first*/ DevAmsTray get_tray(const std::string &ams_id, const std::string &tray_id) const;/*use contains_tray() check first*/
/*for parse new info*/ /*for parse new info*/
bool check_enable_np(const json& print) const; bool check_enable_np(const nlohmann::json& print) const;
void parse_new_info(json print); void parse_new_info(nlohmann::json print);
void parse_new_info2(const json& info); void parse_new_info2(const nlohmann::json& info);
int get_flag_bits(std::string str, int start, int count = 1) const; int get_flag_bits(std::string str, int start, int count = 1) const;
uint32_t get_flag_bits_no_border(std::string str, int start_idx, int count = 1) const; uint32_t get_flag_bits_no_border(std::string str, int start_idx, int count = 1) const;
int get_flag_bits(int num, int start, int count = 1, int base = 10) const; int get_flag_bits(int num, int start, int count = 1, int base = 10) const;
+1 -1
View File
@@ -67,7 +67,7 @@ public:
void on_script_message(const nlohmann::json& payload) override; void on_script_message(const nlohmann::json& payload) override;
void OnRequestPresets(); void OnRequestPresets();
void OnExportData(const wxString& path, const wxString& name, json data); void OnExportData(const wxString& path, const wxString& name, nlohmann::json data);
protected: protected:
bool m_seq_top_layer_only_changed{false}; bool m_seq_top_layer_only_changed{false};
+7 -7
View File
@@ -2816,7 +2816,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
} }
return ret; return ret;
}; };
auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) { auto calculate_offsets = [max_width, window_padding](const std::vector<std::pair<std::string, std::vector<std::string>>>& title_columns, float extra_size = 0.0f) {
const ImGuiStyle& style = ImGui::GetStyle(); const ImGuiStyle& style = ImGui::GetStyle();
std::vector<float> offsets; std::vector<float> offsets;
offsets.push_back(max_width(title_columns[0].second, title_columns[0].first, extra_size) + 3.0f * style.ItemSpacing.x + style.WindowPadding.x); offsets.push_back(max_width(title_columns[0].second, title_columns[0].first, extra_size) + 3.0f * style.ItemSpacing.x + style.WindowPadding.x);
@@ -2963,7 +2963,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
} }
::sprintf(buff, "%.2f", longest_str); ::sprintf(buff, "%.2f", longest_str);
std::vector<std::pair<std::string, std::vector<::string>>> title_columns; std::vector<std::pair<std::string, std::vector<std::string>>> title_columns;
if (displayed_columns & ColumnData::Model) { if (displayed_columns & ColumnData::Model) {
title_columns.push_back({ _u8L("Filament"), {""} }); title_columns.push_back({ _u8L("Filament"), {""} });
title_columns.push_back({ _u8L("Model"), {buff} }); title_columns.push_back({ _u8L("Model"), {buff} });
@@ -3184,7 +3184,7 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
float ams_item_height = 0; float ams_item_height = 0;
float filament_group_item_align_width = 0; float filament_group_item_align_width = 0;
{ {
float three_words_width = imgui.calc_text_size("ABC"sv).x; float three_words_width = imgui.calc_text_size(std::string_view("ABC")).x;
const int line_capacity = 4; const int line_capacity = 4;
for (const auto& extruder_filaments : {m_left_extruder_filament,m_right_extruder_filament }) for (const auto& extruder_filaments : {m_left_extruder_filament,m_right_extruder_filament })
@@ -3195,8 +3195,8 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding)
for (int j = idx; j < extruder_filaments.size() && j < idx + line_capacity; ++j) { for (int j = idx; j < extruder_filaments.size() && j < idx + line_capacity; ++j) {
auto text_info = imgui.calculate_filament_group_text_size(get_filament_display_type(extruder_filaments[j])); auto text_info = imgui.calculate_filament_group_text_size(get_filament_display_type(extruder_filaments[j]));
auto text_size = std::get<0>(text_info); auto text_size = std::get<0>(text_info);
filament_group_item_align_width = max(filament_group_item_align_width, text_size.x); filament_group_item_align_width = std::max(filament_group_item_align_width, text_size.x);
text_line_height = max(text_line_height, text_size.y); text_line_height = std::max(text_line_height, text_size.y);
} }
container_height += (three_words_width * 1.3f + text_line_height ); container_height += (three_words_width * 1.3f + text_line_height );
} }
@@ -3589,7 +3589,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
return ret; return ret;
}; };
auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<::string>>>& title_columns, float extra_size = 0.0f) { auto calculate_offsets = [max_width, this](const std::vector<std::pair<std::string, std::vector<std::string>>>& title_columns, float extra_size = 0.0f) {
const ImGuiStyle& style = ImGui::GetStyle(); const ImGuiStyle& style = ImGui::GetStyle();
std::vector<float> offsets; std::vector<float> offsets;
// ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size // ORCA increase spacing for more readable format. Using direct number requires much less code change in here. GetTextLineHeight for additional spacing for icon_size
@@ -4014,7 +4014,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
total_filaments.push_back(buffer); total_filaments.push_back(buffer);
std::vector<std::pair<std::string, std::vector<::string>>> title_columns; std::vector<std::pair<std::string, std::vector<std::string>>> title_columns;
if (displayed_columns & ColumnData::Model) { if (displayed_columns & ColumnData::Model) {
title_columns.push_back({ _u8L("Filament"), {""} }); title_columns.push_back({ _u8L("Filament"), {""} });
title_columns.push_back({ _u8L("Model"), total_filaments }); title_columns.push_back({ _u8L("Model"), total_filaments });
+7
View File
@@ -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
@@ -311,6 +311,7 @@ typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS2)(
using namespace std::literals; using namespace std::literals;
namespace pt = boost::property_tree; namespace pt = boost::property_tree;
using json = nlohmann::json;
struct StaticBambuLib struct StaticBambuLib
{ {
+1 -1
View File
@@ -3651,7 +3651,7 @@ void GLGizmoCut3D::perform_cut(const Selection& selection)
// model_name failing reason // model_name failing reason
std::vector<std::pair<std::string, std::string>> failed_models; std::vector<std::pair<std::string, std::string>> failed_models;
auto plater = wxGetApp().plater(); auto plater = wxGetApp().plater();
auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const string &model_name, ProgressDialog &progress_dlg, auto fix_and_update_progress = [keep_painting](ModelObject *model_object, const int vol_idx, const std::string &model_name, ProgressDialog &progress_dlg,
std::vector<std::string> &succes_models, std::vector<std::pair<std::string, std::string>> &failed_models) { std::vector<std::string> &succes_models, std::vector<std::pair<std::string, std::string>> &failed_models) {
wxString msg = _L("Repairing model object"); wxString msg = _L("Repairing model object");
msg += ": " + from_u8(model_name) + "\n"; msg += ": " + from_u8(model_name) + "\n";
+2 -1
View File
@@ -6,7 +6,7 @@
#include "DeviceCore/DevManager.h" #include "DeviceCore/DevManager.h"
#include "DeviceCore/DevUtil.h" #include "DeviceCore/DevUtil.h"
#include "Http.hpp" #include "Http.hpp"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "libslic3r/AppConfig.hpp" #include "libslic3r/AppConfig.hpp"
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
@@ -26,6 +26,7 @@
#include <ctime> #include <ctime>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
static const char* HMS_PATH = "hms"; static const char* HMS_PATH = "hms";
static const char* HMS_LOCAL_IMG_PATH = "hms/local_image"; static const char* HMS_LOCAL_IMG_PATH = "hms/local_image";
+1 -1
View File
@@ -1405,7 +1405,7 @@ void IMSlider::render_input_custom_gcode(std::string custom_gcode)
} }
void IMSlider::do_go_to_layer(size_t layer_number) { void IMSlider::do_go_to_layer(size_t layer_number) {
layer_number = clamp((int)layer_number, m_min_value, m_max_value); layer_number = std::clamp((int)layer_number, m_min_value, m_max_value);
GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number); GetSelection() == ssLower ? SetLowerValue(layer_number) : SetHigherValue(layer_number);
} }
+2 -1
View File
@@ -19,7 +19,7 @@
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <functional> #include <functional>
#include <cstddef> #include <cstddef>
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <wx/string.h> #include <wx/string.h>
#include "slic3r/GUI/PartPlate.hpp" #include "slic3r/GUI/PartPlate.hpp"
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
@@ -39,6 +39,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+2 -1
View File
@@ -1,5 +1,5 @@
#include "SendJob.hpp" #include "SendJob.hpp"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "bambu_networking.hpp" #include "bambu_networking.hpp"
#include "libslic3r/LifecycleEvents.hpp" #include "libslic3r/LifecycleEvents.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
@@ -23,6 +23,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+3 -1
View File
@@ -34,7 +34,7 @@
#include "slic3r/GUI/Widgets/SideMenuPopup.hpp" #include "slic3r/GUI/Widgets/SideMenuPopup.hpp"
#include <utility> #include <utility>
#include "libslic3r/libslic3r.h" #include "libslic3r/libslic3r.h"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <algorithm> #include <algorithm>
#include <wx/dirdlg.h> #include <wx/dirdlg.h>
#include <exception> #include <exception>
@@ -155,6 +155,8 @@
#include <wx/window.h> #include <wx/window.h>
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+2
View File
@@ -45,6 +45,8 @@
#include "../Utils/MacDarkMode.hpp" #include "../Utils/MacDarkMode.hpp"
#endif #endif
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+3 -1
View File
@@ -13,7 +13,7 @@
#include "slic3r/GUI/Widgets/WebView.hpp" #include "slic3r/GUI/Widgets/WebView.hpp"
#include <wx/log.h> #include <wx/log.h>
#include <wx/webview.h> #include <wx/webview.h>
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <exception> #include <exception>
#include <wx/wx.h> #include <wx/wx.h>
#include <wx/sizer.h> #include <wx/sizer.h>
@@ -24,6 +24,8 @@
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "Plater.hpp" #include "Plater.hpp"
using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; } namespace Slic3r::GUI { class Plater; }
namespace Slic3r { namespace Slic3r {
+3 -1
View File
@@ -15,7 +15,7 @@
#include "slic3r/GUI/StatusPanel.hpp" #include "slic3r/GUI/StatusPanel.hpp"
#include "slic3r/GUI/UpgradePanel.hpp" #include "slic3r/GUI/UpgradePanel.hpp"
#include "slic3r/GUI/Widgets/SideTools.hpp" #include "slic3r/GUI/Widgets/SideTools.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <wx/app.h> #include <wx/app.h>
#include <wx/bookctrl.h> #include <wx/bookctrl.h>
#include <wx/button.h> #include <wx/button.h>
@@ -57,6 +57,8 @@
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/Widgets/Button.hpp" #include "slic3r/GUI/Widgets/Button.hpp"
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+2 -2
View File
@@ -631,8 +631,8 @@ private:
// Aditional text after hypertext - currently not used // Aditional text after hypertext - currently not used
std::string m_text2; std::string m_text2;
// mark for render operation // mark for render operation
size_t pos_start = string::npos; size_t pos_start = std::string::npos;
size_t pos_end = string::npos; size_t pos_end = std::string::npos;
std::string error_start = "<Error>"; std::string error_start = "<Error>";
std::string error_end = "</Error>"; std::string error_end = "</Error>";
+4 -1
View File
@@ -16,7 +16,7 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
#include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <wx/app.h> #include <wx/app.h>
#include <wx/event.h> #include <wx/event.h>
#include <wx/filename.h> #include <wx/filename.h>
@@ -32,6 +32,9 @@
#include <OrcaCloudServiceAgent.hpp> #include <OrcaCloudServiceAgent.hpp>
#include <wx/event.h> #include <wx/event.h>
#include <wx/utils.h> #include <wx/utils.h>
using json = nlohmann::json;
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
PresetBundleDialog::PresetBundleDialog( PresetBundleDialog::PresetBundleDialog(
@@ -58,6 +58,8 @@
//#define PRINTER_FILE_SYSTEM_TEST //#define PRINTER_FILE_SYSTEM_TEST
#endif #endif
using json = nlohmann::json;
std::string last_system_error() { std::string last_system_error() {
return Slic3r::decode_path(std::error_code( return Slic3r::decode_path(std::error_code(
#ifdef _WIN32 #ifdef _WIN32
+7 -8
View File
@@ -22,7 +22,6 @@
#include <boost/enable_shared_from_this.hpp> #include <boost/enable_shared_from_this.hpp>
#include "nlohmann/json_fwd.hpp" #include "nlohmann/json_fwd.hpp"
using nlohmann::json;
#include <functional> #include <functional>
#include <deque> #include <deque>
@@ -290,17 +289,17 @@ private:
static void DumpLog(void* context, int level, tchar const *msg); static void DumpLog(void* context, int level, tchar const *msg);
private: private:
template<typename T> using Translator = std::function<int(json const &, T &, unsigned char const *)>; template<typename T> using Translator = std::function<int(nlohmann::json const &, T &, unsigned char const *)>;
typedef std::function<void(int, json const & resp)> callback_t; typedef std::function<void(int, nlohmann::json const & resp)> callback_t;
typedef std::function<int(int, json const &resp, unsigned char const *data)> callback_t2; typedef std::function<int(int, nlohmann::json const &resp, unsigned char const *data)> callback_t2;
typedef std::function<int(std::string &msg)> callback_t3; typedef std::function<int(std::string &msg)> callback_t3;
template<typename T> boost::uint32_t SendRequest(int type, json const &req, Translator<T> const &translator, Callback<T> const &callback, const std::string &param = "") template<typename T> boost::uint32_t SendRequest(int type, nlohmann::json const &req, Translator<T> const &translator, Callback<T> const &callback, const std::string &param = "")
{ {
auto c = [translator, callback, this](int result, json const &resp, unsigned char const *data) -> int auto c = [translator, callback, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int
{ {
T t; T t;
if (result == 0 || result == CONTINUE || result == FILE_EXIST) { if (result == 0 || result == CONTINUE || result == FILE_EXIST) {
@@ -323,7 +322,7 @@ private:
template<typename T> template<typename T>
void InstallNotify(int type, Translator<T> const& translator, Applier<T> const& applier) void InstallNotify(int type, Translator<T> const& translator, Applier<T> const& applier)
{ {
auto c = [translator, applier, this](int result, json const &resp, unsigned char const *data) -> int auto c = [translator, applier, this](int result, nlohmann::json const &resp, unsigned char const *data) -> int
{ {
T t; T t;
if (result == 0 || result == CONTINUE) { if (result == 0 || result == CONTINUE) {
@@ -345,7 +344,7 @@ private:
InstallNotify(type, c); InstallNotify(type, c);
} }
boost::uint32_t SendRequest(int type, json const &req, callback_t2 const &callback, const std::string &param = ""); boost::uint32_t SendRequest(int type, nlohmann::json const &req, callback_t2 const &callback, const std::string &param = "");
void InstallNotify(int type, callback_t2 const &callback); void InstallNotify(int type, callback_t2 const &callback);
+3 -1
View File
@@ -6,7 +6,6 @@
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <cstddef> #include <cstddef>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI.hpp"
#include <exception> #include <exception>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
@@ -30,6 +29,9 @@
#include <sstream> #include <sstream>
#include <slic3r/GUI/Widgets/WebView.hpp> #include <slic3r/GUI/Widgets/WebView.hpp>
using json = nlohmann::json;
//------------------------------------------ //------------------------------------------
// PrinterCloundAuthDialog // PrinterCloundAuthDialog
//------------------------------------------ //------------------------------------------
+3 -2
View File
@@ -16,7 +16,7 @@
#include <string> #include <string>
#include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/Auxiliary.hpp" #include "slic3r/GUI/Auxiliary.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include <map> #include <map>
@@ -54,7 +54,8 @@
#include <slic3r/GUI/Widgets/WebView.hpp> #include <slic3r/GUI/Widgets/WebView.hpp>
#include "slic3r/GUI/Jobs/SendJob.hpp" #include "slic3r/GUI/Jobs/SendJob.hpp"
#include "slic3r/GUI/Plater.hpp" #include "slic3r/GUI/Plater.hpp"
#include "slic3r/Utils/json_diff.hpp"
using json = nlohmann::json;
class wxWindow; class wxWindow;
+1 -2
View File
@@ -30,7 +30,6 @@
#include <wx/timer.h> #include <wx/timer.h>
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <atomic> #include <atomic>
#include <map> #include <map>
@@ -109,7 +108,7 @@ public:
void OnScriptMessage(wxWebViewEvent& evt); void OnScriptMessage(wxWebViewEvent& evt);
void RunScript(std::string content); void RunScript(std::string content);
std::map<std::string, std::vector<json>> Reload(wxString aux_path); std::map<std::string, std::vector<nlohmann::json>> Reload(wxString aux_path);
std::string formatBytes(unsigned long bytes); std::string formatBytes(unsigned long bytes);
wxString to_base64(std::string path); wxString to_base64(std::string path);
}; };
+6 -1
View File
@@ -74,6 +74,8 @@
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
using json = nlohmann::json;
namespace Slic3r::GUI { class Plater; } namespace Slic3r::GUI { class Plater; }
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@@ -1816,7 +1818,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);
+3 -1
View File
@@ -62,7 +62,7 @@
#include <cstdio> #include <cstdio>
#include <cstddef> #include <cstddef>
#include "libslic3r/Config.hpp" #include "libslic3r/Config.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <exception> #include <exception>
#include <cstdlib> #include <cstdlib>
#include <map> #include <map>
@@ -133,6 +133,8 @@
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
using json = nlohmann::json;
namespace Slic3r { class PrintBase; } namespace Slic3r { class PrintBase; }
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
+2 -1
View File
@@ -26,7 +26,7 @@
#include "slic3r/GUI/DeviceCore/DevDefs.h" #include "slic3r/GUI/DeviceCore/DevDefs.h"
#include "slic3r/GUI/PartPlate.hpp" #include "slic3r/GUI/PartPlate.hpp"
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include "slic3r/GUI/MsgDialog.hpp" #include "slic3r/GUI/MsgDialog.hpp"
#include "slic3r/GUI/Widgets/Label.hpp" #include "slic3r/GUI/Widgets/Label.hpp"
#include "slic3r/GUI/Widgets/TextInput.hpp" #include "slic3r/GUI/Widgets/TextInput.hpp"
@@ -77,6 +77,7 @@
#include <wx/dcgraph.h> #include <wx/dcgraph.h>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+2 -2
View File
@@ -23,7 +23,7 @@
#include <unordered_set> #include <unordered_set>
#include "slic3r/GUI/wxMediaCtrl3.h" #include "slic3r/GUI/wxMediaCtrl3.h"
#include "slic3r/GUI/Widgets/StaticBox.hpp" #include "slic3r/GUI/Widgets/StaticBox.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <boost/date_time/posix_time/ptime.hpp> #include <boost/date_time/posix_time/ptime.hpp>
#include <map> #include <map>
#include "libslic3r/calib.hpp" #include "libslic3r/calib.hpp"
@@ -689,7 +689,7 @@ protected:
int m_last_vcamera = -1; int m_last_vcamera = -1;
int m_model_mall_request_count = 0; int m_model_mall_request_count = 0;
bool m_is_load_with_temp = false; bool m_is_load_with_temp = false;
json m_rating_result; nlohmann::json m_rating_result;
wxWebRequest web_request; wxWebRequest web_request;
bool bed_temp_input = false; bool bed_temp_input = false;
+2 -1
View File
@@ -15,7 +15,7 @@
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
#include <string> #include <string>
#include "slic3r/GUI/BBLStatusBarPrint.hpp" #include "slic3r/GUI/BBLStatusBarPrint.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <cassert> #include <cassert>
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include <cstdlib> #include <cstdlib>
@@ -85,6 +85,7 @@
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
using namespace Slic3r; using namespace Slic3r;
using namespace Slic3r::GUI; using namespace Slic3r::GUI;
+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");
-1
View File
@@ -20,7 +20,6 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <utility> #include <utility>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
using namespace nlohmann; using namespace nlohmann;
+3 -1
View File
@@ -1,4 +1,4 @@
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "UserManager.hpp" #include "UserManager.hpp"
#include "BindDialog.hpp" #include "BindDialog.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
@@ -10,6 +10,8 @@
#include <wx/string.h> #include <wx/string.h>
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
UserManager::UserManager(NetworkAgent* agent) UserManager::UserManager(NetworkAgent* agent)
-3
View File
@@ -9,12 +9,9 @@
#include <chrono> #include <chrono>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
using namespace nlohmann;
namespace Slic3r { namespace Slic3r {
class NetworkAgent; class NetworkAgent;
+1 -1
View File
@@ -4,7 +4,7 @@
#include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI.hpp"
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <exception> #include <exception>
#include <string.h> #include <string.h>
#include "I18N.hpp" #include "I18N.hpp"
+1 -2
View File
@@ -36,7 +36,7 @@
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
#include "libslic3r/PresetCacheFormat.hpp" #include "libslic3r/PresetCacheFormat.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include "libslic3r_version.h" #include "libslic3r_version.h"
#include <string> #include <string>
@@ -78,7 +78,6 @@
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include "slic3r/Utils/NetworkAgent.hpp" #include "slic3r/Utils/NetworkAgent.hpp"
#include "slic3r/Utils/PresetUpdater.hpp" #include "slic3r/Utils/PresetUpdater.hpp"
#include "slic3r/Utils/json_diff.hpp"
class wxWindow; class wxWindow;
-1
View File
@@ -5,7 +5,6 @@
#include "slic3r/GUI/HttpServer.hpp" #include "slic3r/GUI/HttpServer.hpp"
#include <memory> #include <memory>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
#include "slic3r/GUI/GUI.hpp" #include "slic3r/GUI/GUI.hpp"
#include <exception> #include <exception>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
+2 -1
View File
@@ -24,7 +24,7 @@
#include <wx/filename.h> #include <wx/filename.h>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include <functional> #include <functional>
#include <cstddef> #include <cstddef>
#include <wx/dialog.h> #include <wx/dialog.h>
@@ -44,6 +44,7 @@
#include <wx/infobar.h> #include <wx/infobar.h>
namespace pt = boost::property_tree; namespace pt = boost::property_tree;
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+3 -1
View File
@@ -3,7 +3,7 @@
#include "../I18N.hpp" #include "../I18N.hpp"
#include "../GUI_App.hpp" #include "../GUI_App.hpp"
#include "../MsgDialog.hpp" #include "../MsgDialog.hpp"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include <wx/anybutton.h> #include <wx/anybutton.h>
#include <wx/event.h> #include <wx/event.h>
@@ -28,6 +28,8 @@
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/sizer.h> #include <wx/sizer.h>
using json = nlohmann::json;
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
wxDEFINE_EVENT(EVT_FAN_SWITCH_ON, wxCommandEvent); wxDEFINE_EVENT(EVT_FAN_SWITCH_ON, wxCommandEvent);
+2 -1
View File
@@ -12,7 +12,7 @@
#include "Label.hpp" #include "Label.hpp"
#include "ComboBox.hpp" #include "ComboBox.hpp"
#include "StaticBox.hpp" #include "StaticBox.hpp"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
@@ -55,6 +55,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
+3 -2
View File
@@ -38,11 +38,12 @@
#include "Widgets/Label.hpp" #include "Widgets/Label.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/Printer/PrinterFileSystem.h" #include <nlohmann/json.hpp>
#include "slic3r/GUI/Jobs/SendJob.hpp" #include "slic3r/GUI/Jobs/SendJob.hpp"
#include "slic3r/Utils/json_diff.hpp"
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
using json = nlohmann::json;
class wxWindow; class wxWindow;
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
+9 -2
View File
@@ -453,9 +453,16 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
const bool menu_bitmap/* = false*/, const bool menu_bitmap/* = false*/,
const bool resize/* = false*/, const bool resize/* = false*/,
const bool bitmap2/* = false*/, const bool bitmap2/* = false*/,
const vector<std::string>& array_new_color/* = vector<std::string>*/)//used for semi transparent material) const std::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);
} }
@@ -494,7 +501,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in,
wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::BitmapCache& cache, wxWindow* win/* = nullptr*/ , wxBitmap create_scaled_bitmap2(const std::string& bmp_name_in, Slic3r::GUI::BitmapCache& cache, wxWindow* win/* = nullptr*/ ,
const int px_cnt/* = 16*/, const bool grayscale/* = false*/ , const bool resize/* = false*/ , const int px_cnt/* = 16*/, const bool grayscale/* = false*/ , const bool resize/* = false*/ ,
const vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange const std::vector<std::string>& array_new_color/* = vector<std::string>()*/) // color witch will used instead of orange
{ {
unsigned int width = 0; unsigned int width = 0;
// win may be nullptr; see create_scaled_bitmap() above. // win may be nullptr; see create_scaled_bitmap() above.
+2 -1
View File
@@ -6,7 +6,7 @@
#include "NetworkAgent.hpp" #include "NetworkAgent.hpp"
#include "../GUI/Jobs/ProgressIndicator.hpp" #include "../GUI/Jobs/ProgressIndicator.hpp"
#include "../GUI/PartPlate.hpp" #include "../GUI/PartPlate.hpp"
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "libslic3r/CutUtils.hpp" #include "libslic3r/CutUtils.hpp"
#include "libslic3r/ClipperUtils.hpp" #include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
@@ -61,6 +61,7 @@
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
using json = nlohmann::json;
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
+3 -1
View File
@@ -38,7 +38,7 @@
#include <wx/event.h> #include <wx/event.h>
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include "json_diff.hpp" #include <nlohmann/json.hpp>
#include "libslic3r/format.hpp" #include "libslic3r/format.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
#include "libslic3r/PresetBundle.hpp" #include "libslic3r/PresetBundle.hpp"
@@ -58,6 +58,8 @@
#include "slic3r/GUI/MarkdownTip.hpp" #include "slic3r/GUI/MarkdownTip.hpp"
#include "libslic3r/miniz_extension.hpp" #include "libslic3r/miniz_extension.hpp"
using json = nlohmann::json;
namespace Slic3r::GUI::Config { class Snapshot; } namespace Slic3r::GUI::Config { class Snapshot; }
namespace Slic3r::GUI::Config { class SnapshotDB; } namespace Slic3r::GUI::Config { class SnapshotDB; }
+13 -14
View File
@@ -8,7 +8,6 @@
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
using json = nlohmann::json;
using namespace std; using namespace std;
class json_diff class json_diff
@@ -16,25 +15,25 @@ class json_diff
private: private:
std::string printer_type; std::string printer_type;
std::string printer_version = "00.00.00.00"; std::string printer_version = "00.00.00.00";
json settings_base; nlohmann::json settings_base;
json full_message; nlohmann::json full_message;
json diff2all_base; nlohmann::json diff2all_base;
json all2diff_base; nlohmann::json all2diff_base;
int decode_error_count = 0; int decode_error_count = 0;
int diff_objects(json const &in, json &out, json const &base); int diff_objects(nlohmann::json const &in, nlohmann::json &out, nlohmann::json const &base);
int restore_objects(json const &in, json &out, json const &base); int restore_objects(nlohmann::json const &in, nlohmann::json &out, nlohmann::json const &base);
int restore_append_objects(json const &in, json &out); int restore_append_objects(nlohmann::json const &in, nlohmann::json &out);
void merge_objects(json const &in, json &out); void merge_objects(nlohmann::json const &in, nlohmann::json &out);
public: public:
bool load_compatible_settings(std::string const &type, std::string const &version); bool load_compatible_settings(std::string const &type, std::string const &version);
int all2diff(json const &in, json &out); int all2diff(nlohmann::json const &in, nlohmann::json &out);
int diff2all(json const &in, json &out); int diff2all(nlohmann::json const &in, nlohmann::json &out);
int all2diff_base_reset(json const &base); int all2diff_base_reset(nlohmann::json const &base);
int diff2all_base_reset(json &base); int diff2all_base_reset(nlohmann::json &base);
void compare_print(json &a, json &b); void compare_print(nlohmann::json &a, nlohmann::json &b);
bool is_need_request(); bool is_need_request();
}; };
+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;