mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-09 16:51:12 +00:00
Merge branch 'main' into feat/printer-agent-impl
This commit is contained in:
+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>
|
||||
|
||||
@@ -370,6 +370,10 @@ void AppConfig::set_defaults()
|
||||
// restores the conventional CAD representation for users who expect it (x0kd).
|
||||
if (get("design_connector_face_glyph").empty())
|
||||
set_bool("design_connector_face_glyph", true);
|
||||
|
||||
// Design tab: draw the printer bed and its plate grid (the Feature tree's Bed row).
|
||||
if (get("design_show_bed").empty())
|
||||
set_bool("design_show_bed", true);
|
||||
#endif
|
||||
|
||||
//#ifdef SUPPORT_SHOW_HINTS
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2851,7 +2851,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>
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
|
||||
// #define DEBUG_FUZZY
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
namespace Slic3r::Feature::FuzzySkin {
|
||||
|
||||
// Produces a random value between 0 and 1. Thread-safe.
|
||||
|
||||
@@ -352,6 +352,16 @@ void FillSpiralInset::_fill_surface_single(const FillParams& params,
|
||||
assert(params.use_arachne);
|
||||
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.
|
||||
if (params.density <= 0.9999f || params.dont_adjust) {
|
||||
Polylines polylines;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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)); }
|
||||
|
||||
|
||||
@@ -61,6 +61,8 @@ public:
|
||||
bool is_smaller_width_perimeter;
|
||||
// Depth in the hierarchy. External perimeter has depth = 0. An external perimeter could be both a contour and a hole.
|
||||
unsigned short depth;
|
||||
// ORCA: an external hole perimeter touching the next outer wall all around, with nothing between them.
|
||||
bool is_thin_wall_hole = false;
|
||||
// Children contour, may be both CCW and CW oriented (outer contours or holes).
|
||||
std::vector<PerimeterGeneratorLoop> children;
|
||||
|
||||
@@ -118,7 +120,7 @@ static bool detect_steep_overhang(const PrintRegionConfig *config,
|
||||
}
|
||||
|
||||
static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perimeter_generator, const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls,
|
||||
bool &steep_overhang_contour, bool &steep_overhang_hole, bool reverse_thin_wall_hole)
|
||||
bool &steep_overhang_contour, bool &steep_overhang_hole)
|
||||
{
|
||||
// loops is an arrayref of ::Loop objects
|
||||
// turn each one into an ExtrusionLoop object
|
||||
@@ -285,24 +287,17 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime
|
||||
} else {
|
||||
const PerimeterGeneratorLoop &loop = loops[idx.first];
|
||||
assert(thin_walls.empty());
|
||||
const bool reverse_children_thin_wall_hole = loops.size() == 1 && loop.is_contour && loop.children.size() == 1 &&
|
||||
(!loop.children.front().is_contour) && loop.children.front().children.empty();
|
||||
ExtrusionEntityCollection children = traverse_loops(perimeter_generator, loop.children, thin_walls, steep_overhang_contour,
|
||||
steep_overhang_hole, reverse_children_thin_wall_hole);
|
||||
ExtrusionEntityCollection children = traverse_loops(perimeter_generator, loop.children, thin_walls, steep_overhang_contour, steep_overhang_hole);
|
||||
out.entities.reserve(out.entities.size() + children.entities.size() + 1);
|
||||
ExtrusionLoop *eloop = static_cast<ExtrusionLoop*>(coll.entities[idx.first]);
|
||||
coll.entities[idx.first] = nullptr;
|
||||
|
||||
if ((perimeter_generator.config->wall_direction == WallDirection::CounterClockwise) == (loop.is_contour || reverse_thin_wall_hole))
|
||||
// Orca: holes run against the contour, except thin wall holes, which run with it.
|
||||
if ((perimeter_generator.config->wall_direction == WallDirection::CounterClockwise) == (loop.is_contour || loop.is_thin_wall_hole))
|
||||
eloop->make_counter_clockwise();
|
||||
else
|
||||
eloop->make_clockwise();
|
||||
|
||||
// Orca: Reverse print order for thin wall holes.
|
||||
if (reverse_thin_wall_hole) {
|
||||
std::reverse(out.entities.begin(), out.entities.end());
|
||||
}
|
||||
|
||||
eloop->inset_idx = loop.depth;
|
||||
if (loop.is_contour) {
|
||||
out.append(std::move(children.entities));
|
||||
@@ -759,6 +754,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 ¢erline = 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,
|
||||
ExPolygons &non_top_polygons, ExPolygons &fill_clip) const {
|
||||
// other perimeters
|
||||
@@ -1446,6 +1494,8 @@ void PerimeterGenerator::process_classic()
|
||||
coord_t min_spacing = coord_t(perimeter_spacing * (1 - INSET_OVERLAP_TOLERANCE));
|
||||
coord_t ext_min_spacing = coord_t(ext_perimeter_spacing * (1 - INSET_OVERLAP_TOLERANCE));
|
||||
bool has_gap_fill = this->config->gap_infill_speed.get_at(get_extruder_index(*print_config, this->config->outer_wall_filament_id - 1)) > 0;
|
||||
// ORCA: Use the smaller width as the lower bound to avoid overestimating safe overlap
|
||||
const double gap_fill_min_width = 0.2 * std::min(perimeter_width, ext_perimeter_width) * (1 - INSET_OVERLAP_TOLERANCE);
|
||||
|
||||
// BBS: this flow is for smaller external perimeter for small area
|
||||
coord_t ext_min_spacing_smaller = coord_t(ext_perimeter_spacing * (1 - SMALLER_EXT_INSET_OVERLAP_TOLERANCE));
|
||||
@@ -1640,6 +1690,15 @@ void PerimeterGenerator::process_classic()
|
||||
|
||||
last = std::move(offsets);
|
||||
|
||||
// ORCA: a thin wall hole has no room for gap fill or an inner wall anywhere beside its outer wall.
|
||||
if (i == 0 && ! holes[0].empty()) {
|
||||
const float room = float(0.5 * (ext_perimeter_spacing2 + gap_fill_min_width));
|
||||
const Polygons reach = to_polygons(offset2_ex(last, -room, room + float(SCALED_EPSILON)));
|
||||
for (PerimeterGeneratorLoop &hole : holes[0])
|
||||
hole.is_thin_wall_hole = intersection_pl(Polylines{ hole.polygon.split_at_first_point() },
|
||||
ClipperUtils::clip_clipper_polygons_with_subject_bbox(reach, get_extents(hole.polygon).inflated(SCALED_EPSILON))).empty();
|
||||
}
|
||||
|
||||
//BBS: refer to superslicer
|
||||
//store surface for top infill if only_one_wall_top
|
||||
if (i == 0 && i!=loop_number && only_one_wall_top && !surface.is_bridge() && this->upper_slices != NULL) {
|
||||
@@ -1766,7 +1825,7 @@ void PerimeterGenerator::process_classic()
|
||||
steep_overhang_contour = true;
|
||||
steep_overhang_hole = true;
|
||||
}
|
||||
ExtrusionEntityCollection entities = traverse_loops(*this, contours.front(), thin_walls, steep_overhang_contour, steep_overhang_hole, false);
|
||||
ExtrusionEntityCollection entities = traverse_loops(*this, contours.front(), thin_walls, steep_overhang_contour, steep_overhang_hole);
|
||||
// All walls are counter-clockwise initially, so we don't need to reorient it if that's what we want
|
||||
if (config->overhang_reverse) {
|
||||
reorient_perimeters(entities, steep_overhang_contour, steep_overhang_hole,
|
||||
@@ -1893,8 +1952,7 @@ void PerimeterGenerator::process_classic()
|
||||
|
||||
// fill gaps
|
||||
if (! gaps.empty()) { // collapse
|
||||
// ORCA: Use the smaller width as the lower bound to avoid overestimating safe overlap
|
||||
double min = 0.2 * std::min(perimeter_width, ext_perimeter_width) * (1 - INSET_OVERLAP_TOLERANCE);
|
||||
double min = gap_fill_min_width;
|
||||
double max = 2. * perimeter_spacing;
|
||||
ExPolygons gaps_ex = diff_ex(
|
||||
//FIXME offset2 would be enough and cheaper.
|
||||
@@ -2546,44 +2604,90 @@ void PerimeterGenerator::process_arachne()
|
||||
if (inner_loop_number >= 0) {
|
||||
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();
|
||||
|
||||
// Get top ExPolygons from current infill contour.
|
||||
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, infill_contour_bbox);
|
||||
} else
|
||||
upper_slices_clipped = ClipperUtils::clip_clipper_polygons_with_subject_bbox(*upper_slices, infill_contour_bbox);
|
||||
// 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);
|
||||
|
||||
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) {
|
||||
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 ExPolygons current_slices_bridges = offset_ex(diff_ex(top_expolygons, lower_slices_clipped), bridge_offset);
|
||||
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, lower_slices_clipped), bridge_offset);
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
// 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).
|
||||
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
|
||||
// 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
|
||||
@@ -2612,11 +2716,11 @@ void PerimeterGenerator::process_arachne()
|
||||
perimeters.insert(perimeters.end(), inner_perimeters.begin(), inner_perimeters.end());
|
||||
infill_contour = union_ex(top_expolygons, inner_wall_tool_paths.getInnerContour());
|
||||
} else {
|
||||
// There is no top surface ExPolygon, so we call Arachne again with parameters
|
||||
// like when the single perimeter 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);
|
||||
perimeters = no_single_perimeter_tool_paths.getToolPaths();
|
||||
infill_contour = union_ex(no_single_perimeter_tool_paths.getInnerContour());
|
||||
// There is no top surface ExPolygon, so use the walls generated like when the single perimeter
|
||||
// feature is disabled.
|
||||
generate_full_perimeters();
|
||||
perimeters = std::move(full_perimeters);
|
||||
infill_contour = union_ex(full_inner_contour);
|
||||
}
|
||||
}
|
||||
//PS
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -310,6 +310,7 @@ GLVolume::GLVolume(float r, float g, float b, float a)
|
||||
, force_native_color(false)
|
||||
, force_neutral_color(false)
|
||||
, force_sinking_contours(false)
|
||||
, depth_bias(false)
|
||||
, picking(false)
|
||||
, tverts_range(0, size_t(-1))
|
||||
{
|
||||
@@ -1332,11 +1333,17 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type,
|
||||
shader->set_uniform("projection_matrix", projection_matrix);
|
||||
const Matrix3d view_normal_matrix = view_matrix.matrix().block(0, 0, 3, 3) * model_matrix.matrix().block(0, 0, 3, 3).inverse().transpose();
|
||||
shader->set_uniform("view_normal_matrix", view_normal_matrix);
|
||||
if (volume.first->depth_bias) {
|
||||
glsafe(::glEnable(GL_POLYGON_OFFSET_FILL));
|
||||
glsafe(::glPolygonOffset(1.0f, 1.0f));
|
||||
}
|
||||
//BBS: add outline related logic
|
||||
if (volume.first->selected && shader_can_outline && GUI::wxGetApp().show_outline())
|
||||
volume.first->render_with_outline(cnv_size);
|
||||
else
|
||||
volume.first->render();
|
||||
if (volume.first->depth_bias)
|
||||
glsafe(::glDisable(GL_POLYGON_OFFSET_FILL));
|
||||
|
||||
#if ENABLE_ENVIRONMENT_MAP
|
||||
if (use_environment_texture)
|
||||
@@ -1580,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,6 +232,10 @@ public:
|
||||
bool force_neutral_color : 1;
|
||||
// Whether or not to force rendering of sinking contours
|
||||
bool force_sinking_contours : 1;
|
||||
// Orca: draw this volume with a positive depth bias (glPolygonOffset, pushed away from the
|
||||
// camera), so on a surface it shares with another volume the other volume wins the depth
|
||||
// test instead of z-fighting it
|
||||
bool depth_bias : 1;
|
||||
// Is render for picking
|
||||
bool picking : 1;
|
||||
// slice error
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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>
|
||||
@@ -246,7 +246,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:
|
||||
|
||||
@@ -73,10 +73,6 @@ private:
|
||||
CancelFn m_cancel_cb;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBar;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // BBLSTATUSBAR_HPP
|
||||
|
||||
@@ -80,10 +80,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarBind;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // BBLSTATUSBAR_HPP
|
||||
|
||||
@@ -97,10 +97,6 @@ private:
|
||||
CancelFn m_cancel_cb_fina;
|
||||
};
|
||||
|
||||
namespace GUI {
|
||||
using Slic3r::BBLStatusBarPrint;
|
||||
}
|
||||
|
||||
wxDECLARE_EVENT(EVT_SHOW_ERROR_INFO, wxCommandEvent);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
@@ -99,10 +99,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#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>
|
||||
@@ -54,6 +54,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
|
||||
|
||||
// ---------------------------------
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "slic3r/GUI/Camera.hpp" // N: look down the sketch plane normal
|
||||
#include "slic3r/GUI/GUI_App.hpp"
|
||||
#include "slic3r/GUI/Plater.hpp"
|
||||
#include "slic3r/GUI/PartPlate.hpp" // the current plate's origin: the first view's offset
|
||||
#include "slic3r/GUI/ImGuiWrapper.hpp"
|
||||
#include "slic3r/GUI/GLToolbar.hpp"
|
||||
#include "slic3r/GUI/Event.hpp"
|
||||
@@ -58,6 +59,16 @@ extern wxPopupWindow* wxCurrentPopupWindow;
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
// The Design tab's iso view is the CAD one: a true isometric from the front-right corner, which
|
||||
// shows the navigator's Front, Right and Top faces. Camera's own "iso" looks from the front-left
|
||||
// at 45 degrees and stays Prepare's and the thumbnails'.
|
||||
static void select_iso_view(Camera& camera)
|
||||
{
|
||||
const Vec3d target = camera.get_target();
|
||||
camera.look_at(target + camera.get_distance() * Vec3d(1., -1., 1.).normalized(), target, Vec3d::UnitZ());
|
||||
camera.auto_type(Camera::EType::Perspective);
|
||||
}
|
||||
|
||||
DesignCanvas::DesignCanvas(wxWindow* parent)
|
||||
: wxPanel()
|
||||
{
|
||||
@@ -91,7 +102,7 @@ DesignCanvas::DesignCanvas(wxWindow* parent)
|
||||
m_canvas->enable_plate_chrome(false);
|
||||
m_canvas->enable_labels(false);
|
||||
m_canvas->enable_sinking_contours(false); // they would be sliced from the plater's meshes
|
||||
m_canvas->set_axes_at_bed_center(true); // triad at bed centre = modeling origin
|
||||
m_canvas->set_design_canvas(true); // home-position bed, triad and CAD grid at the modeling origin
|
||||
|
||||
m_canvas->set_design_sketch_tool(&m_sketch_tool);
|
||||
m_sketch_tool.on_commit = [this](const SketchProfile& prof, const SketchPlane& pl) {
|
||||
@@ -190,8 +201,13 @@ DesignCanvas::DesignCanvas(wxWindow* parent)
|
||||
refresh_bed();
|
||||
|
||||
// The view this canvas opens on. Built lazily, on the way into the Design tab, so this
|
||||
// is the view the user is looking at right now.
|
||||
// is the view the user is looking at right now — moved off the current plate onto the
|
||||
// Design bed, which stays at the printer bed's home whichever plate is current — turned to
|
||||
// the iso view Home returns to, keeping its target and zoom.
|
||||
m_parked_camera = wxGetApp().plater()->get_camera();
|
||||
if (PartPlate* plate = wxGetApp().plater()->get_partplate_list().get_curr_plate())
|
||||
m_parked_camera.translate_world(-plate->get_origin());
|
||||
select_iso_view(m_parked_camera);
|
||||
|
||||
// Before any of this class's own Binds below: wx calls dynamically bound handlers in
|
||||
// reverse order of binding, and GLCanvas3D swallows several events without skipping them —
|
||||
@@ -345,7 +361,7 @@ void DesignCanvas::repaint_now()
|
||||
m_canvas_widget->Update(); // service the pending paint immediately (a modal popup owns the loop)
|
||||
}
|
||||
|
||||
void DesignCanvas::reload(bool keep_view)
|
||||
void DesignCanvas::reload()
|
||||
{
|
||||
m_canvas->reset_volumes();
|
||||
|
||||
@@ -378,21 +394,19 @@ void DesignCanvas::reload(bool keep_view)
|
||||
v->set_color(c);
|
||||
}
|
||||
} else if (obj_idx == 1) {
|
||||
// The ghost is normally a faint blue overlay on the visible body. In preview-only
|
||||
// mode it IS the result (base bodies hidden), so render it opaque so it reads as a
|
||||
// finished solid rather than a see-through hint.
|
||||
// The ghost is the whole resulting model, normally drawn as a faint blue overlay on
|
||||
// the visible bodies. Every face the feature leaves alone is in both, at the same
|
||||
// depth, so the ghost is drawn with a depth bias: the bodies win on those faces instead
|
||||
// of the two copies z-fighting, and the ghost shows only where the result reaches past
|
||||
// the bodies. In preview-only mode it IS the result (base bodies hidden), so render it
|
||||
// opaque so it reads as a finished solid rather than a see-through hint.
|
||||
v->set_color(m_body_hidden ? ColorRGBA(0.40f, 0.82f, 1.0f, 1.0f) : ghost);
|
||||
v->depth_bias = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!keep_view) {
|
||||
if (m_first_frame && !m_model.objects.empty()) {
|
||||
m_canvas->select_view("iso");
|
||||
m_canvas->zoom_to_volumes();
|
||||
m_first_frame = false;
|
||||
}
|
||||
}
|
||||
|
||||
// The camera stays where the user left it, even for the first body: Home and a double-click
|
||||
// fit on demand.
|
||||
m_canvas->set_as_dirty();
|
||||
if (m_canvas_widget)
|
||||
m_canvas_widget->Refresh();
|
||||
@@ -406,18 +420,21 @@ void DesignCanvas::set_bodies(const std::vector<TriangleMesh>* body_meshes,
|
||||
if (body_meshes == nullptr || body_meshes->empty()) { clear_mesh(); return; }
|
||||
|
||||
m_body_meshes = body_meshes;
|
||||
m_sketch_tool.refresh_body_edges(); // of the bodies set_solid_pick() pointed the tool at
|
||||
m_lit_faces = m_sketch_tool.selected_faces();
|
||||
rebuild_bodies();
|
||||
reload(!m_first_frame);
|
||||
reload();
|
||||
}
|
||||
|
||||
void DesignCanvas::clear_mesh()
|
||||
{
|
||||
m_body_meshes = nullptr;
|
||||
m_volumes.clear();
|
||||
// No solid, so no edge lines, pick or hover either, as after a rebuild that leaves no body.
|
||||
m_sketch_tool.set_solid_pick(nullptr, nullptr, nullptr, nullptr);
|
||||
if (!m_model.objects.empty()) {
|
||||
m_model.delete_object((size_t)0);
|
||||
reload(true);
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -431,14 +448,14 @@ void DesignCanvas::set_preview_mesh(const TriangleMesh& mesh)
|
||||
obj->add_volume(mesh);
|
||||
obj->add_instance();
|
||||
|
||||
reload(true);
|
||||
reload();
|
||||
}
|
||||
|
||||
void DesignCanvas::clear_preview()
|
||||
{
|
||||
if (m_model.objects.size() > 1) {
|
||||
m_model.delete_object((size_t)1);
|
||||
reload(true);
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,10 +469,23 @@ void DesignCanvas::fit_view()
|
||||
}
|
||||
}
|
||||
|
||||
bool DesignCanvas::zoom_to_box(BoundingBoxf3 box)
|
||||
{
|
||||
if (m_canvas == nullptr || !box.defined)
|
||||
return false;
|
||||
DesignSketchTool::pad_box(box);
|
||||
m_canvas->zoom_to_box(box);
|
||||
request_repaint();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DesignCanvas::set_view(const std::string& view_name)
|
||||
{
|
||||
if (m_canvas) {
|
||||
m_canvas->select_view(view_name);
|
||||
if (view_name == "iso")
|
||||
select_iso_view(wxGetApp().plater()->get_camera()); // the Design camera while the tab is shown
|
||||
else
|
||||
m_canvas->select_view(view_name);
|
||||
m_canvas->zoom_to_volumes();
|
||||
m_canvas->set_as_dirty();
|
||||
if (m_canvas_widget)
|
||||
@@ -470,13 +500,6 @@ void DesignCanvas::begin_sketch(const SketchPlane& plane, DesignSketchTool::Mode
|
||||
if (m_canvas_widget) m_canvas_widget->Refresh();
|
||||
}
|
||||
|
||||
void DesignCanvas::set_sketch_plane(const SketchPlane& plane)
|
||||
{
|
||||
m_sketch_tool.set_plane(plane); // keeps the 2D entities; only the carrier plane changes
|
||||
if (m_canvas) m_canvas->set_as_dirty();
|
||||
if (m_canvas_widget) m_canvas_widget->Refresh();
|
||||
}
|
||||
|
||||
void DesignCanvas::edit_sketch(const std::vector<SketchEntity>& entities,
|
||||
const std::vector<SketchEntityConstraintDef>& constraints,
|
||||
const SketchPlane& plane)
|
||||
@@ -550,6 +573,7 @@ void DesignCanvas::refresh_bed()
|
||||
double printable_height = 100.0;
|
||||
const auto* ph_opt = config->opt<ConfigOptionFloat>("printable_height");
|
||||
if (ph_opt) printable_height = ph_opt->value;
|
||||
// No position: the Design bed stays at the printer bed's home, whichever plate is current.
|
||||
m_bed.set_shape(bed_shape_opt->values, printable_height, {}, {}, "", false); // mainline added extruder_areas/heights params
|
||||
}
|
||||
|
||||
@@ -731,8 +755,6 @@ void DesignCanvas::clear_move_gizmo()
|
||||
request_repaint();
|
||||
}
|
||||
|
||||
bool DesignCanvas::moving_body() const { return m_sketch_tool.moving_body(); }
|
||||
|
||||
void DesignCanvas::set_on_body_move_changed(std::function<void(int, const Transform3d&)> cb)
|
||||
{
|
||||
m_sketch_tool.on_body_move_changed = std::move(cb);
|
||||
@@ -1025,6 +1047,11 @@ void DesignCanvas::set_on_datum_base_picked(std::function<void(int)> cb)
|
||||
m_sketch_tool.on_datum_base_picked = std::move(cb);
|
||||
}
|
||||
|
||||
void DesignCanvas::set_selected_base(std::function<int()> cb)
|
||||
{
|
||||
m_sketch_tool.selected_base = std::move(cb);
|
||||
}
|
||||
|
||||
void DesignCanvas::set_on_sketch_exit(std::function<void()> cb)
|
||||
{
|
||||
m_sketch_tool.on_exit = std::move(cb);
|
||||
@@ -1047,15 +1074,18 @@ void DesignCanvas::set_on_context_menu(std::function<void(const wxPoint&)> cb)
|
||||
return;
|
||||
m_ctx_bound = true;
|
||||
// Bound AFTER GLCanvas3D's own handlers, so this runs first and can consume the event.
|
||||
// It only consumes when it actually opens the offer; every other right-click still falls
|
||||
// through to the polyline-chain end and the move gizmo, which were there first.
|
||||
// Right-drag pans. Without remembering where the press landed, every pan ended by popping
|
||||
// the offer over wherever the camera stopped — the menu appearing as the reward for moving
|
||||
// the view. The offer is the release of a STATIONARY right-click (kCadRightClickDriftPx).
|
||||
// It only consumes when it actually opens the offer.
|
||||
// Right-drag may pan or orbit (Preferences > Control). Without remembering where the press
|
||||
// landed, every such drag ended by popping the offer over wherever the camera stopped — the
|
||||
// menu appearing as the reward for moving the view. A right-click is the release of a
|
||||
// STATIONARY press (kCadRightClickDriftPx); only that reaches the sketch tool or the offer.
|
||||
m_canvas_widget->Bind(wxEVT_RIGHT_DOWN, [this](wxMouseEvent& e) {
|
||||
m_ctx_press = e.GetPosition();
|
||||
m_ctx_travelled = false;
|
||||
e.Skip(); // the canvas still needs the press to seed the orbit
|
||||
// Drop any press the tool still keeps (only a click's release takes it, so a pan's stays)
|
||||
// before the canvas offers it this one, which ImGui may take instead.
|
||||
m_sketch_tool.drop_right_click();
|
||||
e.Skip(); // the canvas still needs the press to seed a pan or an orbit
|
||||
});
|
||||
m_canvas_widget->Bind(wxEVT_MOTION, [this](wxMouseEvent& e) {
|
||||
if (e.RightIsDown()) {
|
||||
@@ -1066,12 +1096,13 @@ void DesignCanvas::set_on_context_menu(std::function<void(const wxPoint&)> cb)
|
||||
});
|
||||
m_canvas_widget->Bind(wxEVT_RIGHT_UP, [this](wxMouseEvent& e) {
|
||||
const wxPoint d = e.GetPosition() - m_ctx_press;
|
||||
// Always read-and-clear, even when another guard already rules the offer out, or a
|
||||
// terminator recorded under one condition would still be pending under the next.
|
||||
const bool terminated = m_sketch_tool.take_right_consumed();
|
||||
// Click, or navigation? A press that travelled orbited; one that did not, did not.
|
||||
// Click, or navigation? A press that travelled panned or orbited; one that did not, did not.
|
||||
const bool is_click = !m_ctx_travelled && std::max(std::abs(d.x), std::abs(d.y)) <= kCadRightClickDriftPx;
|
||||
if (m_on_context_menu && !terminated && !inline_busy() && is_click) {
|
||||
// Ending a chain or abandoning an anchor uses the click up.
|
||||
const bool terminated = is_click && m_canvas && m_sketch_tool.take_right_click(*m_canvas);
|
||||
if (terminated)
|
||||
m_canvas->set_as_dirty(); // drawn by the canvas's own RightUp (e.Skip below) or at idle
|
||||
else if (m_on_context_menu && !inline_busy() && is_click) {
|
||||
// The menu belongs to what you POINTED AT — and pointing happened at the PRESS, not
|
||||
// at the release, so the raycast uses the press position. Within a 3 px budget the
|
||||
// two are the same pixel in practice; using the press is what makes that a
|
||||
@@ -1167,9 +1198,6 @@ void DesignCanvas::set_readout(const std::string& text)
|
||||
if (m_canvas) m_canvas->set_as_dirty(); // drawn by the next frame (the tool feeds this from one)
|
||||
}
|
||||
|
||||
// Clear of the view cube and the two round view buttons, which own the bottom-left corner.
|
||||
static constexpr float kStatusHudLeftInset = 190.f;
|
||||
|
||||
void DesignCanvas::set_status_text(const wxString& text, const wxColour& colour)
|
||||
{
|
||||
if (text == m_status_hud_last && colour == m_status_hud_colour) return;
|
||||
@@ -1204,8 +1232,11 @@ void DesignCanvas::render_hud()
|
||||
ImGuiWrapper::pop_common_window_style();
|
||||
};
|
||||
if (!m_status_hud_last.IsEmpty()) {
|
||||
// Past the view cube and the round view buttons, which own the bottom-left corner. Asked
|
||||
// of the canvas, which lays them out: they follow the monitor's DPI on Windows, where `em`
|
||||
// does not, so a fixed inset in `em` let them cover the start of the line at 150%.
|
||||
// A sentence can be a sentence: it wraps to the room left of the readout chip.
|
||||
const float left = kStatusHudLeftInset * em;
|
||||
const float left = m_canvas->get_canvas_toolbar_right() + margin;
|
||||
const ImVec4 col = m_status_hud_colour.IsOk()
|
||||
? ImVec4(m_status_hud_colour.Red() / 255.f, m_status_hud_colour.Green() / 255.f,
|
||||
m_status_hud_colour.Blue() / 255.f, 1.f)
|
||||
@@ -1241,7 +1272,7 @@ void DesignCanvas::sync_selected_faces()
|
||||
if (m_body_meshes == nullptr || m_model.objects.empty())
|
||||
return;
|
||||
rebuild_bodies();
|
||||
reload(true);
|
||||
reload();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1293,7 +1324,7 @@ void DesignCanvas::set_operand_bodies(int target_body, int tool_body)
|
||||
if (m_hl_body_target == target_body && m_hl_body_tool == tool_body) return;
|
||||
m_hl_body_target = target_body;
|
||||
m_hl_body_tool = tool_body;
|
||||
reload(true); // recolours the body volumes
|
||||
reload(); // recolours the body volumes
|
||||
}
|
||||
|
||||
void DesignCanvas::set_highlight_sketches(std::vector<std::pair<int, ColorRGBA>> hl)
|
||||
@@ -1306,7 +1337,7 @@ void DesignCanvas::set_body_translucent(bool on)
|
||||
{
|
||||
if (m_body_translucent == on) return;
|
||||
m_body_translucent = on;
|
||||
reload(true); // re-applies object-0 alpha so the solid fades for the fillet preview
|
||||
reload(); // re-applies object-0 alpha so the solid fades for the fillet preview
|
||||
}
|
||||
|
||||
void DesignCanvas::set_xray_focus(int body)
|
||||
@@ -1314,7 +1345,7 @@ void DesignCanvas::set_xray_focus(int body)
|
||||
if (m_xray_focus == body) return;
|
||||
m_xray_focus = body;
|
||||
m_sketch_tool.set_pick_only_body(body);
|
||||
reload(true); // re-applies per-body alpha so the non-focused bodies fade
|
||||
reload(); // re-applies per-body alpha so the non-focused bodies fade
|
||||
}
|
||||
|
||||
void DesignCanvas::set_body_hidden(bool on)
|
||||
@@ -1322,7 +1353,7 @@ void DesignCanvas::set_body_hidden(bool on)
|
||||
if (m_body_hidden == on) return;
|
||||
m_body_hidden = on;
|
||||
m_sketch_tool.set_body_edges_hidden(on);
|
||||
reload(true); // hides/show base bodies + flips the ghost opaque/faint for preview-only mode
|
||||
reload(); // hides/show base bodies + flips the ghost opaque/faint for preview-only mode
|
||||
}
|
||||
|
||||
bool DesignCanvas::delete_selected_sketch_entities()
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <vector>
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/BuildVolume.hpp"
|
||||
#include "libslic3r/Color.hpp"
|
||||
#include <utility>
|
||||
#include <wx/colour.h>
|
||||
@@ -48,16 +50,26 @@ public:
|
||||
|
||||
// Multi-body display: one GLVolume per body, each coloured distinctly (per-body colour).
|
||||
// `visible` (optional, indexed by body) hides bodies whose flag is false. `body_meshes` is kept
|
||||
// by address (a stable panel member) and read again whenever the selection changes.
|
||||
// by address (a stable panel member) and read again whenever the selection changes. The
|
||||
// bodies' edge lines are refreshed with them (DesignSketchTool::refresh_body_edges).
|
||||
void set_bodies(const std::vector<TriangleMesh>* body_meshes,
|
||||
const std::vector<bool>& visible = {});
|
||||
void clear_mesh();
|
||||
void clear_mesh(); // no bodies: drops their volumes and the tool's edge lines, pick and selection
|
||||
|
||||
void set_preview_mesh(const TriangleMesh& mesh);
|
||||
void clear_preview();
|
||||
|
||||
void fit_view();
|
||||
void set_view(const std::string& view_name);
|
||||
// Frame `box` along the current view direction, as the canvas's Fit button frames a selection.
|
||||
// False, the camera left alone, when there is nothing to frame: an undefined box.
|
||||
bool zoom_to_box(BoundingBoxf3 box);
|
||||
// Boxes to hand zoom_to_box: the selection and body faces (see DesignSketchTool).
|
||||
BoundingBoxf3 selection_box() const { return m_sketch_tool.selection_box(); }
|
||||
BoundingBoxf3 faces_box(std::vector<std::pair<int, int>> faces) const
|
||||
{
|
||||
return m_sketch_tool.faces_box(std::move(faces));
|
||||
}
|
||||
|
||||
void begin_sketch(const SketchPlane& plane, DesignSketchTool::Mode mode);
|
||||
// Re-open a committed entity sketch for full in-canvas editing (load geometry +
|
||||
@@ -66,7 +78,6 @@ public:
|
||||
const std::vector<SketchEntityConstraintDef>& constraints,
|
||||
const SketchPlane& plane);
|
||||
void set_sketch_tool(DesignSketchTool::Mode mode);
|
||||
void set_sketch_plane(const SketchPlane& plane); // re-plane the live sketch when a reference plane is clicked in 3D
|
||||
void set_sketch_construction(bool c);
|
||||
// Flip the sketch selection between construction and real geometry; returns the
|
||||
// number of entities changed (0 = nothing selected, caller falls back to the mode).
|
||||
@@ -83,6 +94,8 @@ public:
|
||||
void finish_sketch();
|
||||
bool is_sketching() const;
|
||||
void refresh_bed(); // re-sync the bed to the current printer (call on tab activation)
|
||||
// Centre of the Design bed: the printer bed at its home position, whichever plate is current.
|
||||
Vec2d bed_center() const { return m_bed.build_volume().bed_center(); }
|
||||
// The Camera is Plater-owned and shared with Prepare/Preview/Assemble; GLCanvas3D has no
|
||||
// per-canvas camera, so every orbit here would otherwise overwrite what the editor tabs
|
||||
// show. Exactly one of the two views is live at a time, so entering and leaving are the
|
||||
@@ -157,7 +170,6 @@ public:
|
||||
void begin_move_body(int body, const Vec3d& pivot, const Transform3d& base_xform,
|
||||
double body_radius);
|
||||
void clear_move_gizmo();
|
||||
bool moving_body() const;
|
||||
void set_on_body_move_changed(std::function<void(int, const Transform3d&)> cb);
|
||||
// Visual Fillet/Chamfer radius gizmo: when a solid edge is picked, anchor a radius arrow on
|
||||
// it; drag/edit fire the radius callback. Returns false if no edge is currently picked.
|
||||
@@ -234,6 +246,7 @@ public:
|
||||
std::vector<std::string> labels = {}); // clickable labelled reference planes
|
||||
void clear_base_pick();
|
||||
void set_on_datum_base_picked(std::function<void(int)> cb);
|
||||
void set_selected_base(std::function<int()> cb); // the reference plane drawn selected, or -1
|
||||
void set_on_sketch_exit(std::function<void()> cb); // Esc -> exit the tool
|
||||
void set_on_sketch_exit_refused(std::function<void()> cb); // Esc declined: sketch has work
|
||||
void set_on_sketch_notice(std::function<void(const std::string&, bool)> cb); // tool refusals/side effects
|
||||
@@ -380,7 +393,7 @@ public:
|
||||
void repaint_now();
|
||||
|
||||
private:
|
||||
void reload(bool keep_view);
|
||||
void reload();
|
||||
void swap_camera(); // enter_viewport / leave_viewport, in the one direction they share
|
||||
|
||||
// Selected faces are filled by the canvas: each body's selected faces become a volume of their
|
||||
@@ -415,7 +428,6 @@ private:
|
||||
Camera m_parked_camera;
|
||||
bool m_camera_swapped{false}; // guards a leave without an enter, and the reverse
|
||||
Model m_model;
|
||||
bool m_first_frame{true};
|
||||
int m_hl_body_target{-1};
|
||||
int m_hl_body_tool{-1};
|
||||
bool m_body_translucent{false};// fillet/chamfer preview → render the body see-through
|
||||
|
||||
@@ -102,7 +102,7 @@ static const bool kOfferRowFlat[] = {
|
||||
};
|
||||
|
||||
static const OfferVerb kOfferVerbs[] = {
|
||||
{"sketch", L_CONTEXT("Sketch", "Design"), 0, "Shift+S", "key:S+S", L("Click a face or a reference plane in the viewport, then a sketch tool"), 0x00000403u, 0, 0, false, false, nullptr, "design_sketch", L("Click a face or a reference plane, then pick a drawing tool")},
|
||||
{"sketch", L_CONTEXT("Sketch", "Design"), 0, "Shift+S", "key:S+S", L("Select a flat face or a reference plane to sketch on"), 0x00000403u, 0, 0, false, false, nullptr, "design_sketch", L("Sketch on the selected flat face or plane, or click one next")},
|
||||
{"extrude", L_CONTEXT("Extrude", "Design"), 1, "Shift+E", "key:S+E", L("Create a sketch, or pick a solid face, first"), 0x00004002u, 0, 0, false, false, nullptr, "design_extrude", L("Extrude a sketch profile, or push/pull a picked face")},
|
||||
{"revolve", L_CONTEXT("Revolve", "Design"), 1, "Shift+R", "key:S+R", L("Create a sketch profile to revolve first"), 0x00004000u, 0, 0, false, false, nullptr, "design_revolve", L("Revolve a profile about an axis")},
|
||||
{"sweep", L_CONTEXT("Sweep", "Design"), 1, "Shift+W", "key:S+W", L("Create a profile sketch to sweep first"), 0x00004000u, 0, 2, false, false, nullptr, "design_sweep", L("Sweep a profile along a path")},
|
||||
@@ -117,7 +117,7 @@ static const OfferVerb kOfferVerbs[] = {
|
||||
{"surf_loft", L_CONTEXT("Surface Loft", "Design"), 1, nullptr, "fly:surface#2", L("Create at least two profile sketches to loft"), 0x00004000u, 0, 2, false, false, nullptr, "design_loft", L("Loft (skin) between 2+ profiles, open (no end caps)")},
|
||||
{"surf_fill", L_CONTEXT("Surface Fill", "Design"), 1, nullptr, "fly:surface#3", L("Create a closed sketch first"), 0x00004000u, 0, 0, false, false, nullptr, "design_surface", L("Fill a sketch boundary with a smooth face")},
|
||||
{"thicken_surf", L_CONTEXT("Thicken Surface", "Design"), 1, nullptr, "fly:surface#5", L("Thicken Surface needs a surface body — make one with a Surface tool first"), 0x00000100u, 0, 0, true, false, nullptr, "design_thicken", L("Thicken a sheet body into a solid")},
|
||||
{"hole", L_CONTEXT("Hole", "Design"), 2, "Shift+H", "key:S+H", L("Pick a face or a plane to drill into"), 0x00000402u, 1, 0, false, false, nullptr, "design_hole", L("Drill a hole, centerd on a picked face or placed on a plane")},
|
||||
{"hole", L_CONTEXT("Hole", "Design"), 2, "Shift+H", "key:S+H", L("Pick a face or a plane to drill into"), 0x00000402u, 1, 0, false, false, nullptr, "design_hole", L("Drill a hole, centered on a picked face or placed on a plane")},
|
||||
{"thread", L_CONTEXT("Thread", "Design"), 2, "Shift+T", "key:S+T", L("Pick a cylindrical surface (bore / outer) or a circular edge for a thread"), 0x00000024u, 1, 0, false, false, nullptr, "design_thread", L("Thread a cylindrical surface (inner bore / outer) or a circular edge")},
|
||||
{"shell", L_CONTEXT("Shell", "Design"), 2, "Shift+K", "key:S+K", L("Shell needs a solid body — add or import one first"), 0x00000082u, 1, 0, false, false, nullptr, "design_shell", L("Hollow the body to a wall thickness, opening a picked face")},
|
||||
{"cut", L_CONTEXT("Cut", "Design"), 2, "Shift+X", "key:S+X", L("Cut needs a solid body — add or import one first"), 0x000004feu, 1, 0, false, false, nullptr, "design_cut", L("Trim the body with a plane — drag the offset arrow; keep one half or both")},
|
||||
@@ -145,6 +145,7 @@ static const OfferVerb kOfferVerbs[] = {
|
||||
{"rename", L_CONTEXT("Rename…", "Design"), 8, "F2", "btn:rename", L("Select a feature, or a body, to rename it"), 0x00004080u, 0, 0, false, false, nullptr, nullptr, L("Give this feature a name you will recognise in the tree (a body takes its name from the feature that makes it)")},
|
||||
{"delete_face", L_CONTEXT("Delete Face", "Design"), 7, nullptr, "fly:dressup#3", L("Delete Face needs a body — add or import one first"), 0x0000000eu, 1, 0, false, false, nullptr, "design_delete", L("Remove faces from a body and heal the solid")},
|
||||
{"colour", L_CONTEXT("Color", "Design"), 8, nullptr, "btn:colour", nullptr, 0x000001feu, 1, 0, false, false, nullptr, "color_palette", L("Set the selected body's display color")},
|
||||
{"zoom_to", L_CONTEXT("Zoom to selection", "Design"), 8, nullptr, "btn:zoom_to", nullptr, 0x000041feu, 0, 0, false, false, nullptr, "design_zoom", L("Frame the selection in the view, keeping the view direction")},
|
||||
{"delete", L_CONTEXT("Delete", "Design"), 7, "Del", "btn:delete", nullptr, 0x000f7c00u, 0, 0, false, false, nullptr, "design_delete", L("Delete what is selected")},
|
||||
{"delete_body", L_CONTEXT("Delete Body", "Design"), 7, nullptr, "btn:delete_body", nullptr, 0x000001feu, 1, 0, false, false, nullptr, "design_delete", L("Delete this whole body — removes the feature it was made from")},
|
||||
{"sk_line_t", L_CONTEXT("Line", "Design"), 0, "L", "key:L", nullptr, 0x000f8000u, 0, 0, false, true, L("Line"), "design_line", L("Line — click start, then end")},
|
||||
@@ -204,7 +205,7 @@ static const OfferVerb kOfferVerbs[] = {
|
||||
{"sk_radius", L_CONTEXT("Radius / diameter…", "Design"), 7, "V", "key:V", nullptr, 0x00020000u, 0, 0, false, true, nullptr, "design_dimension", L("Type the radius of this arc, or the diameter of this circle")},
|
||||
{"sk_angdist", L_CONTEXT("Angle / distance…", "Design"), 7, "V", "key:V", nullptr, 0x00080000u, 0, 0, false, true, nullptr, "design_dimension", L("Type the angle between two lines, or the distance between the two picks")},
|
||||
};
|
||||
static const int kOfferVerbCount = 92;
|
||||
static const int kOfferVerbCount = 93;
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
|
||||
+523
-230
File diff suppressed because it is too large
Load Diff
@@ -383,7 +383,16 @@ private:
|
||||
void update_rib_gizmo(); // in-plane slab footprint + thickness handles (Rib card)
|
||||
void refresh_datum_planes(); // push resolved datum frames + per-plane u/v extents to viewport
|
||||
void refresh_mate_connectors(); // push connector frames so verse + polarity are visible
|
||||
void update_reference_planes(); // persistent XY/XZ/YZ reference planes (fallback when no object)
|
||||
void update_reference_planes(); // the XY/XZ/YZ planes + axes: Origin row, plane choice, Plane tool
|
||||
void toggle_origin(); // the Origin row's eye (and Ctrl+Shift+O): keep the reference planes up
|
||||
void toggle_bed(); // the Bed row's eye (and Ctrl+Shift+B): draw the printer bed, or not
|
||||
void refresh_pinned(); // rebuild the Origin and Bed rows (their eyes and label colours)
|
||||
// Sketch: open a session on the picked face or plane, or with none picked, put the planes up
|
||||
// and wait for one (m_choosing_sketch_plane).
|
||||
void start_sketch();
|
||||
void start_sketch_on_target(bool offer_tools); // a session on sketch_plane_from_selection()
|
||||
void end_sketch_plane_choice(); // leave the plane choice without a sketch; no-op outside it
|
||||
bool sketch_plane_pick_live() const; // may a pick made now still open the sketch?
|
||||
|
||||
CadDocument m_doc;
|
||||
|
||||
@@ -413,7 +422,6 @@ private:
|
||||
ScalableButton* m_commit_btn{nullptr}; // main face: runs the current commit mode
|
||||
DropDown* m_commit_drop{nullptr}; // commit-mode choices, owned via m_flyout_keepalive
|
||||
wxSizer* m_tb_doc{nullptr}; // toolbar document/view actions (new, commit, export, section, place)
|
||||
CheckBox* m_show_bed{nullptr}; // view option: draw the printer bed + plate grid, or not
|
||||
wxSizer* m_box_move{nullptr}; // Move/Rotate numeric options (distance, axis, angle)
|
||||
wxSizer* m_box_sketch{nullptr};
|
||||
wxSizer* m_box_extrude{nullptr};
|
||||
@@ -571,8 +579,20 @@ private:
|
||||
// deliberately no dropdown for it. e1p.
|
||||
int m_ref_plane{0};
|
||||
// m_ref_plane is always a VALID plane, so it cannot itself distinguish "the user chose XY"
|
||||
// from "nobody has chosen anything yet". This does.
|
||||
// from "nobody has chosen anything yet". This does. A selection like a picked face: the sketch
|
||||
// opened on it uses it up, and Esc or a click on nothing lets go of it.
|
||||
bool m_plane_picked{false};
|
||||
// Sketch was pressed with nothing to sketch on: the reference planes are up and the next
|
||||
// reference plane or flat face clicked opens the sketch on it. Still Feature mode — sketch
|
||||
// mode is entered only with the session (start_sketch_on_target).
|
||||
bool m_choosing_sketch_plane{false};
|
||||
// The Feature tree's Origin row: keeps the reference planes and their axes up
|
||||
// (update_reference_planes). A view preference (AppConfig "design_show_origin"), not part of
|
||||
// the recipe.
|
||||
bool m_show_origin{false};
|
||||
// The Feature tree's Bed row: draws the printer bed and its plate grid. A view preference
|
||||
// (AppConfig "design_show_bed"), not part of the recipe.
|
||||
bool m_show_bed{true};
|
||||
ComboBox* m_shape{nullptr};
|
||||
ComboBox* m_mode{nullptr};
|
||||
wxSpinCtrlDouble* m_width{nullptr};
|
||||
@@ -913,12 +933,16 @@ private:
|
||||
std::function<void(double)> m_value_cont; // deferred apply, run on Confirm
|
||||
std::function<void()> m_value_cancel; // optional action when the card is cancelled
|
||||
|
||||
// Feature tree: one row per feature, in feature order, with a per-type icon and the row's
|
||||
// own Edit / Show-hide / Delete icons. Callers use row indices via
|
||||
// tree_selection()/set_tree_selection(); refresh_tree() rebuilds the rows.
|
||||
// Feature tree: the Origin and Bed rows, a fixed block of view switches that never scrolls
|
||||
// and selects nothing, then, in a frame of its own below them, one row per feature, in feature
|
||||
// order, with a per-type icon and the row's own Zoom to selection / Edit / Show-hide / Delete
|
||||
// icons. Callers use row indices via tree_selection()/set_tree_selection(); refresh_tree()
|
||||
// rebuilds the rows.
|
||||
DesignRowList* m_pinned{nullptr};
|
||||
DesignRowList* m_tree{nullptr};
|
||||
// The faces the selected feature row made (CadDocument::faces_made_by), drawn as selected.
|
||||
// Finding them replays the history, so they are kept per row and topology generation.
|
||||
// The faces the selected feature row made (CadDocument::faces_made_by), drawn as selected, and
|
||||
// what Zoom to selection frames for a row. Finding them replays the history, so they are kept
|
||||
// per row and topology generation (feature_faces).
|
||||
// request_feature_highlight() refreshes them after the current event; every change of row,
|
||||
// card or topology calls it.
|
||||
int m_hl_feature{-1}; // the row m_hl_faces were found for...
|
||||
@@ -927,7 +951,10 @@ private:
|
||||
bool m_hl_pending{false};
|
||||
void request_feature_highlight();
|
||||
void update_feature_highlight();
|
||||
// The faces feature `f` made, found again when the cached ones are another row's or topology's.
|
||||
const std::vector<std::pair<int, int>>& feature_faces(int f);
|
||||
bool deselect_rows(); // Esc / a click on nothing: drop the tree and Bodies rows
|
||||
bool drop_plane_pick(); // ...and a picked reference plane; true if one was picked
|
||||
// Bodies list under the feature tree: one row per body (parallel to m_doc.bodies). Selecting
|
||||
// one highlights that body and makes it the target for the next op.
|
||||
DesignRowList* m_parts{nullptr};
|
||||
@@ -964,8 +991,17 @@ private:
|
||||
void rebuild_disp_meshes(); // recompute m_disp_* from m_doc + m_body_xform
|
||||
void feed_bodies(); // push m_disp_* + visibility/xform to the viewport
|
||||
void on_move_body(); // start the move gizmo on the selected body
|
||||
bool body_move_pending() const { return m_move_body >= 0; } // the Move button's session is open
|
||||
void end_body_move(bool keep); // leave it: keep the dragged pose, or put the body back
|
||||
void arm_transform_gizmo(); // arm the move gizmo on the Transform card's body (add mode only)
|
||||
void on_set_body_color(); // Color tool: pick a per-body display colour override
|
||||
// Zoom to selection: frame one thing along the current view, as the canvas's Fit button frames
|
||||
// a selection. A body is framed whole, hidden or not; a feature by its sketch or the faces it
|
||||
// made; anything else the offer is opened on, by what the Fit button frames for it.
|
||||
void zoom_to_body(int b);
|
||||
void zoom_to_feature(int f);
|
||||
void zoom_to_selection();
|
||||
bool can_zoom_to_feature(int f) const; // a sketch, or a shown feature that makes faces
|
||||
void on_boolean_tool(); // Boolean (combine bodies): needs two solids, then opens the tool
|
||||
int tree_selection() const; // selected feature row, or wxNOT_FOUND
|
||||
int tree_body_selection() const; // selected Parts-list body index, or -1
|
||||
|
||||
@@ -29,11 +29,19 @@ static constexpr int kCellDip = 20; // square action cell, hover chip included
|
||||
static constexpr int kPadDip = 4; // row edges, and the gap before the action cells
|
||||
static constexpr int kGapDip = 6; // type icon to label
|
||||
|
||||
DesignRowList::DesignRowList(wxWindow* parent, int max_visible)
|
||||
// wxVListBox defaults to wxBORDER_THEME; the sidebar's lists take a simple frame.
|
||||
: wxVListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE)
|
||||
DesignRowList::DesignRowList(wxWindow* parent, int max_visible, bool selectable, long style)
|
||||
// wxVListBox defaults to wxBORDER_THEME; `style` defaults to the simple frame the sidebar's
|
||||
// lists take, and a list meant to sit unframed on its card passes wxBORDER_NONE.
|
||||
: wxVListBox(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, style)
|
||||
, m_max_visible(std::max(max_visible, 1))
|
||||
, m_selectable(selectable)
|
||||
{
|
||||
// A non-selectable list takes no focus: from the mouse because it consumes the presses that
|
||||
// would focus it, below, and from the keyboard through AcceptsFocus(). wxGTK reads that once,
|
||||
// while the base class is being built, before the override exists, so it is told here.
|
||||
if (!m_selectable)
|
||||
SetCanFocus(false);
|
||||
|
||||
Bind(wxEVT_LISTBOX, [this](wxCommandEvent&) { if (on_select) on_select(); });
|
||||
Bind(wxEVT_LISTBOX_DCLICK, [this](wxCommandEvent&) { if (on_activate) on_activate(); });
|
||||
|
||||
@@ -46,18 +54,20 @@ DesignRowList::DesignRowList(wxWindow* parent, int max_visible)
|
||||
m_pressed = Hit{};
|
||||
e.Skip();
|
||||
});
|
||||
// A press on an action cell is remembered and skipped, so the list still selects the row.
|
||||
// A press on an action cell is remembered and skipped, so the list still selects the row. A
|
||||
// non-selectable list keeps every press from wxVListBox, which would select the row and take
|
||||
// the focus.
|
||||
Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent& e) {
|
||||
const Hit h = hit_test(e.GetPosition());
|
||||
m_pressed = h.cell >= 0 ? h : Hit{};
|
||||
e.Skip();
|
||||
if (m_selectable) e.Skip();
|
||||
});
|
||||
// The second press of a double-click on a cell is a press too, and is not skipped: the list
|
||||
// would otherwise turn it into a row double-click, so a quick double toggle of the eye would
|
||||
// also open the feature for editing.
|
||||
Bind(wxEVT_LEFT_DCLICK, [this](wxMouseEvent& e) {
|
||||
const Hit h = hit_test(e.GetPosition());
|
||||
if (h.cell < 0) { m_pressed = Hit{}; e.Skip(); return; }
|
||||
if (h.cell < 0) { m_pressed = Hit{}; if (m_selectable) e.Skip(); return; }
|
||||
m_pressed = h;
|
||||
});
|
||||
Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) {
|
||||
@@ -69,9 +79,9 @@ DesignRowList::DesignRowList(wxWindow* parent, int max_visible)
|
||||
const int id = m_rows[pressed.row].actions[pressed.cell].id;
|
||||
// After the click has finished dispatching: the action may rebuild these rows. The row
|
||||
// must still exist and still be the selected one, or the click is dropped rather than
|
||||
// applied to whatever row took its place.
|
||||
// applied to whatever row took its place. A non-selectable list has no selected row.
|
||||
CallAfter([this, row = pressed.row, id] {
|
||||
if (row < int(GetItemCount()) && row == GetSelection() && on_action)
|
||||
if (row < int(GetItemCount()) && (!m_selectable || row == GetSelection()) && on_action)
|
||||
on_action(row, id);
|
||||
});
|
||||
});
|
||||
@@ -79,7 +89,7 @@ DesignRowList::DesignRowList(wxWindow* parent, int max_visible)
|
||||
// press suppresses the wxEVT_CONTEXT_MENU that follows it.
|
||||
Bind(wxEVT_RIGHT_DOWN, [this](wxMouseEvent& e) {
|
||||
const Hit h = hit_test(e.GetPosition());
|
||||
if (h.row != wxNOT_FOUND) select(h.row);
|
||||
if (m_selectable && h.row != wxNOT_FOUND) select(h.row);
|
||||
e.Skip();
|
||||
});
|
||||
Bind(wxEVT_CONTEXT_MENU, [this](wxContextMenuEvent& e) {
|
||||
@@ -95,7 +105,7 @@ DesignRowList::DesignRowList(wxWindow* parent, int max_visible)
|
||||
return;
|
||||
// On MSW the menu comes with the button's release, and the pointer may have moved to
|
||||
// another row since the press selected one: the menu is for the row it opens over.
|
||||
select(row);
|
||||
if (m_selectable) select(row);
|
||||
if (on_menu) on_menu(row, screen);
|
||||
});
|
||||
// wxVListBox takes every wheel event, even with nothing to scroll, so a short list would stop
|
||||
@@ -254,7 +264,7 @@ void DesignRowList::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) con
|
||||
wxColour bg;
|
||||
if (IsSelected(n))
|
||||
bg = StateColor::darkModeColorFor(wxColour("#BFE1DE"));
|
||||
else if (int(n) == m_hover.row)
|
||||
else if (m_selectable && int(n) == m_hover.row) // a non-selectable row lights only its icons
|
||||
bg = StateColor::darkModeColorFor(wxColour("#E5F0EE"));
|
||||
if (!bg.IsOk())
|
||||
return; // the list already cleared to its background colour
|
||||
@@ -314,7 +324,7 @@ DesignRowList::Hit DesignRowList::hit_test(const wxPoint& pt) const
|
||||
const wxRect rect = GetItemRect(h.row);
|
||||
const auto& acts = m_rows[h.row].actions;
|
||||
for (size_t i = 0; i < acts.size(); ++i)
|
||||
if (cell_rect(rect, acts.size(), i).Contains(pt)) {
|
||||
if (!acts[i].icon.empty() && cell_rect(rect, acts.size(), i).Contains(pt)) {
|
||||
h.cell = int(i);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -29,12 +29,16 @@ namespace Slic3r { namespace GUI {
|
||||
// Selection follows wxTreeCtrl's contract, which DesignPanel's mutual exclusion between the two
|
||||
// lists relies on: on_select runs on every change, whether the user or select() made it, and
|
||||
// selecting the row that is already selected changes nothing and notifies nobody.
|
||||
//
|
||||
// A list built non-selectable is a row of switches, not of objects: a click never selects a row,
|
||||
// the pointer highlights only the action icon under it, and the list never takes the focus. Its
|
||||
// action icons and its context menu are the only things that answer.
|
||||
class DesignRowList : public wxVListBox
|
||||
{
|
||||
public:
|
||||
struct Action {
|
||||
int id; // the owner's code for it, handed back to on_action
|
||||
std::string icon; // icon name, e.g. "design_eye"
|
||||
std::string icon; // icon name, e.g. "design_eye"; empty for a blank cell that only holds a column
|
||||
wxString tip;
|
||||
};
|
||||
struct Row {
|
||||
@@ -50,7 +54,8 @@ public:
|
||||
static constexpr const char* hover_chip = "#D4D4D4";
|
||||
|
||||
// The list is as tall as its rows, at least one and at most `max_visible`; past that it scrolls.
|
||||
DesignRowList(wxWindow* parent, int max_visible);
|
||||
// `style` is its frame: wxBORDER_NONE for a list that sits unframed on its card.
|
||||
DesignRowList(wxWindow* parent, int max_visible, bool selectable = true, long style = wxBORDER_SIMPLE);
|
||||
|
||||
// Replace every row. Clears the selection without notifying and cancels a rename in progress;
|
||||
// the owner re-selects the row it keeps, which notifies.
|
||||
@@ -67,15 +72,20 @@ public:
|
||||
|
||||
std::function<void()> on_select; // the selection changed
|
||||
std::function<void()> on_activate; // the selected row was double-clicked
|
||||
// A row's action icon was clicked. Runs after the click has finished dispatching, and only
|
||||
// while that row is still the selected one; the click itself selected it.
|
||||
// A row's action icon was clicked. Runs after the click has finished dispatching, while the
|
||||
// row still exists and — in a selectable list, where the click itself selected it — is still
|
||||
// the selected one.
|
||||
std::function<void(int row, int id)> on_action;
|
||||
// Context menu on a row, at a screen position; the row under the pointer is selected first.
|
||||
// Context menu on a row, at a screen position; the row under the pointer is selected first,
|
||||
// unless the list is non-selectable. Pop the menu from inside the call: wxGTK sends it on the
|
||||
// right press, and a menu deferred past that event closes on the button's release.
|
||||
std::function<void(int row, const wxPoint& screen)> on_menu;
|
||||
// The editor committed `name` for `row`, trimmed and never empty (an empty commit cancels).
|
||||
// Runs after the editor's own events have finished, so the owner may rebuild the rows here.
|
||||
std::function<void(int row, const wxString& name)> on_rename;
|
||||
|
||||
bool AcceptsFocus() const override { return m_selectable && wxVListBox::AcceptsFocus(); }
|
||||
|
||||
protected:
|
||||
void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const override;
|
||||
void OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const override;
|
||||
@@ -103,6 +113,7 @@ private:
|
||||
std::vector<Row> m_rows;
|
||||
std::map<std::string, ScalableBitmap> m_icons;
|
||||
int m_max_visible;
|
||||
bool m_selectable;
|
||||
int m_row_h{0}; // every row's height, from measure_row()
|
||||
Hit m_hover;
|
||||
Hit m_pressed; // action cell under the last left press
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,26 +2,32 @@
|
||||
#define slic3r_DesignSketchTool_hpp_
|
||||
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/Line.hpp"
|
||||
#include "libslic3r/CAD/SketchEngine.hpp"
|
||||
#include "libslic3r/CAD/CadDocument.hpp" // CadBody for per-body solid picking
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include "libslic3r/CAD/SketchInference.hpp"
|
||||
#include "slic3r/GUI/GLModel.hpp"
|
||||
#include "slic3r/GUI/GLSelectionRectangle.hpp" // left-drag rubber band over the committed bodies
|
||||
#include <Eigen/Core>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <wx/event.h>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include "libslic3r/Color.hpp"
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class wxMouseEvent;
|
||||
class wxPoint;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class TriangleMesh; // fwd (libslic3r) — solid-pick mesh, non-owning pointer
|
||||
class GLVolumeCollection;
|
||||
|
||||
namespace GUI {
|
||||
|
||||
@@ -50,6 +56,36 @@ inline ColorRGBA design_idle_face_color()
|
||||
{
|
||||
return ColorRGBA(0.72f, 0.76f, 0.80f, 0.14f);
|
||||
}
|
||||
|
||||
// A convex piece of the square drawn on planes[plane].
|
||||
struct PlanePiece
|
||||
{
|
||||
int plane;
|
||||
std::vector<Vec3d> corners;
|
||||
};
|
||||
// The squares of half-extent `half` centred on `planes`' origins, cut where they cross one another
|
||||
// and ordered back to front for an eye at `eye` (perspective) or looking along `forward`
|
||||
// (orthographic). Translucent planes that cross cannot be drawn in any per-plane order: each is
|
||||
// partly in front of and partly behind the others. Drawn piece by piece in this order, each one
|
||||
// tints only what is behind it.
|
||||
std::vector<PlanePiece> planes_back_to_front(const std::vector<SketchPlane>& planes, double half,
|
||||
const Vec3d& eye, const Vec3d& forward, bool perspective);
|
||||
|
||||
// The square a reference plane is drawn as, given as the frame at its centre, half-extent `half`.
|
||||
// The base planes XY, XZ and YZ (`base` 0, 1, 2) sit in the octant (+X, -Y, +Z), the one all three
|
||||
// names face, reference_square_gap(half) clear of the two axes bounding each, so the three never cross
|
||||
// and the axes run between them. Any other base (a datum) stays centred on its own origin. The frame is the same
|
||||
// plane moved within itself, so planes_back_to_front and pick_reference_square take it unchanged.
|
||||
SketchPlane reference_square(const SketchPlane& plane, int base, double half);
|
||||
inline double reference_square_gap(double half) { return 0.25 * half; }
|
||||
// The corners of the box around a base square's label, in the square: inset from its (+x, +y) corner and
|
||||
// written along the square's x axis with its y axis up, so it turns with the plane. The box the hit
|
||||
// test takes for the label: round the strokes render_base_pick draws, from the same layout, with a
|
||||
// margin to aim at.
|
||||
std::array<Vec3d, 4> reference_label_box(const SketchPlane& square, double half, const std::string& text);
|
||||
// The nearest of `squares` (half-extent `half`) the ray from `from` along `dir` crosses, or -1.
|
||||
int pick_reference_square(const std::vector<SketchPlane>& squares, double half, const Vec3d& from, const Vec3d& dir);
|
||||
|
||||
class DesignSketchTool {
|
||||
public:
|
||||
enum class Mode { Select, Dimension, Polyline, Line, CornerRect, CenterRect, ObliqueRect,
|
||||
@@ -137,7 +173,6 @@ public:
|
||||
// Returns false when no session is live, so the caller can fall back to a new feature.
|
||||
bool add_imported_regions(const std::vector<std::vector<std::vector<Vec2d>>>& regions);
|
||||
void set_tool(Mode mode); // switch tool, keep accumulated entities
|
||||
void set_plane(const SketchPlane& plane) { m_plane = plane; } // re-plane a live sketch (a reference plane was clicked mid-session); entities are 2D, re-lifted through the new plane
|
||||
void set_construction(bool c) { m_construction = c; }
|
||||
void set_polygon_sides(int n) { m_polygon_sides = (n < 3 ? 3 : n); }
|
||||
void set_polygon_circumscribed(bool c) { m_polygon_circumscribed = c; }
|
||||
@@ -149,10 +184,10 @@ public:
|
||||
// Right-click on a draw tool: true when an in-progress anchor was abandoned, false when
|
||||
// there was nothing to abandon — and false is what lets the offer menu open. ghcz.
|
||||
bool right_abandon();
|
||||
// True if the LAST right-press was consumed as a gesture terminator (end a polyline chain,
|
||||
// abandon an anchor, exit a tool). Read-and-clear: the canvas asks on the matching release to
|
||||
// decide whether that right-click was the user's, in which case it opens the offer.
|
||||
bool take_right_consumed() { const bool b = m_right_consumed; m_right_consumed = false; return b; }
|
||||
// Replays and clears the right press on_mouse kept for the camera: true if the tool used it as
|
||||
// a gesture terminator (end a polyline chain, abandon an anchor), so no offer opens.
|
||||
bool take_right_click(GLCanvas3D& canvas);
|
||||
void drop_right_click() { m_right_press.reset(); }
|
||||
void render(GLCanvas3D& canvas);
|
||||
// The in-canvas value field, drawn by render() before any early return. Owned by
|
||||
// DesignCanvas; null until it sets it. Not a window — see SketchInlineEditor.hpp.
|
||||
@@ -207,6 +242,9 @@ public:
|
||||
// their edges do not float over the preview.
|
||||
void set_body_edges_hidden(bool h) { m_body_edges_hidden = h; }
|
||||
void clear_solid_selection();
|
||||
// Resample the edges of each body whose shape changed and drop those of bodies that are gone.
|
||||
// Also expires a pick or hover on a rebuilt body. The canvas calls it whenever it gets the bodies.
|
||||
void refresh_body_edges();
|
||||
bool has_solid_selection() const { return m_solid_sel != SolidSel::None; }
|
||||
// Every picked edge when the selection is an edge set (Shift/Ctrl+click adds and removes
|
||||
// edges of the same body): the earlier picks first, the last-clicked edge at the end.
|
||||
@@ -221,6 +259,20 @@ public:
|
||||
void set_highlight_faces(const std::vector<std::pair<int, int>>& faces);
|
||||
// Every face drawn as selected, sorted: the committed pick's and the still-valid ones above.
|
||||
std::vector<std::pair<int, int>> selected_faces() const;
|
||||
// What the canvas's Fit button frames: the selection — faces (the Feature tree's included), a
|
||||
// body, edges, a vertex, a sketch region, the live sketch's picked entities — else everything
|
||||
// on show: the visible bodies, the preview of the feature being edited and every sketch.
|
||||
// Undefined when the tab shows none of it. `volumes` are the canvas's: bodies and preview.
|
||||
BoundingBoxf3 fit_box(const GLVolumeCollection& volumes) const;
|
||||
// The selection fit_box frames, with no fallback: undefined when nothing is selected.
|
||||
BoundingBoxf3 selection_box() const;
|
||||
// World box of (body, face id) faces on the pick mesh, hidden bodies included.
|
||||
BoundingBoxf3 faces_box(std::vector<std::pair<int, int>> faces) const;
|
||||
// World box of sketch entities drawn on `plane`.
|
||||
static BoundingBoxf3 sketch_box(const std::vector<SketchEntity>& entities, const SketchPlane& plane);
|
||||
// Grow a box the camera is to frame to at least a small extent on every axis: a vertex has no
|
||||
// size, nor has a sketch along its normal.
|
||||
static void pad_box(BoundingBoxf3& box);
|
||||
|
||||
// Move-body gizmo (M5): translate a whole body with three world-axis drag arrows
|
||||
// (X red / Y green / Z blue) anchored at the body centroid. Display-only — the host
|
||||
@@ -230,8 +282,10 @@ public:
|
||||
void set_move_gizmo(int body, const Vec3d& pivot, const Transform3d& base_xform,
|
||||
double body_radius = 0.0);
|
||||
void clear_move_gizmo();
|
||||
bool moving_body() const { return m_mv_active; }
|
||||
int move_body_index() const { return m_mv_body; }
|
||||
// Press, then drag, translate arrow `axis` (0..2 = X/Y/Z) with the mouse ray under the cursor.
|
||||
void grab_move_arrow(int axis, const Linef3& ray);
|
||||
void drag_move_arrow(const Linef3& ray);
|
||||
std::function<void(int body, const Transform3d& xform)> on_body_move_changed;
|
||||
// Fired on each cycle change: (level 0=None/1=Whole/2=Face/3=Edge, body index, face id, edge id).
|
||||
std::function<void(int level, int body, int face, int edge)> on_solid_selection_changed;
|
||||
@@ -316,6 +370,12 @@ public:
|
||||
std::vector<std::string> labels = {});
|
||||
void clear_base_pick();
|
||||
std::function<void(int base)> on_datum_base_picked;
|
||||
// The base drawn as selected, or -1. Asked once a frame rather than set, because what decides it
|
||||
// (the panel's chosen sketch plane, a picked face, the Plane card's base) changes in many places.
|
||||
std::function<int()> selected_base;
|
||||
// The reference planes are drawn this frame, with their own half-axes and origin mark: the canvas
|
||||
// leaves out the bed's axes triad, which would sit on top of them.
|
||||
bool draws_reference_axes() const { return m_dbp_active && !m_active; }
|
||||
|
||||
// Visual Fillet/Chamfer gizmo. The Dressup tool is a DesignPanel docked card, so the sketch
|
||||
// tool is NOT active during it; when a solid EDGE is picked the panel passes the body centroid
|
||||
@@ -971,7 +1031,7 @@ private:
|
||||
bool op_ready() const; // required entities picked -> arrow/ghost live
|
||||
|
||||
// Sample an entity into a 2D polyline for the overlay renderer.
|
||||
std::vector<Vec2d> entity_polyline(const SketchEntity& e, bool& closed) const;
|
||||
static std::vector<Vec2d> entity_polyline(const SketchEntity& e, bool& closed);
|
||||
|
||||
// Closed regions formed by the current (non-construction) entities: each a CCW-
|
||||
// ordered boundary polygon on the plane. A circle is its own region; line/arc
|
||||
@@ -1225,19 +1285,20 @@ private:
|
||||
Vec3d body_xform_pt(int body, const Vec3d& p) const; // map an OCCT-shape point through the body xform
|
||||
// The bodies' B-rep edges, drawn as dark lines over the solids so faces and features read
|
||||
// apart. One polyline set per body in its own shape coordinates, resampled only for a body
|
||||
// whose shape changed (keyed by the TShape), since set_solid_pick runs on every recompute.
|
||||
// whose shape changed (see is_current_shape).
|
||||
std::vector<std::vector<std::vector<Vec3d>>> m_body_edges;
|
||||
std::vector<const void*> m_body_edges_key;
|
||||
std::vector<TopoDS_Shape> m_body_edges_shape; // the shape each set was sampled from
|
||||
std::vector<double> m_body_edges_tol; // the chord tolerance they were sampled at
|
||||
bool m_body_edges_hidden{false};
|
||||
void refresh_body_edges();
|
||||
void render_body_edges();
|
||||
const void* body_key(int body) const; // the body's TShape, nullptr when there is none
|
||||
const TopoDS_Shape* body_shape(int body) const; // nullptr when there is no such body or it has no shape
|
||||
bool is_current_shape(int body, const TopoDS_Shape& sampled) const; // `sampled` is still the body's shape
|
||||
void append_ribbons(GLModel::Geometry& g, int body, const std::vector<std::vector<Vec3d>>& polylines,
|
||||
const Vec3d& vd, const Vec3d& pull, double hw) const;
|
||||
bool body_pickable(int b) const; // false when the body is explicitly hidden
|
||||
SolidSel m_solid_sel{SolidSel::None};
|
||||
int m_sel_body{-1}; // which body the face/edge selection is on
|
||||
TopoDS_Shape m_sel_shape; // that body's shape when picked: the ids index into it
|
||||
int m_sel_face{-1};
|
||||
int m_sel_edge{-1};
|
||||
std::vector<Vec3d> m_sel_edge_pts;
|
||||
@@ -1274,7 +1335,7 @@ private:
|
||||
void hit_display_sketch(const DisplaySketch& d, const Vec2d& p, double tol,
|
||||
int& edge_feat, int& edge_reg, int& edge_ent,
|
||||
double& edge_d, int& face_feat, int& face_reg) const;
|
||||
bool m_right_consumed{false}; // last RightDown was a gesture terminator, not a menu
|
||||
std::optional<wxMouseEvent> m_right_press; // right press not yet known to be a click
|
||||
bool m_escalate_repick{true}; // re-picking the same sub-element takes the whole body
|
||||
void render_solid_highlight();
|
||||
// The above's edge and vertex highlight, from explicit arguments, so the committed selection
|
||||
@@ -1282,11 +1343,11 @@ private:
|
||||
void render_solid_sel(SolidSel kind, const std::vector<Vec3d>& edge_pts, const Vec3d& vertex_pt,
|
||||
const ColorRGBA& rgb);
|
||||
// A set of selected faces of one body, with their edges sampled once, keyed by the body's
|
||||
// TShape so a recompute that rebuilt the body retires it.
|
||||
// shape so a recompute that rebuilt the body retires it.
|
||||
struct FaceHighlight {
|
||||
int body{-1};
|
||||
std::vector<int> faces; // sorted
|
||||
const void* key{nullptr};
|
||||
TopoDS_Shape shape;
|
||||
std::vector<std::vector<Vec3d>> edges; // in the body's shape coordinates
|
||||
};
|
||||
FaceHighlight make_face_highlight(int body, std::vector<int> faces) const;
|
||||
@@ -1385,7 +1446,9 @@ private:
|
||||
std::vector<int> m_dbp_base;
|
||||
std::vector<std::string> m_dbp_labels;
|
||||
int m_dbp_hover{-1};
|
||||
double dbp_half_extent() const; // bed-derived: reference planes are larger than the bed
|
||||
double dbp_half_extent() const; // bed-derived square size
|
||||
std::vector<SketchPlane> dbp_squares(double half) const; // reference_square of each entry
|
||||
void render_reference_axes(const Vec3d& origin, double half);
|
||||
void render_base_pick();
|
||||
int hit_test_base_pick(GLCanvas3D& canvas, const wxMouseEvent& evt) const;
|
||||
|
||||
@@ -1403,6 +1466,7 @@ private:
|
||||
int m_mv_drag{-1}; // 0..2 = X/Y/Z arrow, 3..5 = X/Y/Z ring, -1 none
|
||||
double m_mv_radius{0.0}; // body bounding-sphere radius (mm); 0 = unknown
|
||||
int m_mv_press_x{0}, m_mv_press_y{0};
|
||||
double m_mv_grab_along{0.0}; // arrow grab point's distance from the anchor; NaN = unknown
|
||||
Transform3d compose_move_xform() const; // T(offset)*T(pivot)*rot*T(-pivot)*base_xform
|
||||
void ring_basis(int axis, Vec3d& e, Vec3d& u, Vec3d& v) const; // world axis + in-plane basis
|
||||
void render_move_gizmo();
|
||||
@@ -1410,7 +1474,6 @@ private:
|
||||
double move_gizmo_arm(const Camera& cam) const;
|
||||
bool hit_test_move_arrow(GLCanvas3D& canvas, const wxMouseEvent& evt, int& axis) const;
|
||||
bool hit_test_move_arc(GLCanvas3D& canvas, const wxMouseEvent& evt, int& axis) const;
|
||||
void drag_move_arrow(GLCanvas3D& canvas, const wxMouseEvent& evt, int axis);
|
||||
void drag_move_arc(GLCanvas3D& canvas, const wxMouseEvent& evt, int axis);
|
||||
bool arc_mouse_angle(GLCanvas3D& canvas, const wxMouseEvent& evt, int axis, double& ang) const;
|
||||
void open_move_editor(int axis);
|
||||
|
||||
@@ -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 (...) {}
|
||||
|
||||
|
||||
@@ -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"
|
||||
@@ -415,9 +415,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"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <mutex>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/object.h>
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <limits>
|
||||
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -21,8 +20,6 @@
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/GuiColor.hpp"
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
bool DevMappingUtil::is_valid_mapping_result(const MachineObject* obj, std::vector<FilamentInfo>& result, bool check_empty_slot)
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "DevUtil.h"
|
||||
#include "DevUtilBackend.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include "libslic3r/MultiNozzleUtils.hpp"
|
||||
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
@@ -251,7 +250,7 @@ int DevNozzleMappingCtrl::CtrlGetAutoNozzleMappingV1(Slic3r::GUI::Plater* plater
|
||||
|
||||
void DevNozzleMappingCtrl::ParseAutoNozzleMapping(const json& print_jj)
|
||||
{
|
||||
if (print_jj.contains("command") && print_jj["command"].get<string>() == "get_auto_nozzle_mapping") {
|
||||
if (print_jj.contains("command") && print_jj["command"].get<std::string>() == "get_auto_nozzle_mapping") {
|
||||
if (print_jj.contains("sequence_id") && print_jj["sequence_id"] == m_sequence_id) {
|
||||
Clear();
|
||||
DevJsonValParser::ParseVal(print_jj, "result", m_result);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
#include "libslic3r/MultiNozzleUtils.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "DevNozzleSystem.h"
|
||||
#include "DevFirmware.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "DevNozzleRack.h"
|
||||
#include "DevExtruderSystem.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/MsgDialog.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "slic3r/GUI/DeviceCore/DevNozzleSystem.h"
|
||||
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "DevNozzleSystem.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
#include "slic3r/GUI/I18N.hpp"
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <optional>
|
||||
#include <cmath>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
@@ -424,7 +426,7 @@ void DevNozzleSystem::ClearNozzles()
|
||||
|
||||
// ---- parsing ----------------------------------------------------------------------------------------
|
||||
|
||||
static unordered_map<string, NozzleFlowType> _str2_nozzle_flow_type = {
|
||||
static std::unordered_map<std::string, NozzleFlowType> _str2_nozzle_flow_type = {
|
||||
{"S", NozzleFlowType::S_FLOW},
|
||||
{"H", NozzleFlowType::H_FLOW},
|
||||
{"A", NozzleFlowType::S_FLOW},
|
||||
@@ -434,7 +436,7 @@ static unordered_map<string, NozzleFlowType> _str2_nozzle_flow_type = {
|
||||
{"B", NozzleFlowType::E_FLOW}, // E3D High Flow -> nvtE3DHighFlow
|
||||
};
|
||||
|
||||
static unordered_map<string, NozzleType> _str2_nozzle_type = {
|
||||
static std::unordered_map<std::string, NozzleType> _str2_nozzle_type = {
|
||||
{"00", NozzleType::ntStainlessSteel},
|
||||
{"01", NozzleType::ntHardenedSteel},
|
||||
{"05", NozzleType::ntTungstenCarbide}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
#include "libslic3r/MultiNozzleUtils.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include <string>
|
||||
@@ -195,6 +195,6 @@ namespace Slic3r
|
||||
{
|
||||
public:
|
||||
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 <exception>
|
||||
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "slic3r/GUI/DeviceManager.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#include "DevStorage.h"
|
||||
#include "json_diff.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
DevStorage::SdcardState Slic3r::DevStorage::set_sdcard_state(int state)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user