mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-07 15:51:08 +00:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7b740e155 | ||
|
|
f9ddb23804 | ||
|
|
ff8aebe76f | ||
|
|
a56d1bf33e | ||
|
|
662a8e340d | ||
|
|
6639a32b0c | ||
|
|
1ec195a221 | ||
|
|
e5324ae319 | ||
|
|
559ad3e2b7 | ||
|
|
de6b0b9f2d | ||
|
|
f02292f163 | ||
|
|
23546e71ce | ||
|
|
73d32d4791 | ||
|
|
67ff6bd34b |
+9
-4
@@ -1,10 +1,15 @@
|
||||
# clang-tidy configuration, enforced by the clang-tidy CI job on the lines a pull
|
||||
# request changes (scripts/clang_tidy_diff.py). Only missing includes are reported
|
||||
# for now: a file should include the header for every symbol it uses, not rely on
|
||||
# the precompiled header or another header's includes. Run with --fix to add them.
|
||||
# request changes (scripts/clang_tidy_diff.py). Two things are reported.
|
||||
# Missing includes: a file should include the header for every symbol it uses, not
|
||||
# rely on the precompiled header or another header's includes. Run with --fix to
|
||||
# add them.
|
||||
# Using-directives and using-declarations in the global namespace of a header:
|
||||
# they reach every file that includes the header, and a using-declaration also
|
||||
# makes the header look like the one to include for that name. Qualify the name
|
||||
# in the header, and put the using in the source files that want it.
|
||||
# Every check listed here gates pull requests, so enable a new one only once the
|
||||
# code it flags on touched lines is reasonable to fix in passing.
|
||||
Checks: '-*,misc-include-cleaner'
|
||||
Checks: '-*,misc-include-cleaner,google-global-names-in-headers'
|
||||
WarningsAsErrors: '*'
|
||||
CheckOptions:
|
||||
# Missing includes only. Builds without the precompiled header break on these.
|
||||
|
||||
@@ -4,15 +4,17 @@ OrcaSlicer — open-source C++17 3D slicer. wxWidgets GUI, CMake build system.
|
||||
|
||||
## Build Commands
|
||||
|
||||
Build the Release configuration unless asked otherwise.
|
||||
|
||||
```bash
|
||||
# macOS
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
cmake --build build/arm64 --config Release --target all --
|
||||
|
||||
# Linux
|
||||
cmake --build build --config RelWithDebInfo --target all --
|
||||
cmake --build build --config Release --target all --
|
||||
|
||||
# Windows (replace %build_type% with Debug/Release/RelWithDebInfo)
|
||||
cmake --build . --config %build_type% --target ALL_BUILD -- -m
|
||||
# Windows
|
||||
cmake --build . --config Release --target ALL_BUILD -- -m
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
@@ -311,11 +311,12 @@ def main():
|
||||
for path in fixed:
|
||||
print(f" {path}")
|
||||
if failed and fixed:
|
||||
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not add.")
|
||||
print(f"\nclang-tidy still fails on {len(failed)} file(s); the findings above are what --fix could not fix.")
|
||||
return 1
|
||||
if failed:
|
||||
print(f"\nclang-tidy failed on {len(failed)} file(s). Add the includes it names, or apply its "
|
||||
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows).")
|
||||
"suggestions locally with scripts/run_clang_tidy.sh --fix (scripts\\run_clang_tidy.ps1 -Fix on Windows). "
|
||||
"Other findings need a manual fix.")
|
||||
return 1
|
||||
print("clang-tidy passed.")
|
||||
return 0
|
||||
|
||||
@@ -4,5 +4,10 @@
|
||||
<dict>
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
<!-- The Bambu network plug-in's code protector rewrites one of its own signed code pages
|
||||
after loading. Under the hardened runtime macOS kills the process when that page is
|
||||
paged back in; this lets it run, as Bambu Studio's signature does. -->
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
+16
-7
@@ -23,7 +23,6 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "libslic3r/PrintBase.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <boost/date_time/posix_time/posix_time_duration.hpp>
|
||||
#include <cerrno>
|
||||
#include <utility>
|
||||
@@ -78,12 +77,10 @@
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <boost/thread.hpp>
|
||||
//add json logic
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
#endif
|
||||
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/nowide/args.hpp>
|
||||
@@ -157,6 +154,7 @@ using namespace nlohmann;
|
||||
#include <stdio.h>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
using json = nlohmann::json;
|
||||
|
||||
#ifdef __WXGTK__
|
||||
#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");
|
||||
if (!curr_variant_opt) {
|
||||
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));
|
||||
}
|
||||
const ConfigOptionStrings *new_variant_opt = dynamic_cast<const ConfigOptionStrings*>(config.option("filament_extruder_variant", true));
|
||||
@@ -3620,6 +3618,9 @@ int CLI::run(int argc, char **argv)
|
||||
{
|
||||
if (opt_key == "compatible_prints" || opt_key == "compatible_printers" || opt_key == "model_id" || opt_key == "dev_model_name" || opt_key == "filament_settings_id")
|
||||
continue;
|
||||
// rebuilt from every filament after this loop
|
||||
if (filament_dev_options.find(opt_key) != filament_dev_options.end())
|
||||
continue;
|
||||
ConfigOption *opt = m_print_config.option(opt_key, true);
|
||||
if (opt == nullptr) {
|
||||
// opt_key does not exist in this ConfigBase and it cannot be created, because it is not defined by this->def().
|
||||
@@ -3683,6 +3684,14 @@ int CLI::run(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
// The stored values cannot be told apart per filament, so they are kept as they are unless every slot has a config.
|
||||
std::vector<const DynamicPrintConfig *> filament_configs(filament_count, nullptr);
|
||||
for (size_t index = 0; index < load_filaments_config.size(); index++)
|
||||
if (load_filaments_index[index] >= 1 && load_filaments_index[index] <= filament_count)
|
||||
filament_configs[load_filaments_index[index] - 1] = &load_filaments_config[index];
|
||||
if (std::find(filament_configs.begin(), filament_configs.end(), nullptr) == filament_configs.end())
|
||||
set_filament_dev_options(m_print_config, filament_configs);
|
||||
|
||||
if (m_print_config.option<ConfigOptionStrings>("filament_extruder_variant")) {
|
||||
std::vector<int>& filament_self_indice = m_print_config.option<ConfigOptionInts>("filament_self_index", true)->values;
|
||||
int index_size = m_print_config.option<ConfigOptionStrings>("filament_extruder_variant")->size();
|
||||
@@ -6554,7 +6563,7 @@ int CLI::run(int argc, char **argv)
|
||||
std::vector<int> result_filaments;
|
||||
//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()));
|
||||
unprintable_filament_vec[index].end(), std::insert_iterator<std::vector<int>>(result_filaments, result_filaments.begin()));
|
||||
conflict_filament_vector = result_filaments;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,10 @@
|
||||
<!-- for dynamic loading of libraries without signature validation. Used for 3dconnection drivers.-->
|
||||
<key>com.apple.security.cs.disable-library-validation</key>
|
||||
<true/>
|
||||
<!-- The Bambu network plug-in's code protector rewrites one of its own signed code pages
|
||||
after loading. Under the hardened runtime macOS kills the process when that page is
|
||||
paged back in; this lets it run, as Bambu Studio's signature does. -->
|
||||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include "libslic3r/Semver.hpp"
|
||||
#include "calib.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
#define ENV_DEV_HOST "0"
|
||||
#define ENV_QAT_HOST "1"
|
||||
#define ENV_PRE_HOST "2"
|
||||
|
||||
@@ -466,8 +466,6 @@ void SkeletalTrapezoidation::constructFromPolygons(const Polygons& polys)
|
||||
edge.from->incident_edge = &edge;
|
||||
}
|
||||
|
||||
using NodeSet = SkeletalTrapezoidation::NodeSet;
|
||||
|
||||
void SkeletalTrapezoidation::separatePointyQuadEndNodes()
|
||||
{
|
||||
NodeSet visited_nodes;
|
||||
|
||||
@@ -93,7 +93,6 @@ using namespace libnest2d;
|
||||
using Item = _Item<ExPolygon>;
|
||||
using Box = _Box<Point>;
|
||||
using Circle = _Circle<Point>;
|
||||
using Segment = _Segment<Point>;
|
||||
using MultiPolygon = ExPolygons;
|
||||
|
||||
// Summon the spatial indexing facilities from boost
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
#include <cmath>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include <functional>
|
||||
#include <gp_XY.hxx>
|
||||
#include <initializer_list>
|
||||
#include <math.h>
|
||||
|
||||
@@ -261,8 +261,6 @@ set(lisbslic3r_sources
|
||||
GCode/PreciseSeam.cpp
|
||||
GCode/PreciseSeam.hpp
|
||||
GCode/PreciseSeamInternal.hpp
|
||||
#GCodeSender.cpp
|
||||
#GCodeSender.hpp
|
||||
GCode/SmallAreaInfillFlowCompensator.cpp
|
||||
GCode/SmallAreaInfillFlowCompensator.hpp
|
||||
GCode/SpiralVase.cpp
|
||||
@@ -447,7 +445,6 @@ set(lisbslic3r_sources
|
||||
SLA/SupportTreeBuildsteps.hpp
|
||||
SLA/SupportTree.cpp
|
||||
SLA/SupportTree.hpp
|
||||
#SLA/SupportTreeIGL.cpp
|
||||
SLA/SupportTreeMesher.cpp
|
||||
SLA/SupportTreeMesher.hpp
|
||||
SlicesToTriangleMesh.cpp
|
||||
|
||||
@@ -23,11 +23,6 @@ enum ClipType { ctIntersection, ctUnion, ctDifference, ctXor };
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
// import these wherever we're included
|
||||
using Slic3r::jtMiter;
|
||||
using Slic3r::jtRound;
|
||||
using Slic3r::jtSquare;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
static constexpr const float ClipperSafetyOffset = 10.f;
|
||||
|
||||
@@ -2589,7 +2589,6 @@ void priv::create_face_types(FaceTypeMap &map,
|
||||
}
|
||||
|
||||
#include <CGAL/Polygon_mesh_processing/clip.h>
|
||||
#include <CGAL/Polygon_mesh_processing/corefinement.h>
|
||||
bool priv::clip_cut(SurfacePatch &cut, CutMesh clipper)
|
||||
{
|
||||
CutMesh& tm = cut.mesh;
|
||||
@@ -2851,7 +2850,6 @@ bool is_patch_inside_of_model(const SurfacePatch &patch,
|
||||
/// <returns>shape point index</returns>
|
||||
uint32_t get_shape_point_index(const CutAOI &cut, const CutMesh &model);
|
||||
|
||||
using PatchNumber = CutMesh::Property_map<FI, size_t>;
|
||||
/// <summary>
|
||||
/// Separate triangles singned with number n
|
||||
/// </summary>
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "Emboss.hpp"
|
||||
#include <optional>
|
||||
#include <stdio.h>
|
||||
#include <numeric>
|
||||
#include <cstdlib>
|
||||
#include <boost/nowide/convert.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
// #define DEBUG_FUZZY
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
namespace Slic3r::Feature::FuzzySkin {
|
||||
|
||||
// Produces a random value between 0 and 1. Thread-safe.
|
||||
|
||||
@@ -122,8 +122,6 @@ Polylines get_polylines(const ScalarField& sf, const double tolerance = SCALED_E
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
using namespace std;
|
||||
|
||||
void FillTpmsFK::_fill_surface_single(const FillParams& params,
|
||||
unsigned int thickness_layers,
|
||||
const std::pair<float, Point>& direction,
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <boost/property_tree/xml_parser.hpp>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
#include "TDataStd_Name.hxx"
|
||||
#include "BRepBuilderAPI_Transform.hxx"
|
||||
#include "TopExp_Explorer.hxx"
|
||||
#include "TopExp_Explorer.hxx"
|
||||
#include "BRep_Tool.hxx"
|
||||
#include "BRepTools.hxx"
|
||||
#include <IMeshTools_Parameters.hxx>
|
||||
|
||||
@@ -43,7 +43,6 @@
|
||||
#include "Print.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "libslic3r.h"
|
||||
#include "LocalesUtils.hpp"
|
||||
#include "libslic3r/format.hpp"
|
||||
#include "Time.hpp"
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include "../PrintConfig.hpp"
|
||||
#include "../Utils.hpp"
|
||||
#include "Print.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <string>
|
||||
|
||||
@@ -1135,7 +1135,6 @@ void SeamPlacer::gather_seam_candidates(const PrintObject *po, const SeamPlacerI
|
||||
|
||||
void SeamPlacer::calculate_candidates_visibility(const PrintObject *po,
|
||||
const SeamPlacerImpl::GlobalModelInfo &global_model_info) {
|
||||
using namespace SeamPlacerImpl;
|
||||
|
||||
std::vector<PrintObjectSeamData::LayerSeams> &layers = m_seam_per_object[po].layers;
|
||||
tbb::parallel_for(tbb::blocked_range<size_t>(0, layers.size()),
|
||||
|
||||
@@ -1482,7 +1482,6 @@ static FilamentGroupContext build_filament_group_context(
|
||||
FilamentMapMode mode,
|
||||
const std::unordered_map<int, int>& nozzle_status)
|
||||
{
|
||||
using namespace MultiNozzleUtils;
|
||||
using namespace FilamentGroupUtils;
|
||||
|
||||
FilamentGroupContext context;
|
||||
@@ -1691,7 +1690,6 @@ static std::vector<int> apply_master_extruder_preference(const FilamentGroupCont
|
||||
// multi-nozzle (H2C/A2L) resolves to a nozzle-granular result.
|
||||
MultiNozzleUtils::LayeredNozzleGroupResult ToolOrdering::get_recommended_filament_maps(const std::vector<std::vector<unsigned int>>& layer_filaments, const Print* print, const FilamentMapMode mode, const std::vector<std::set<int>>& physical_unprintables, const std::vector<std::set<int>>& geometric_unprintables, const std::map<int, std::set<NozzleVolumeType>>& unprintable_volumes, const std::unordered_map<int, int>& nozzle_status)
|
||||
{
|
||||
using namespace FilamentGroupUtils;
|
||||
using namespace MultiNozzleUtils;
|
||||
|
||||
if (!print || layer_filaments.empty())
|
||||
|
||||
@@ -1,580 +0,0 @@
|
||||
#include "GCodeSender.hpp"
|
||||
#include <iostream>
|
||||
#include <istream>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#if defined(__APPLE__) || defined(__OpenBSD__)
|
||||
#include <termios.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
#include <sys/ioctl.h>
|
||||
#include <IOKit/serial/ioss.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include "/usr/include/asm-generic/ioctls.h"
|
||||
|
||||
/* The following definitions are kindly borrowed from:
|
||||
/usr/include/asm-generic/termbits.h
|
||||
Unfortunately we cannot just include that one because
|
||||
it would redefine the "struct termios" already defined
|
||||
the <termios.h> already included by Boost.ASIO. */
|
||||
#define K_NCCS 19
|
||||
struct termios2 {
|
||||
tcflag_t c_iflag;
|
||||
tcflag_t c_oflag;
|
||||
tcflag_t c_cflag;
|
||||
tcflag_t c_lflag;
|
||||
cc_t c_line;
|
||||
cc_t c_cc[K_NCCS];
|
||||
speed_t c_ispeed;
|
||||
speed_t c_ospeed;
|
||||
};
|
||||
#define BOTHER CBAUDEX
|
||||
|
||||
#endif
|
||||
|
||||
//#define DEBUG_SERIAL
|
||||
#ifdef DEBUG_SERIAL
|
||||
#include <cstdlib>
|
||||
#include <fstream>
|
||||
std::fstream fs;
|
||||
#endif
|
||||
|
||||
#define KEEP_SENT 20
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
GCodeSender::GCodeSender()
|
||||
: io(), serial(io), can_send(false), sent(0), open(false), error(false),
|
||||
connected(false), queue_paused(false)
|
||||
{
|
||||
#ifdef DEBUG_SERIAL
|
||||
std::srand(std::time(nullptr));
|
||||
#endif
|
||||
}
|
||||
|
||||
GCodeSender::~GCodeSender()
|
||||
{
|
||||
this->disconnect();
|
||||
}
|
||||
|
||||
bool
|
||||
GCodeSender::connect(std::string devname, unsigned int baud_rate)
|
||||
{
|
||||
this->disconnect();
|
||||
|
||||
this->set_error_status(false);
|
||||
try {
|
||||
this->serial.open(devname);
|
||||
|
||||
this->serial.set_option(boost::asio::serial_port_base::parity(boost::asio::serial_port_base::parity::odd));
|
||||
this->serial.set_option(boost::asio::serial_port_base::character_size(boost::asio::serial_port_base::character_size(8)));
|
||||
this->serial.set_option(boost::asio::serial_port_base::flow_control(boost::asio::serial_port_base::flow_control::none));
|
||||
this->serial.set_option(boost::asio::serial_port_base::stop_bits(boost::asio::serial_port_base::stop_bits::one));
|
||||
this->set_baud_rate(baud_rate);
|
||||
|
||||
this->serial.close();
|
||||
this->serial.open(devname);
|
||||
this->serial.set_option(boost::asio::serial_port_base::parity(boost::asio::serial_port_base::parity::none));
|
||||
|
||||
// set baud rate again because set_option overwrote it
|
||||
this->set_baud_rate(baud_rate);
|
||||
this->open = true;
|
||||
this->reset();
|
||||
} catch (boost::system::system_error &) {
|
||||
this->set_error_status(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// a reset firmware expect line numbers to start again from 1
|
||||
this->sent = 0;
|
||||
this->last_sent.clear();
|
||||
|
||||
/* Initialize debugger */
|
||||
#ifdef DEBUG_SERIAL
|
||||
fs.open("serial.txt", std::fstream::out | std::fstream::trunc);
|
||||
#endif
|
||||
|
||||
// this gives some work to the io_service before it is started
|
||||
// (post() runs the supplied function in its thread)
|
||||
this->io.post(boost::bind(&GCodeSender::do_read, this));
|
||||
|
||||
// start reading in the background thread
|
||||
boost::thread t(boost::bind(&boost::asio::io_service::run, &this->io));
|
||||
this->background_thread.swap(t);
|
||||
|
||||
// always send a M105 to check for connection because firmware might be silent on connect
|
||||
//FIXME Vojtech: This is being sent too early, leading to line number synchronization issues,
|
||||
// from which the GCodeSender never recovers.
|
||||
// this->send("M105", true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::set_baud_rate(unsigned int baud_rate)
|
||||
{
|
||||
try {
|
||||
// This does not support speeds > 115200
|
||||
this->serial.set_option(boost::asio::serial_port_base::baud_rate(baud_rate));
|
||||
} catch (boost::system::system_error &) {
|
||||
boost::asio::serial_port::native_handle_type handle = this->serial.native_handle();
|
||||
|
||||
#if __APPLE__
|
||||
termios ios;
|
||||
::tcgetattr(handle, &ios);
|
||||
::cfsetspeed(&ios, baud_rate);
|
||||
speed_t newSpeed = baud_rate;
|
||||
ioctl(handle, IOSSIOSPEED, &newSpeed);
|
||||
::tcsetattr(handle, TCSANOW, &ios);
|
||||
#elif __linux__
|
||||
termios2 ios;
|
||||
if (ioctl(handle, TCGETS2, &ios))
|
||||
printf("Error in TCGETS2: %s\n", strerror(errno));
|
||||
ios.c_ispeed = ios.c_ospeed = baud_rate;
|
||||
ios.c_cflag &= ~CBAUD;
|
||||
ios.c_cflag |= BOTHER | CLOCAL | CREAD;
|
||||
ios.c_cc[VMIN] = 1; // Minimum of characters to read, prevents eof errors when 0 bytes are read
|
||||
ios.c_cc[VTIME] = 1;
|
||||
if (ioctl(handle, TCSETS2, &ios))
|
||||
printf("Error in TCSETS2: %s\n", strerror(errno));
|
||||
|
||||
#elif __OpenBSD__
|
||||
struct termios ios;
|
||||
::tcgetattr(handle, &ios);
|
||||
::cfsetspeed(&ios, baud_rate);
|
||||
if (::tcsetattr(handle, TCSAFLUSH, &ios) != 0)
|
||||
printf("Failed to set baud rate: %s\n", strerror(errno));
|
||||
#else
|
||||
//throw Slic3r::InvalidArgument("OS does not currently support custom bauds");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::disconnect()
|
||||
{
|
||||
if (!this->open) return;
|
||||
this->open = false;
|
||||
this->connected = false;
|
||||
this->io.post(boost::bind(&GCodeSender::do_close, this));
|
||||
this->background_thread.join();
|
||||
this->io.reset();
|
||||
/*
|
||||
if (this->error_status()) {
|
||||
throw(boost::system::system_error(boost::system::error_code(),
|
||||
"Error while closing the device"));
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef DEBUG_SERIAL
|
||||
fs << "DISCONNECTED" << std::endl << std::flush;
|
||||
fs.close();
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
GCodeSender::is_connected() const
|
||||
{
|
||||
return this->connected;
|
||||
}
|
||||
|
||||
bool
|
||||
GCodeSender::wait_connected(unsigned int timeout) const
|
||||
{
|
||||
using namespace boost::posix_time;
|
||||
ptime t0 = second_clock::local_time() + seconds(timeout);
|
||||
while (!this->connected) {
|
||||
if (second_clock::local_time() > t0) return false;
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
size_t
|
||||
GCodeSender::queue_size() const
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
return this->queue.size();
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::pause_queue()
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
this->queue_paused = true;
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::resume_queue()
|
||||
{
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
this->queue_paused = false;
|
||||
}
|
||||
this->send();
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::purge_queue(bool priority)
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
if (priority) {
|
||||
// clear priority queue
|
||||
std::list<std::string> empty;
|
||||
std::swap(this->priqueue, empty);
|
||||
} else {
|
||||
// clear queue
|
||||
std::queue<std::string> empty;
|
||||
std::swap(this->queue, empty);
|
||||
this->queue_paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
// purge log and return its contents
|
||||
std::vector<std::string>
|
||||
GCodeSender::purge_log()
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->log_mutex);
|
||||
std::vector<std::string> retval;
|
||||
retval.reserve(this->log.size());
|
||||
while (!this->log.empty()) {
|
||||
retval.push_back(this->log.front());
|
||||
this->log.pop();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string
|
||||
GCodeSender::getT() const
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->log_mutex);
|
||||
return this->T;
|
||||
}
|
||||
|
||||
std::string
|
||||
GCodeSender::getB() const
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->log_mutex);
|
||||
return this->B;
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::do_close()
|
||||
{
|
||||
this->set_error_status(false);
|
||||
boost::system::error_code ec;
|
||||
this->serial.cancel(ec);
|
||||
if (ec) this->set_error_status(true);
|
||||
this->serial.close(ec);
|
||||
if (ec) this->set_error_status(true);
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::set_error_status(bool e)
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->error_mutex);
|
||||
this->error = e;
|
||||
}
|
||||
|
||||
bool
|
||||
GCodeSender::error_status() const
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->error_mutex);
|
||||
return this->error;
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::do_read()
|
||||
{
|
||||
// read one line
|
||||
boost::asio::async_read_until(
|
||||
this->serial,
|
||||
this->read_buffer,
|
||||
'\n',
|
||||
boost::bind(
|
||||
&GCodeSender::on_read,
|
||||
this,
|
||||
boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::on_read(const boost::system::error_code& error,
|
||||
size_t bytes_transferred)
|
||||
{
|
||||
this->set_error_status(false);
|
||||
if (error) {
|
||||
#ifdef __APPLE__
|
||||
if (error.value() == 45) {
|
||||
// OS X bug: http://osdir.com/ml/lib.boost.asio.user/2008-08/msg00004.html
|
||||
this->do_read();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// printf("ERROR: [%d] %s\n", error.value(), error.message().c_str());
|
||||
// error can be true even because the serial port was closed.
|
||||
// In this case it is not a real error, so ignore.
|
||||
if (this->open) {
|
||||
this->do_close();
|
||||
this->set_error_status(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::istream is(&this->read_buffer);
|
||||
std::string line;
|
||||
std::getline(is, line);
|
||||
if (!line.empty()) {
|
||||
#ifdef DEBUG_SERIAL
|
||||
fs << "<< " << line << std::endl << std::flush;
|
||||
#endif
|
||||
|
||||
// note that line might contain \r at its end
|
||||
// parse incoming line
|
||||
if (!this->connected
|
||||
&& (boost::starts_with(line, "start")
|
||||
|| boost::starts_with(line, "Grbl ")
|
||||
|| boost::starts_with(line, "ok")
|
||||
|| boost::contains(line, "T:"))) {
|
||||
this->connected = true;
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
this->can_send = true;
|
||||
}
|
||||
this->send();
|
||||
} else if (boost::starts_with(line, "ok")) {
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
this->can_send = true;
|
||||
}
|
||||
this->send();
|
||||
} else if (boost::istarts_with(line, "resend") // Marlin uses "Resend: "
|
||||
|| boost::istarts_with(line, "rs")) {
|
||||
// extract the first number from line
|
||||
boost::algorithm::trim_left_if(line, !boost::algorithm::is_digit());
|
||||
size_t toresend = boost::lexical_cast<size_t>(line.substr(0, line.find_first_not_of("0123456789")));
|
||||
|
||||
#ifdef DEBUG_SERIAL
|
||||
fs << "!! line num out of sync: toresend = " << toresend << ", sent = " << sent << ", last_sent.size = " << last_sent.size() << std::endl;
|
||||
#endif
|
||||
|
||||
if (toresend > this->sent - this->last_sent.size() && toresend <= this->sent) {
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
|
||||
const auto lines_to_resend = this->sent - toresend + 1;
|
||||
#ifdef DEBUG_SERIAL
|
||||
fs << "!! resending " << lines_to_resend << " lines" << std::endl;
|
||||
#endif
|
||||
// move the unsent lines to priqueue
|
||||
this->priqueue.insert(
|
||||
this->priqueue.begin(), // insert at the beginning
|
||||
this->last_sent.begin() + this->last_sent.size() - lines_to_resend,
|
||||
this->last_sent.end()
|
||||
);
|
||||
|
||||
// we can empty last_sent because it's not useful anymore
|
||||
this->last_sent.clear();
|
||||
|
||||
// start resending with the requested line number
|
||||
this->sent = toresend - 1;
|
||||
this->can_send = true;
|
||||
}
|
||||
this->send();
|
||||
} else {
|
||||
printf("Cannot resend %zu (oldest we have is %zu)\n", toresend, this->sent - this->last_sent.size());
|
||||
}
|
||||
} else if (boost::starts_with(line, "wait")) {
|
||||
// ignore
|
||||
} else {
|
||||
// push any other line into the log
|
||||
boost::lock_guard<boost::mutex> l(this->log_mutex);
|
||||
this->log.push(line);
|
||||
}
|
||||
|
||||
// parse temperature info
|
||||
{
|
||||
size_t pos = line.find("T:");
|
||||
if (pos != std::string::npos && line.size() > pos + 2) {
|
||||
// we got temperature info
|
||||
boost::lock_guard<boost::mutex> l(this->log_mutex);
|
||||
this->T = line.substr(pos+2, line.find_first_not_of("0123456789.", pos+2) - (pos+2));
|
||||
|
||||
pos = line.find("B:");
|
||||
if (pos != std::string::npos && line.size() > pos + 2) {
|
||||
// we got bed temperature info
|
||||
this->B = line.substr(pos+2, line.find_first_not_of("0123456789.", pos+2) - (pos+2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this->do_read();
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::send(const std::vector<std::string> &lines, bool priority)
|
||||
{
|
||||
// append lines to queue
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
for (std::vector<std::string>::const_iterator line = lines.begin(); line != lines.end(); ++line) {
|
||||
if (priority) {
|
||||
this->priqueue.push_back(*line);
|
||||
} else {
|
||||
this->queue.push(*line);
|
||||
}
|
||||
}
|
||||
}
|
||||
this->send();
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::send(const std::string &line, bool priority)
|
||||
{
|
||||
// append line to queue
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
if (priority) {
|
||||
this->priqueue.push_back(line);
|
||||
} else {
|
||||
this->queue.push(line);
|
||||
}
|
||||
}
|
||||
this->send();
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::send()
|
||||
{
|
||||
this->io.post(boost::bind(&GCodeSender::do_send, this));
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::do_send()
|
||||
{
|
||||
boost::lock_guard<boost::mutex> l(this->queue_mutex);
|
||||
|
||||
// printer is not connected or we're still waiting for the previous ack
|
||||
if (!this->can_send) return;
|
||||
|
||||
std::string line;
|
||||
while (!this->priqueue.empty() || (!this->queue.empty() && !this->queue_paused)) {
|
||||
if (!this->priqueue.empty()) {
|
||||
line = this->priqueue.front();
|
||||
this->priqueue.pop_front();
|
||||
} else {
|
||||
line = this->queue.front();
|
||||
this->queue.pop();
|
||||
}
|
||||
|
||||
// strip comments
|
||||
size_t comment_pos = line.find_first_of(';');
|
||||
if (comment_pos != std::string::npos)
|
||||
line.erase(comment_pos, std::string::npos);
|
||||
boost::algorithm::trim(line);
|
||||
|
||||
// if line is not empty, send it
|
||||
if (!line.empty()) break;
|
||||
// if line is empty, process next item in queue
|
||||
}
|
||||
if (line.empty()) return;
|
||||
|
||||
// compute full line
|
||||
++ this->sent;
|
||||
#ifndef DEBUG_SERIAL
|
||||
const auto line_num = this->sent;
|
||||
#else
|
||||
// In DEBUG_SERIAL mode, test line re-synchronization by sending bad line number 1/4 of the time
|
||||
const auto line_num = std::rand() < RAND_MAX/4 ? 0 : this->sent;
|
||||
#endif
|
||||
std::string full_line = "N" + boost::lexical_cast<std::string>(line_num) + " " + line;
|
||||
|
||||
// calculate checksum
|
||||
int cs = 0;
|
||||
for (std::string::const_iterator it = full_line.begin(); it != full_line.end(); ++it)
|
||||
cs = cs ^ *it;
|
||||
|
||||
// write line to device
|
||||
full_line += "*";
|
||||
full_line += boost::lexical_cast<std::string>(cs);
|
||||
full_line += "\n";
|
||||
|
||||
#ifdef DEBUG_SERIAL
|
||||
fs << ">> " << full_line << std::flush;
|
||||
#endif
|
||||
|
||||
this->last_sent.push_back(line);
|
||||
this->can_send = false;
|
||||
|
||||
while (this->last_sent.size() > KEEP_SENT) {
|
||||
this->last_sent.pop_front();
|
||||
}
|
||||
|
||||
// we can't supply boost::asio::buffer(full_line) to async_write() because full_line is on the
|
||||
// stack and the buffer would lose its underlying storage causing memory corruption
|
||||
std::ostream os(&this->write_buffer);
|
||||
os << full_line;
|
||||
boost::asio::async_write(this->serial, this->write_buffer, boost::bind(&GCodeSender::on_write, this, boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::on_write(const boost::system::error_code& error,
|
||||
size_t bytes_transferred)
|
||||
{
|
||||
this->set_error_status(false);
|
||||
if (error) {
|
||||
if (this->open) {
|
||||
this->do_close();
|
||||
this->set_error_status(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this->do_send();
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::set_DTR(bool on)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__SYMBIAN32__)
|
||||
boost::asio::serial_port_service::native_handle_type handle = this->serial.native_handle();
|
||||
if (on)
|
||||
EscapeCommFunction(handle, SETDTR);
|
||||
else
|
||||
EscapeCommFunction(handle, CLRDTR);
|
||||
#else
|
||||
int fd = this->serial.native_handle();
|
||||
int status;
|
||||
ioctl(fd, TIOCMGET, &status);
|
||||
if (on)
|
||||
status |= TIOCM_DTR;
|
||||
else
|
||||
status &= ~TIOCM_DTR;
|
||||
ioctl(fd, TIOCMSET, &status);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
GCodeSender::reset()
|
||||
{
|
||||
set_DTR(false);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
set_DTR(true);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
set_DTR(false);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
@@ -1,81 +0,0 @@
|
||||
#ifndef slic3r_GCodeSender_hpp_
|
||||
#define slic3r_GCodeSender_hpp_
|
||||
|
||||
#include "libslic3r.h"
|
||||
#include <queue>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <cstddef>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio/serial_port.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
namespace asio = boost::asio;
|
||||
|
||||
class GCodeSender : private boost::noncopyable {
|
||||
public:
|
||||
GCodeSender();
|
||||
~GCodeSender();
|
||||
bool connect(std::string devname, unsigned int baud_rate);
|
||||
void send(const std::vector<std::string> &lines, bool priority = false);
|
||||
void send(const std::string &s, bool priority = false);
|
||||
void disconnect();
|
||||
bool error_status() const;
|
||||
bool is_connected() const;
|
||||
bool wait_connected(unsigned int timeout = 3) const;
|
||||
size_t queue_size() const;
|
||||
void pause_queue();
|
||||
void resume_queue();
|
||||
void purge_queue(bool priority = false);
|
||||
std::vector<std::string> purge_log();
|
||||
std::string getT() const;
|
||||
std::string getB() const;
|
||||
void set_DTR(bool on);
|
||||
void reset();
|
||||
|
||||
private:
|
||||
asio::io_service io;
|
||||
asio::serial_port serial;
|
||||
boost::thread background_thread;
|
||||
boost::asio::streambuf read_buffer, write_buffer;
|
||||
bool open; // whether the serial socket is connected
|
||||
bool connected; // whether the printer is online
|
||||
bool error;
|
||||
mutable boost::mutex error_mutex;
|
||||
|
||||
// this mutex guards queue, priqueue, can_send, queue_paused, sent, last_sent
|
||||
mutable boost::mutex queue_mutex;
|
||||
std::queue<std::string> queue;
|
||||
std::list<std::string> priqueue;
|
||||
bool can_send;
|
||||
bool queue_paused;
|
||||
size_t sent;
|
||||
std::deque<std::string> last_sent;
|
||||
|
||||
// this mutex guards log, T, B
|
||||
mutable boost::mutex log_mutex;
|
||||
std::queue<std::string> log;
|
||||
std::string T, B;
|
||||
|
||||
void set_baud_rate(unsigned int baud_rate);
|
||||
void set_error_status(bool e);
|
||||
void do_send();
|
||||
void on_write(const boost::system::error_code& error, size_t bytes_transferred);
|
||||
void do_close();
|
||||
void do_read();
|
||||
void on_read(const boost::system::error_code& error, size_t bytes_transferred);
|
||||
void send();
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif /* slic3r_GCodeSender_hpp_ */
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include "MedialAxis.hpp"
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/polygon/polygon.hpp>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
namespace Slic3r::Geometry {
|
||||
|
||||
using VD = VoronoiDiagram;
|
||||
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
|
||||
using LinesIt = Lines::iterator;
|
||||
using ColoredLinesConstIt = ColoredLines::const_iterator;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
namespace Slic3r::Geometry {
|
||||
|
||||
using VD = VoronoiDiagram;
|
||||
using PolygonsSegmentIndexConstIt = std::vector<Arachne::PolygonsSegmentIndex>::const_iterator;
|
||||
using LinesIt = Lines::iterator;
|
||||
using ColoredLinesIt = ColoredLines::iterator;
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
||||
using VD = Slic3r::Geometry::VoronoiDiagram;
|
||||
|
||||
namespace Slic3r::Geometry {
|
||||
|
||||
// Represent trapezoid Voronoi cell around segment.
|
||||
@@ -19,8 +17,8 @@ template<typename PT> struct SegmentCellRange
|
||||
{
|
||||
const PT source_segment_start_point; // The start point of the source segment of this cell.
|
||||
const PT source_segment_end_point; // The end point of the source segment of this cell.
|
||||
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
|
||||
SegmentCellRange() = delete;
|
||||
explicit SegmentCellRange(const PT &source_segment_start_point, const PT &source_segment_end_point)
|
||||
@@ -34,8 +32,8 @@ template<typename PT> struct SegmentCellRange
|
||||
template<typename PT> struct PointCellRange
|
||||
{
|
||||
const PT source_point; // The source point of this cell.
|
||||
const VD::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VD::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
const VoronoiDiagram::edge_type *edge_begin = nullptr; // The edge of the Voronoi diagram where the loop around the cell starts.
|
||||
const VoronoiDiagram::edge_type *edge_end = nullptr; // The edge of the Voronoi diagram where the loop around the cell ends.
|
||||
|
||||
PointCellRange() = delete;
|
||||
explicit PointCellRange(const PT &source_point) : source_point(source_point) {}
|
||||
@@ -46,20 +44,20 @@ template<typename PT> struct PointCellRange
|
||||
class VoronoiUtils
|
||||
{
|
||||
public:
|
||||
static Vec2i64 to_point(const VD::vertex_type *vertex);
|
||||
static Vec2i64 to_point(const VoronoiDiagram::vertex_type *vertex);
|
||||
|
||||
static Vec2i64 to_point(const VD::vertex_type &vertex);
|
||||
static Vec2i64 to_point(const VoronoiDiagram::vertex_type &vertex);
|
||||
|
||||
static bool is_finite(const VD::vertex_type &vertex);
|
||||
static bool is_finite(const VoronoiDiagram::vertex_type &vertex);
|
||||
|
||||
static VD::vertex_type make_rotated_vertex(VD::vertex_type &vertex, double angle);
|
||||
static VoronoiDiagram::vertex_type make_rotated_vertex(VoronoiDiagram::vertex_type &vertex, double angle);
|
||||
|
||||
template<typename SegmentIterator>
|
||||
static typename boost::polygon::enable_if<
|
||||
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
typename std::iterator_traits<SegmentIterator>::reference>::type
|
||||
get_source_segment(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
get_source_segment(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
template<typename SegmentIterator>
|
||||
static typename boost::polygon::enable_if<
|
||||
@@ -73,7 +71,7 @@ public:
|
||||
typename boost::polygon::gtl_if<typename boost::polygon::is_segment_concept<
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
Arachne::PolygonsPointIndex>::type
|
||||
get_source_point_index(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
get_source_point_index(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
/**
|
||||
* Discretize a parabola based on (approximate) step size.
|
||||
@@ -113,7 +111,7 @@ public:
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
Geometry::SegmentCellRange<
|
||||
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
|
||||
compute_segment_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
compute_segment_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
/**
|
||||
* Compute the range of line segments that surround a cell of the skeletal
|
||||
@@ -140,19 +138,19 @@ public:
|
||||
typename boost::polygon::geometry_concept<typename std::iterator_traits<SegmentIterator>::value_type>::type>::type>::type,
|
||||
Geometry::PointCellRange<
|
||||
typename boost::polygon::segment_point_type<typename std::iterator_traits<SegmentIterator>::value_type>::type>>::type
|
||||
compute_point_cell_range(const VD::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
compute_point_cell_range(const VoronoiDiagram::cell_type &cell, SegmentIterator segment_begin, SegmentIterator segment_end);
|
||||
|
||||
template<typename T> static bool is_in_range(double value)
|
||||
{
|
||||
return double(std::numeric_limits<T>::lowest()) <= value && value <= double(std::numeric_limits<T>::max());
|
||||
}
|
||||
|
||||
template<typename T> static bool is_in_range(const VD::vertex_type &vertex)
|
||||
template<typename T> static bool is_in_range(const VoronoiDiagram::vertex_type &vertex)
|
||||
{
|
||||
return VoronoiUtils::is_finite(vertex) && is_in_range<T>(vertex.x()) && is_in_range<T>(vertex.y());
|
||||
}
|
||||
|
||||
template<typename T> static bool is_in_range(const VD::edge_type &edge)
|
||||
template<typename T> static bool is_in_range(const VoronoiDiagram::edge_type &edge)
|
||||
{
|
||||
if (edge.vertex0() == nullptr || edge.vertex1() == nullptr)
|
||||
return false;
|
||||
|
||||
@@ -230,7 +230,6 @@ std::vector<Bridge> get_grouped_bridges(
|
||||
{
|
||||
result.reserve(bridge_expansions.size());
|
||||
uint32_t group_id = 0;
|
||||
using std::move_iterator;
|
||||
for (ExPolygon& expolygon : bridge_expolygons)
|
||||
result.push_back({ std::move(expolygon), group_id ++, bridge_expansions.end() });
|
||||
}
|
||||
@@ -432,7 +431,6 @@ Surfaces expand_bridges_detect_orientations(
|
||||
const float closing_radius
|
||||
)
|
||||
{
|
||||
using namespace Slic3r::Algorithm;
|
||||
|
||||
double thickness;
|
||||
ExPolygons bridge_expolygons = fill_surfaces_extract_expolygons(surfaces, {stBottomBridge}, thickness);
|
||||
|
||||
@@ -660,7 +660,6 @@ bool empty(const CGALMesh &mesh)
|
||||
|
||||
bool repair(TriangleMesh& mesh, RepairedMeshErrors* repaired_errors, std::string* error)
|
||||
{
|
||||
using namespace CGAL;
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
|
||||
if (mesh.empty())
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "Format/AssimpImport.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "Exception.hpp"
|
||||
#include "Model.hpp"
|
||||
#include "ModelArrange.hpp"
|
||||
#include "Arrange.hpp"
|
||||
#include "Geometry.hpp"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "TriangleMesh.hpp"
|
||||
#include "CustomGCode.hpp"
|
||||
#include "calib.hpp"
|
||||
#include "enum_bitmask.hpp"
|
||||
#include "TextConfiguration.hpp"
|
||||
#include "EmbossShape.hpp"
|
||||
#include "TriangleSelector.hpp"
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace Slic3r { enum class EnforcerBlockerType : int8_t; }
|
||||
|
||||
namespace Slic3r {
|
||||
using boost::polygon::voronoi_diagram;
|
||||
using VD = Geometry::VoronoiDiagram;
|
||||
|
||||
static inline Point mk_point(const Voronoi::VD::vertex_type *point) { return {coord_t(point->x()), coord_t(point->y())}; }
|
||||
|
||||
|
||||
@@ -263,7 +263,6 @@ size_t get_shapes_count(const NSVGimage &image)
|
||||
} // namespace Slic3r
|
||||
|
||||
namespace {
|
||||
using namespace Slic3r; // Polygon + Vec2f
|
||||
|
||||
Point::coord_type to_coor(float val, double scale) { return static_cast<Point::coord_type>(std::round(val * scale)); }
|
||||
|
||||
|
||||
@@ -2175,7 +2175,6 @@ namespace client
|
||||
{
|
||||
macro_processor() : macro_processor::base_type(start)
|
||||
{
|
||||
using namespace qi::labels;
|
||||
qi::alpha_type alpha;
|
||||
qi::alnum_type alnum;
|
||||
qi::eps_type eps;
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
#include "libslic3r/GCode/Thumbnails.hpp"
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
using json = nlohmann::json;
|
||||
|
||||
using boost::property_tree::ptree;
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
// Mark string for localization and translate.
|
||||
#define L(s) Slic3r::I18N::translate(s)
|
||||
|
||||
@@ -87,6 +89,8 @@
|
||||
// This breaks compatibility with the upstream Slic3r if the --datadir is used to switch between the two versions.
|
||||
//#define SLIC3R_PROFILE_USE_PRESETS_SUBDIR
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// Project-level options imported from a loaded 3MF into project_config. s_project_options_published
|
||||
@@ -1527,7 +1531,6 @@ bool PresetBundle::apply_vendor_config(
|
||||
const std::string& preferred_printer_variant,
|
||||
const std::string& preferred_filament)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
// Get current configuration from AppConfig
|
||||
const auto old_vendors = app_config->vendors();
|
||||
|
||||
@@ -10822,6 +10822,22 @@ void normalize_filament_values_to_variants(DynamicPrintConfig &config)
|
||||
}
|
||||
}
|
||||
|
||||
void set_filament_dev_options(DynamicPrintConfig &config, const std::vector<const DynamicPrintConfig *> &filament_configs)
|
||||
{
|
||||
for (const std::string &key : filament_dev_options) {
|
||||
if (std::none_of(filament_configs.begin(), filament_configs.end(), [&key](const DynamicPrintConfig *filament) { return filament->has(key); }))
|
||||
continue;
|
||||
const ConfigOption *default_value = print_config_def.get(key)->default_value.get();
|
||||
auto *dst = static_cast<ConfigOptionVectorBase *>(config.option(key, true));
|
||||
dst->clear();
|
||||
for (const DynamicPrintConfig *filament : filament_configs) {
|
||||
const auto *src = static_cast<const ConfigOptionVectorBase *>(filament->has(key) ? filament->option(key) : default_value);
|
||||
if (!src->empty())
|
||||
dst->append(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//used for object/region config
|
||||
//use the smallest of multiple to single
|
||||
@@ -11520,12 +11536,18 @@ void DynamicPrintConfig::update_non_diff_values_to_base_config(DynamicPrintConfi
|
||||
int cur_variant_count = cur_extruder_variants.size();
|
||||
int target_variant_count = target_extruder_variants.size();
|
||||
|
||||
// A base variant this config does not list (the base gained it after the config was saved, or the
|
||||
// config lists none) takes this config's first variant of the same extruder, as a user preset's
|
||||
// values do in update_diff_values_to_child_config. Left unmatched, the base's value would silently
|
||||
// replace the user's.
|
||||
variant_index.resize(target_variant_count, -1);
|
||||
if (cur_variant_count == 0) {
|
||||
// Defensive: target_variant_count may be 0 if the preset doesn't carry extruder_variant_name.
|
||||
// In that case keep variant_index empty and let the downstream size checks produce a useful error.
|
||||
if (!variant_index.empty())
|
||||
variant_index[0] = 0;
|
||||
// This config's one value belongs to the extruder of the base's first variant.
|
||||
variant_index = map_variant_indices(target_extruder_variants, target_extruder_ids, {},
|
||||
target_extruder_ids.empty() ? std::vector<int>() : std::vector<int>{target_extruder_ids[0]});
|
||||
}
|
||||
else if ((cur_extruder_ids.size() > 0) && cur_variant_count != cur_extruder_ids.size()){
|
||||
//should not happen
|
||||
@@ -11538,18 +11560,7 @@ void DynamicPrintConfig::update_non_diff_values_to_base_config(DynamicPrintConfi
|
||||
%extruder_variant_name %target_variant_count %extruder_id_name %target_extruder_ids.size();
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < target_variant_count; i++)
|
||||
{
|
||||
for (int j = 0; j < cur_variant_count; j++)
|
||||
{
|
||||
if ((target_extruder_variants[i] == cur_extruder_variants[j])
|
||||
&&(target_extruder_ids.empty() || (target_extruder_ids[i] == cur_extruder_ids[j])))
|
||||
{
|
||||
variant_index[i] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
variant_index = map_variant_indices(target_extruder_variants, target_extruder_ids, cur_extruder_variants, cur_extruder_ids);
|
||||
}
|
||||
|
||||
for (auto& opt : keys) {
|
||||
@@ -11574,6 +11585,13 @@ void DynamicPrintConfig::update_non_diff_values_to_base_config(DynamicPrintConfi
|
||||
if (cur_variant_count > target_variant_count)
|
||||
continue;
|
||||
|
||||
// The variant lists are the base's layout itself, which every other value is
|
||||
// carried onto: a variant this config lacks keeps its own name and id.
|
||||
if (opt == extruder_id_name || opt == extruder_variant_name) {
|
||||
opt_src->set(opt_target);
|
||||
continue;
|
||||
}
|
||||
|
||||
int stride = 1;
|
||||
if (key_set2.find(opt) != key_set2.end())
|
||||
stride = 2;
|
||||
|
||||
@@ -928,6 +928,11 @@ void normalize_filament_values_to_variants(DynamicPrintConfig &config);
|
||||
|
||||
extern std::set<std::string> filament_dev_options;
|
||||
|
||||
// Orca: a filament_dev_options option holds several values per filament, and how many is up to the
|
||||
// filament preset, so one filament's values cannot be replaced in place. This rebuilds each option from
|
||||
// filament_configs, one config per filament in slot order, as the filaments' values one after another.
|
||||
void set_filament_dev_options(DynamicPrintConfig &config, const std::vector<const DynamicPrintConfig *> &filament_configs);
|
||||
|
||||
extern void update_static_print_config_from_dynamic(ConfigBase& config, const DynamicPrintConfig& dest_config, std::vector<int> variant_index, std::set<std::string>& key_set1, int stride = 1);
|
||||
extern void compute_filament_override_value(const std::string& opt_key, const ConfigOption *opt_old_machine, const ConfigOption *opt_new_machine, const ConfigOption *opt_new_filament, const DynamicPrintConfig& new_full_config,
|
||||
t_config_option_keys& diff_keys, DynamicPrintConfig& filament_overrides, std::vector<int>& f_map_indices);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class BBLProject;
|
||||
@@ -208,7 +206,7 @@ public:
|
||||
std::string task_profile_id; /* profile id*/
|
||||
std::string task_name; /* task name, generally filename as task name */
|
||||
std::string task_file; /* local full file path of 3mf or gcode */
|
||||
fs::path task_path; /* local path of 3mf or gcode */
|
||||
boost::filesystem::path task_path; /* local path of 3mf or gcode */
|
||||
std::string task_gcode_in_3mf; /* gcode in 3mf */
|
||||
std::string task_create_time; /* time created by cloud */
|
||||
std::string task_thumbnail_url; /* url of task thumbnail */
|
||||
@@ -326,7 +324,7 @@ public:
|
||||
std::string project_url_md5; /* md5 of project url file */
|
||||
std::string project_name;
|
||||
std::string project_3mf_file;
|
||||
fs::path project_path;
|
||||
boost::filesystem::path project_path;
|
||||
std::string project_content;
|
||||
std::string project_country_code;
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "TDataStd_Name.hxx"
|
||||
#include "BRepBuilderAPI_Transform.hxx"
|
||||
#include "TopExp_Explorer.hxx"
|
||||
#include "TopExp_Explorer.hxx"
|
||||
#include "BRep_Tool.hxx"
|
||||
#include "Font_BRepFont.hxx"
|
||||
#include "Font_BRepTextBuilder.hxx"
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include <initializer_list>
|
||||
#include <string_view>
|
||||
#include <regex>
|
||||
#include <string_view>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
@@ -404,7 +404,6 @@ std::string debug_out_path(const char *name, ...)
|
||||
}
|
||||
|
||||
namespace logging = boost::log;
|
||||
namespace src = boost::log::sources;
|
||||
namespace expr = boost::log::expressions;
|
||||
namespace keywords = boost::log::keywords;
|
||||
namespace attrs = boost::log::attributes;
|
||||
@@ -892,7 +891,6 @@ int copy_file_linux_read_write(int infile, int outfile, uintmax_t file_size)
|
||||
// and only features supported by Linux 3.10 (on our build server with CentOS 7) are kept, namely sendfile with ranges and statx() are not supported.
|
||||
bool copy_file_linux(const boost::filesystem::path &from, const boost::filesystem::path &to, boost::system::error_code &ec)
|
||||
{
|
||||
using namespace boost::filesystem;
|
||||
|
||||
struct fd_wrapper
|
||||
{
|
||||
|
||||
@@ -1587,7 +1587,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
|
||||
{
|
||||
std::vector<int> result_filaments;
|
||||
//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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -974,8 +974,8 @@ bool AMSMaterialsSetting::Show(bool show)
|
||||
|
||||
static void _collect_filament_info(const wxString& shown_name,
|
||||
const Preset& filament,
|
||||
unordered_map<wxString, wxString>& query_filament_vendors,
|
||||
unordered_map<wxString, wxString>& query_filament_types)
|
||||
std::unordered_map<wxString, wxString>& query_filament_vendors,
|
||||
std::unordered_map<wxString, wxString>& query_filament_types)
|
||||
{
|
||||
query_filament_vendors[shown_name] = filament.config.get_filament_vendor();
|
||||
query_filament_types[shown_name] = filament.config.get_filament_type();
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
@@ -30,7 +29,6 @@
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/wrapsizer.h>
|
||||
|
||||
#include "GUI_Utils.hpp"
|
||||
|
||||
@@ -19,20 +19,17 @@
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/tglbtn.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/artprov.h>
|
||||
|
||||
|
||||
#include <map>
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
#include <wx/dcmemory.h>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
|
||||
@@ -855,14 +856,14 @@ void AuxiliaryPanel::Split(const std::string &src, const std::string &separator,
|
||||
dest.clear();
|
||||
index = str.find_first_of(separator, start);
|
||||
do {
|
||||
if (index != string::npos) {
|
||||
if (index != std::string::npos) {
|
||||
substring = str.substr(start, index - start);
|
||||
dest.push_back(substring);
|
||||
start = index + separator.size();
|
||||
index = str.find(separator, start);
|
||||
if (start == string::npos) break;
|
||||
if (start == std::string::npos) break;
|
||||
}
|
||||
} while (index != string::npos);
|
||||
} while (index != std::string::npos);
|
||||
|
||||
// the last part
|
||||
substring = str.substr(start);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "slic3r/GUI/Widgets/Button.hpp"
|
||||
#include "slic3r/GUI/Widgets/ComboBox.hpp"
|
||||
#include <string>
|
||||
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/sizer.h>
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/panel.h>
|
||||
@@ -36,14 +35,12 @@
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/tglbtn.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/webrequest.h>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -246,7 +243,7 @@ public:
|
||||
void create_folder(wxString name = wxEmptyString);
|
||||
std::string replaceSpace(std::string s, std::string ts, std::string ns);
|
||||
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_cover();
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
class AuxiliaryModelNode;
|
||||
WX_DEFINE_ARRAY_PTR(AuxiliaryModelNode*, AuxiliaryModelNodePtrArray);
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
class AuxiliaryModelNode
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "Jobs/ProgressIndicator.hpp"
|
||||
|
||||
@@ -73,10 +72,6 @@ private:
|
||||
CancelFn m_cancel_cb;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // BBLSTATUSBAR_HPP
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
#include "Jobs/ProgressIndicator.hpp"
|
||||
|
||||
@@ -80,10 +79,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarBind;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // BBLSTATUSBAR_HPP
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <wx/hyperlink.h>
|
||||
|
||||
#include "Jobs/ProgressIndicator.hpp"
|
||||
@@ -97,10 +96,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarPrint;
|
||||
}
|
||||
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO, wxCommandEvent);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <wx/hyperlink.h>
|
||||
|
||||
#include "Jobs/ProgressIndicator.hpp"
|
||||
@@ -99,10 +98,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarSend;
|
||||
}
|
||||
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO_SEND, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_FAIL_SEND, wxCommandEvent);
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#define TOPBAR_TITLE_WIDTH 300
|
||||
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
enum CUSTOM_ID
|
||||
{
|
||||
|
||||
@@ -18,8 +18,6 @@ class wxMouseCaptureLostEvent;
|
||||
class wxMouseEvent;
|
||||
class wxWindow;
|
||||
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
class CenteredTitle : public wxControl
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -218,7 +218,7 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f
|
||||
void BackgroundSlicingProcess::process_fff()
|
||||
{
|
||||
assert(m_print == m_fff_print);
|
||||
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
PresetBundle& preset_bundle = *GUI::wxGetApp().preset_bundle;
|
||||
m_fff_print->is_BBL_printer() = preset_bundle.is_bbl_vendor();
|
||||
// BBS: add the logic to process from an existed gcode file
|
||||
if (m_print->finished()) {
|
||||
@@ -727,7 +727,7 @@ StringObjectException BackgroundSlicingProcess::validate(std::vector<StringObjec
|
||||
assert(m_print != nullptr);
|
||||
assert(m_print == m_fff_print);
|
||||
|
||||
m_fff_print->is_BBL_printer() = wxGetApp().preset_bundle->is_bbl_vendor();
|
||||
m_fff_print->is_BBL_printer() = GUI::wxGetApp().preset_bundle->is_bbl_vendor();
|
||||
return m_print->validate(warnings, collison_polygons, height_polygons);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,9 @@
|
||||
#include <wx/string.h>
|
||||
#include <wx/toplevel.h>
|
||||
#include <wx/timer.h>
|
||||
#include "Widgets/Button.hpp"
|
||||
#include "CapsuleButton.hpp"
|
||||
|
||||
namespace Slic3r::GUI { struct IntEvent; }
|
||||
using namespace Slic3r;
|
||||
using namespace Slic3r::GUI;
|
||||
|
||||
namespace Slic3r { namespace GUI {
|
||||
#define ANIMATION_REFRESH_INTERVAL 20
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <memory>
|
||||
#include "slic3r/GUI/BBLStatusBarBind.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/Jobs/Worker.hpp"
|
||||
#include <utility>
|
||||
@@ -46,7 +46,6 @@
|
||||
#include "libslic3r/Model.hpp"
|
||||
#include "libslic3r/Polygon.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "Plater.hpp"
|
||||
#include "Jobs/BoostThreadWorker.hpp"
|
||||
#include "Jobs/PlaterWorker.hpp"
|
||||
@@ -54,6 +53,8 @@
|
||||
|
||||
#include "DeviceCore/DevManager.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#endif
|
||||
|
||||
using Slic3r::GUI::format_wxstr;
|
||||
|
||||
#define BORDER_W 10
|
||||
|
||||
// ---------------------------------
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/format.hpp"
|
||||
#include "slic3r/Utils/Bonjour.hpp"
|
||||
|
||||
#include "slic3r/GUI/Widgets/DialogButtons.hpp"
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/dataview.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
@@ -24,7 +23,6 @@
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include <wx/spinctrl.h>
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/wrapsizer.h>
|
||||
|
||||
#include "GUI_Utils.hpp"
|
||||
|
||||
@@ -1307,7 +1307,7 @@ void CalibrationPresetPage::stripWhiteSpace(std::string& str)
|
||||
{
|
||||
if (str == "") { return; }
|
||||
|
||||
string::iterator cur_it;
|
||||
std::string::iterator cur_it;
|
||||
cur_it = str.begin();
|
||||
|
||||
while (cur_it != str.end()) {
|
||||
@@ -2597,7 +2597,7 @@ void CalibrationPresetPage::update_multi_extruder_filament_combobox(const std::s
|
||||
int ams_id_int = 0;
|
||||
try {
|
||||
if (!ams_id.empty())
|
||||
ams_id_int = stoi(ams_id.c_str());
|
||||
ams_id_int = std::stoi(ams_id.c_str());
|
||||
|
||||
} catch (...) {}
|
||||
|
||||
@@ -2685,7 +2685,7 @@ void CalibrationPresetPage::update_filament_combobox(std::string ams_id)
|
||||
int ams_id_int = 0;
|
||||
try {
|
||||
if (!ams_id.empty())
|
||||
ams_id_int = stoi(ams_id.c_str());
|
||||
ams_id_int = std::stoi(ams_id.c_str());
|
||||
|
||||
} catch (...) {}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// #include "libslic3r/GCodeSender.hpp"
|
||||
#include "ConfigManipulation.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
|
||||
@@ -95,7 +95,6 @@ namespace GUI {
|
||||
|
||||
|
||||
using Config::Snapshot;
|
||||
using Config::SnapshotDB;
|
||||
|
||||
|
||||
// Configuration data structures extensions needed for the wizard
|
||||
|
||||
@@ -43,8 +43,6 @@
|
||||
#include <wx/types.h>
|
||||
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
@@ -88,7 +86,7 @@ struct Bundle
|
||||
// cache or its profile JSONs, whichever is usable.
|
||||
// Returns false if not loaded. Reason for that is logged as boost::log error.
|
||||
//BBS: set BBL as default
|
||||
bool load(fs::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
|
||||
bool load(boost::filesystem::path dir, const std::string &vendor_name, bool is_in_resources, bool is_bbl_bundle = false);
|
||||
|
||||
const std::string& vendor_id() const { return vendor_profile->id; }
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "slic3r/GUI/Widgets/RadioBox.hpp"
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
#include "slic3r/GUI/Printer/PrinterFileSystem.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <cstdlib>
|
||||
#include "slic3r/GUI/GUI_Utils.hpp"
|
||||
#include "slic3r/GUI/Widgets/Label.hpp"
|
||||
@@ -91,6 +91,8 @@
|
||||
#define SELECT_ALL_OPTION_COLOUR wxColour("#009688")
|
||||
#define DEFAULT_PROMPT_TEXT_COLOUR wxColour("#ACACAC")
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
@@ -345,7 +347,7 @@ static std::string get_curr_timestmp()
|
||||
// return timestampString;
|
||||
}
|
||||
|
||||
static void get_filament_compatible_printer(Preset* preset, vector<std::string>& printers)
|
||||
static void get_filament_compatible_printer(Preset* preset, std::vector<std::string>& printers)
|
||||
{
|
||||
auto compatible_printers = dynamic_cast<ConfigOptionStrings *>(preset->config.option("compatible_printers"));
|
||||
if (compatible_printers == nullptr) return;
|
||||
@@ -1579,7 +1581,7 @@ void CreateFilamentPresetDialog::sort_printer_by_nozzle(std::vector<std::pair<st
|
||||
{
|
||||
std::unordered_map<std::string, float> nozzle_diameter = nozzle_diameter_map;
|
||||
std::sort(printer_name_to_filament_preset.begin(), printer_name_to_filament_preset.end(),
|
||||
[&nozzle_diameter](const std::pair<string, T> &a, const std::pair<string, T> &b) {
|
||||
[&nozzle_diameter](const std::pair<std::string, T> &a, const std::pair<std::string, T> &b) {
|
||||
size_t nozzle_index_a = a.first.find(" nozzle");
|
||||
size_t nozzle_index_b = b.first.find(" nozzle");
|
||||
if (nozzle_index_a == std::string::npos || nozzle_index_b == std::string::npos) return a.first < b.first;
|
||||
@@ -3141,7 +3143,7 @@ void CreatePrinterPresetDialog::set_current_visible_printer()
|
||||
|
||||
wxArrayString CreatePrinterPresetDialog::printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter)
|
||||
{
|
||||
std::vector<pair<float, std::string>> preset_sort;
|
||||
std::vector<std::pair<float, std::string>> preset_sort;
|
||||
|
||||
auto get_nozzle_size_for_printer_model = [this](const std::string & model_name) -> size_t {
|
||||
auto iter = m_printer_name_to_preset.find(model_name);
|
||||
@@ -4962,7 +4964,7 @@ wxBoxSizer *CreatePresetForPrinterDialog::create_selected_filament_preset_sizer(
|
||||
|
||||
m_selected_printer->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &e) {
|
||||
wxString printer_name = m_selected_printer->GetStringSelection();
|
||||
std::unordered_map<string, std::vector<std::shared_ptr<Preset>>>::iterator filament_iter = m_printer_compatible_filament_presets.find(into_u8(printer_name));
|
||||
std::unordered_map<std::string, std::vector<std::shared_ptr<Preset>>>::iterator filament_iter = m_printer_compatible_filament_presets.find(into_u8(printer_name));
|
||||
if (m_printer_compatible_filament_presets.end() != filament_iter) {
|
||||
filament_choice_to_filament_preset.clear();
|
||||
wxArrayString filament_choices;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
#include "DevAxis.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -22,7 +21,7 @@ public:
|
||||
bool IsArchCoreXY() const;
|
||||
|
||||
public:
|
||||
void ParseAxis(const json &print_json);
|
||||
void ParseAxis(const nlohmann::json &print_json);
|
||||
|
||||
int Ctrl_GoHome();
|
||||
int Ctrl_Axis(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); // xyz e
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "DevAxis.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#include "DevBed.h"
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
void DevBed::ParseV1_0(const json &print_json, DevBed *system)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -16,8 +15,8 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
static void ParseV1_0(const json &print_json, DevBed *system);
|
||||
static void ParseV2_0(const json &print_json, DevBed *system);
|
||||
static void ParseV1_0(const nlohmann::json &print_json, DevBed *system);
|
||||
static void ParseV2_0(const nlohmann::json &print_json, DevBed *system);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "DevFilaSystem.h"
|
||||
#include "DevConfig.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
static float string_to_float(const std::string &str_value)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
|
||||
#include "DevDefs.h"
|
||||
@@ -86,11 +85,11 @@ public:
|
||||
std::vector<FlowRatioCalibResult> GetFlowRatioResult() const {return m_flow_ratio_results; }
|
||||
|
||||
protected:
|
||||
void ExtrusionCalibSetParse(const json &jj);
|
||||
void ExtrusionCalibSelectParse(const json &jj);
|
||||
void ExtrusionCalibGetTableParse(const json &jj);
|
||||
void ExtrusionCalibGetResultParse(const json &jj);
|
||||
void FlowrateGetResultParse(const json &jj);
|
||||
void ExtrusionCalibSetParse(const nlohmann::json &jj);
|
||||
void ExtrusionCalibSelectParse(const nlohmann::json &jj);
|
||||
void ExtrusionCalibGetTableParse(const nlohmann::json &jj);
|
||||
void ExtrusionCalibGetResultParse(const nlohmann::json &jj);
|
||||
void FlowrateGetResultParse(const nlohmann::json &jj);
|
||||
|
||||
private:
|
||||
MachineObject* m_owner{nullptr};
|
||||
@@ -119,11 +118,11 @@ private:
|
||||
bool m_calib_finished{false};
|
||||
|
||||
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 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
|
||||
@@ -3,9 +3,11 @@
|
||||
#include "DevConfig.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
bool DevChamber::HasChamber() const { return m_owner->GetConfig()->HasChamber(); }
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -25,10 +24,10 @@ public: // getter
|
||||
|
||||
public:
|
||||
// setter
|
||||
void ParseChamber(const json &print_json);
|
||||
void ParseChamber(const nlohmann::json &print_json);
|
||||
|
||||
void ParseChamberV1_0(const json& print_json);
|
||||
void ParseChamberV2_0(const json& print_json);
|
||||
void ParseChamberV1_0(const nlohmann::json& print_json);
|
||||
void ParseChamberV2_0(const nlohmann::json& print_json);
|
||||
|
||||
// control
|
||||
int CtrlSetChamberTemp(int temp);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "DevChamber.h"
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include <string>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
int DevChamber::CtrlSetChamberTemp(int temp)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "DevConfig.h"
|
||||
#include "DevUtil.h"
|
||||
#include "json_diff.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <limits>
|
||||
@@ -47,11 +47,11 @@ public:
|
||||
|
||||
public:
|
||||
/*Setters*/
|
||||
void ParseConfig(const json& print_json);
|
||||
void ParseConfig(const nlohmann::json& print_json);
|
||||
|
||||
void ParseChamberConfig(const json& print_json); // chamber
|
||||
void ParsePrintOptionsConfig(const json& print_json); // print options
|
||||
void ParseCalibrationConfig(const json& print_json); //cali
|
||||
void ParseChamberConfig(const nlohmann::json& print_json); // chamber
|
||||
void ParsePrintOptionsConfig(const nlohmann::json& print_json); // print options
|
||||
void ParseCalibrationConfig(const nlohmann::json& print_json); //cali
|
||||
|
||||
private:
|
||||
[[maybe_unused]] MachineObject* m_obj;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "DevConfigUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "DevCtrl.h"
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <wx/string.h>
|
||||
@@ -15,7 +15,7 @@ class DevCtrlInfo
|
||||
{
|
||||
public:
|
||||
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:
|
||||
bool CheckCanUpdateData(const nlohmann::json& jj);
|
||||
@@ -32,7 +32,7 @@ private:
|
||||
|
||||
time_t m_request_time = 0;
|
||||
int m_request_seq = 0;
|
||||
json m_request_json = json();
|
||||
nlohmann::json m_request_json = nlohmann::json();
|
||||
|
||||
// check
|
||||
int m_request_interval_max = 3;
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <optional>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <wx/string.h>
|
||||
|
||||
#include "DevDefs.h"
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "DevFilaSystem.h" // complete type for GetFilaSystem()->GetTrayIndexMap() in GetBackupAmsSlotInGroup
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <unordered_map>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "DevExtruderSystem.h"
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
int DevExtderSystem::CtrlRetrySwitching()
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/app.h>
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
using namespace nlohmann;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <functional>
|
||||
#include <cstdint>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -13,7 +12,7 @@ namespace Slic3r {
|
||||
class MachineObject;
|
||||
|
||||
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 {
|
||||
FAN_HEAT_BREAK_0_IDX = 0,
|
||||
@@ -123,14 +122,14 @@ public:
|
||||
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
|
||||
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_new(int fan_id, int val); // New protocol
|
||||
int command_control_air_duct(int mode_id, int submode, const CommandCallBack& cb);
|
||||
|
||||
void ParseV1_0(const json &print_json);
|
||||
void ParseV2_0(const json &print_json);
|
||||
void ParseV3_0(const json &print_json);
|
||||
void ParseV1_0(const nlohmann::json &print_json);
|
||||
void ParseV2_0(const nlohmann::json &print_json);
|
||||
void ParseV3_0(const nlohmann::json &print_json);
|
||||
|
||||
public:
|
||||
bool GetSupportAirduct() { return is_support_airduct; };
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include "DevFilaAmsSetting.h"
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include <string>
|
||||
#include "slic3r/GUI/DeviceCore/DevCtrl.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
int DevAmsSystemFirmwareSwitch::CrtlSwitchFirmware(int firmware_idx)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "slic3r/GUI/DeviceCore/DevDefs.h"
|
||||
|
||||
#include "DevFilaBlackList.h"
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
static CheckResult check_filaments_in_blacklist(const CheckFilamentInfo& info);
|
||||
|
||||
public:
|
||||
static json filaments_blacklist;
|
||||
static nlohmann::json filaments_blacklist;
|
||||
};// class DevFilaBlacklist
|
||||
|
||||
}// namespace Slic3r
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <set>
|
||||
#include <utility>
|
||||
#include "DevFilaSystem.h"
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include "DevNozzleSystem.h" // DevNozzle / DevNozzleSystem for GetNozzleFlowStringByAmsId
|
||||
|
||||
@@ -161,7 +160,7 @@ DevAms::~DevAms()
|
||||
m_trays.clear();
|
||||
}
|
||||
|
||||
static unordered_map<int, wxString> s_ams_display_formats = {
|
||||
static std::unordered_map<int, wxString> s_ams_display_formats = {
|
||||
{DevAms::AMS, "AMS-%d"},
|
||||
{DevAms::AMS_LITE, "AMS Lite-%d"},
|
||||
{DevAms::N3F, "AMS 2 PRO-%d"},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "DevDefs.h"
|
||||
#include "DevFilaAmsSetting.h"
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <wx/string.h>
|
||||
#include <wx/colour.h>
|
||||
|
||||
@@ -415,9 +414,9 @@ private:
|
||||
class DevFilaSystemParser
|
||||
{
|
||||
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
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <string>
|
||||
#include "DevFilaSystem.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"// TODO: remove this include
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
#include "DevFirmware.h"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -51,10 +49,10 @@ public:
|
||||
bool isCuttingModule() const { return product_name.Contains("Cutting Module"); }
|
||||
bool isRotary() const { return product_name.Contains("Rotary"); }// Rotary Attachment
|
||||
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 isHmshub() const { return product_name.find("Filament Buffer") != string::npos; }
|
||||
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != string::npos; }
|
||||
bool isHmshub() const { return product_name.find("Filament Buffer") != std::string::npos; }
|
||||
bool isFilaTrackSwitch() const { return product_name.find("Filament Track") != std::string::npos; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
#include "DevHMS.h"
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <exception>
|
||||
#include <cassert>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <wx/string.h>
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
DevHMS(MachineObject* obj) : m_object(obj) {}
|
||||
|
||||
public:
|
||||
void ParseHMSItems(const json& hms_json);
|
||||
void ParseHMSItems(const nlohmann::json& hms_json);
|
||||
const std::vector<DevHMSItem>& GetHMSItems() const { return m_hms_list; };
|
||||
|
||||
private:
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
bool has_read() const { return m_already_read; };
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "DevLamp.h"
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "DevUtil.h"
|
||||
|
||||
// TODO: remove this include
|
||||
#include "json_diff.hpp"
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user