forked from upstream-mirrors/OrcaSlicer
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a6d199bac4 | |||
| e2acd9ec06 | |||
| 896557bce5 | |||
| e8ebe3451a | |||
| a5210459ee | |||
| fcab66ca9e | |||
| d9f6b69506 | |||
| 5fb129f1f3 | |||
| 06bccd5570 | |||
| 5fd0edf5cc | |||
| 3ac1b0078d | |||
| a837652833 | |||
| 6c96e41162 | |||
| b3819e7c9e | |||
| b044fbacfa | |||
| 2a8abac43d | |||
| 533d4c3e9e | |||
| b3f8d0af15 | |||
| 49770913a5 |
@@ -158,7 +158,7 @@ jobs:
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libopengl0 libgl1 libegl1 libwebkit2gtk-4.1-0
|
||||
|
||||
- uses: actions/setup-python@v7
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
|
||||
@@ -95,9 +95,16 @@ declaration order at static init — cannot: inserting one option into the middl
|
||||
*succeeds on the wrong option*, silently, wherever the two share a type. Because a
|
||||
name-keyed payload instead drops the individual options this build cannot place, the
|
||||
file as a whole stays readable, and there is no schema fingerprint — no checksum over
|
||||
the option schema that would reject every cache on every release. An option this build
|
||||
no longer defines, or now defines with a different type, gets exactly what it gets from
|
||||
a JSON profile: read, dropped, and the rest of the preset loads.
|
||||
the option schema that would reject every cache on every release. An option this build no
|
||||
longer defines gets exactly what it gets from a JSON profile: read, dropped, and the rest
|
||||
of the preset loads. An option this build now defines with a different type is read by the
|
||||
type the writer recorded and handed to `set_deserialize` as its text, again as a JSON
|
||||
profile's value would be: `handle_legacy` maps an old spelling (a bool's `1` onto an
|
||||
enum's `enabled`) and an enum name a bool cannot parse is substituted. Only a text this
|
||||
build cannot parse into the new type is dropped, that option alone. Dropping a retyped
|
||||
option outright would leave the key at the collection default in every preset that sets
|
||||
it, which is not what the JSON says, and an installed cache outlives the app upgrade that
|
||||
retyped the key.
|
||||
|
||||
The ordinal-keyed cereal hooks in `PrintConfig.hpp` are untouched — they are also the
|
||||
undo/redo wire format, where the process cannot change underneath them. The cache has
|
||||
@@ -365,8 +372,11 @@ The system is designed so that no cache problem is fatal:
|
||||
- **Corrupt, truncated or foreign file** — rejected at the header, vendor parsed. A
|
||||
cache is written to a temp file beside its target and moved into place, so a write
|
||||
that dies partway leaves the previous cache intact rather than a truncated one.
|
||||
- **An option this build no longer has, or now types differently** — that option alone
|
||||
is dropped, exactly as a JSON profile's would be. The preset and the file load.
|
||||
- **An option this build no longer has** — that option alone is dropped, exactly as a
|
||||
JSON profile's would be. The preset and the file load.
|
||||
- **An option this build now types differently** — its value is read as the writer
|
||||
typed it and parsed from its text as a JSON profile's would be, legacy conversions
|
||||
included; only a text this build cannot parse into the new type is dropped.
|
||||
- **Cache from a build with a different cache layout** — rejected on `CACHE_VERSION`.
|
||||
A vendor with JSONs beside it is parsed and re-cached; a cache-only vendor reads as
|
||||
not installed and the updater reinstalls it.
|
||||
@@ -393,7 +403,10 @@ enumerates only `*.json` will find no vendors at all in a packaged build.
|
||||
- **Adding, removing, retyping or reordering a config option** needs nothing. The
|
||||
payload names its keys and its enum values, so an option a cache carries and this
|
||||
build does not is dropped; one this build has and the cache does not is simply
|
||||
absent, as it would be from a JSON that predates it.
|
||||
absent, as it would be from a JSON that predates it. A retyped option is read
|
||||
through `handle_legacy`, so give it the same conversion a JSON profile needs and the
|
||||
cache follows; an installed cache survives the upgrade that retyped the key, so that
|
||||
conversion is what every user who upgrades reads.
|
||||
- **Changing a hand-written `serialize()`** — `VendorProfile` or its nested types — or
|
||||
the `CachedPreset` field list — written and read by `visit_entry` in
|
||||
`PresetCacheFormat.cpp`, one list for the save, the load and the name peek alike — or
|
||||
|
||||
@@ -100,14 +100,8 @@ the active printer agent because a normal LAN agent represents one physical prin
|
||||
## Agent registration and selection
|
||||
|
||||
`NetworkAgentFactory` maintains the printer-agent registry. Each registry entry contains an agent ID,
|
||||
a display name, a factory function, and whether the native Device and Calibration tabs apply to the
|
||||
agent's printers. Built-in agents register during application initialization. Python printer-agent
|
||||
capabilities register dynamically and contribute an agent ID and factory entry.
|
||||
|
||||
The tab flag is read from the registry rather than the live agent because the main window lays out its
|
||||
tabs before the newly selected preset's agent is installed. It defaults to true. An agent that clears
|
||||
it is one whose printers have their own web interface and nothing the Bambu-shaped Device and
|
||||
Calibration tabs can show; for those printers the web Device page takes the Device tab's place.
|
||||
a display name, and a factory function. Built-in agents register during application initialization.
|
||||
Python printer-agent capabilities register dynamically and contribute an agent ID and factory entry.
|
||||
|
||||
The selected printer preset contains the printer-agent choice. If no explicit choice is stored, the
|
||||
application preserves the existing default behavior: Bambu presets select the Bambu agent and other
|
||||
|
||||
+66
-26
@@ -7,6 +7,8 @@
|
||||
#include "Polygon.hpp"
|
||||
#include "Print.hpp"
|
||||
#include "ShortestPath.hpp"
|
||||
#include "Surface.hpp"
|
||||
#include "SurfaceCollection.hpp"
|
||||
#include "Support/BeltFloorContext.hpp"
|
||||
#include "BoundingBox.hpp"
|
||||
#include "ExPolygon.hpp"
|
||||
@@ -257,9 +259,12 @@ struct BeltBrimContext
|
||||
};
|
||||
|
||||
// Emit the cross-belt brim lines that belong to the band [print_z - height, print_z].
|
||||
// wall_inset is how far the centreline of the outer wall of the band's object layer lies
|
||||
// inside where the layer's slice met the belt, mm.
|
||||
static void belt_brim_band_paths(const BeltBrimContext &bc,
|
||||
coordf_t print_z,
|
||||
coordf_t height,
|
||||
double wall_inset,
|
||||
const Polygons &obstacles,
|
||||
ExtrusionEntityCollection &out,
|
||||
ExPolygons &areas_out)
|
||||
@@ -272,10 +277,15 @@ static void belt_brim_band_paths(const BeltBrimContext &bc,
|
||||
// How wide this band is measured ON the belt, versus one nominal bead.
|
||||
const double band_in_plane = (u_hi - u_lo) * bc.frame.u_stretch();
|
||||
|
||||
// Fraction of the layer height at which a line sits above the belt. Toward the
|
||||
// downhill edge, so the sheet is reasonably thick while the nozzle stays clear of
|
||||
// the belt itself.
|
||||
static constexpr double BAND_CLEARANCE_FRACTION = 0.75;
|
||||
// Nozzle-to-belt clearance of the object's own outer wall where it rests on the belt.
|
||||
// The layer is sliced half a layer below print_z, so the slice meets the belt there, and
|
||||
// the wall's centreline is inset from that edge, where the belt lies lower by the inset
|
||||
// times the shear. No brim line sits closer to the belt than this, so brim and object
|
||||
// are laid at the same height and one calibration of the belt height (endstop, extruder
|
||||
// offset) serves both. A contour compensation that pushes the wall down to the belt
|
||||
// cannot be matched: the brim keeps a tenth of a layer, so its lines still have a
|
||||
// cross-section.
|
||||
const double wall_clearance = std::max(0.5 * height + wall_inset * std::abs(bc.frame.shear), 0.1 * height);
|
||||
|
||||
std::vector<coord_t> us;
|
||||
double uniform_clearance = 0.; // 0 => derive per line from its own position
|
||||
@@ -285,19 +295,20 @@ static void belt_brim_band_paths(const BeltBrimContext &bc,
|
||||
// wider. Two lattice lines in such a band would land almost on top of each other.
|
||||
if (band_in_plane <= 1.5 * bc.in_plane_pitch + EPSILON) {
|
||||
// Steep belt, which is the normal case: the band is narrower than one bead, so
|
||||
// exactly one line fits. Place it at a FIXED fraction of the band rather than
|
||||
// on a nominal-spacing lattice. On a lattice each line lands at an arbitrary
|
||||
// point in its band, the clearance sweeps [0, height] from band to band, and the
|
||||
// bead width therefore varies by 2x - visible as ragged, uneven brim lines.
|
||||
// Anchoring to the band makes the clearance identical everywhere, so every bead
|
||||
// is the same width.
|
||||
// exactly one line fits. Place it at the outer wall's clearance rather than on
|
||||
// a nominal-spacing lattice. On a lattice each line lands at an arbitrary point
|
||||
// in its band, the clearance sweeps [0, height] from band to band, and the bead
|
||||
// width therefore varies by 2x - visible as ragged, uneven brim lines. A fixed
|
||||
// clearance is identical everywhere, so every bead is the same width. It can
|
||||
// exceed the layer height, which only moves every band's line downhill by the
|
||||
// same distance.
|
||||
//
|
||||
// The spacing is then whatever the bands give (height / sin(tilt) on the belt)
|
||||
// rather than the nominal bead spacing, so the flow below is matched to THAT
|
||||
// pitch. Matched flow at the real pitch is what keeps the sheet uniform and
|
||||
// gap-free; using nominal flow at band spacing would over-feed it.
|
||||
us.push_back(scale_(bc.ctx.cutoff_u(print_z - BAND_CLEARANCE_FRACTION * height)));
|
||||
uniform_clearance = BAND_CLEARANCE_FRACTION * height;
|
||||
us.push_back(scale_(bc.ctx.cutoff_u(print_z - wall_clearance)));
|
||||
uniform_clearance = wall_clearance;
|
||||
line_pitch = band_in_plane;
|
||||
} else {
|
||||
// Shallow belt: the band is wider than a bead, so it takes several lines and they
|
||||
@@ -324,18 +335,17 @@ static void belt_brim_band_paths(const BeltBrimContext &bc,
|
||||
//
|
||||
// A lattice line can fall where the belt is only a hair below the band's print_z.
|
||||
// The bead there would be laid scraping the belt while its flow is sized for a
|
||||
// taller cell, so it is moved uphill to the same fraction of the band the
|
||||
// single-line case uses. (The clearance is along slice Z; the real gap under the
|
||||
// nozzle is clearance x cos(tilt), 0.53 h at 45 degrees for the 0.75 fraction.)
|
||||
// taller cell, so it is moved to the outer wall's clearance, where the single-line
|
||||
// case puts every line. (The clearance is along slice Z; the real gap under the
|
||||
// nozzle is clearance x cos(tilt).)
|
||||
double clearance = uniform_clearance;
|
||||
if (clearance <= 0.) {
|
||||
const Point probe = bc.frame.from_axis == 0 ? Point(u, 0) : Point(0, u);
|
||||
clearance = print_z - bc.ctx.floor_print_z(probe);
|
||||
if (clearance < BAND_CLEARANCE_FRACTION * height) {
|
||||
clearance = BAND_CLEARANCE_FRACTION * height;
|
||||
clearance = std::min(print_z - bc.ctx.floor_print_z(probe), height);
|
||||
if (clearance < wall_clearance) {
|
||||
clearance = wall_clearance;
|
||||
u = scale_(bc.ctx.cutoff_u(print_z - clearance));
|
||||
}
|
||||
clearance = std::min(clearance, height);
|
||||
}
|
||||
// A line moved uphill can land on, or almost on, its neighbour; two beads closer
|
||||
// than half a pitch would be laid into the same cell.
|
||||
@@ -357,10 +367,12 @@ static void belt_brim_band_paths(const BeltBrimContext &bc,
|
||||
if (pieces.empty())
|
||||
continue;
|
||||
|
||||
// with_cross_section, not with_height: it reaches the prescribed volume while
|
||||
// KEEPING the extrusion spacing, so the bead is sized to fill exactly one
|
||||
// pitch x clearance cell of the sheet.
|
||||
const Flow f = bc.brim_flow.with_cross_section(float(line_pitch * clearance));
|
||||
// A bead as tall as the clearance and line_pitch apart from the next fills exactly
|
||||
// one pitch x clearance cell of the sheet, at any clearance. (with_cross_section()
|
||||
// makes a round bead of a quarter of the area asked for when the cell is small.)
|
||||
const float height_f = float(clearance);
|
||||
const Flow f(Flow::rounded_rectangle_extrusion_width_from_spacing(float(line_pitch), height_f), height_f,
|
||||
bc.brim_flow.nozzle_diameter());
|
||||
|
||||
// Footprint of these beads, for the first-layer convex hull and bbox.
|
||||
for (const Polygon &p : offset(pieces, 0.5f * float(f.scaled_width())))
|
||||
@@ -445,6 +457,9 @@ void make_belt_brim(PrintObject &object)
|
||||
ExPolygons footprint_acc;
|
||||
// The first layer that touches the belt: where the leading-edge brim is cut.
|
||||
const Layer *first_contact = nullptr;
|
||||
// Per layer, the width of the outer wall resting on the belt, the narrowest where several
|
||||
// regions do, as it sits lowest; 0 where the layer does not rest on the belt.
|
||||
std::vector<double> contact_wall_width(nlayers, 0.);
|
||||
for (size_t i = 0; i < nlayers; ++ i) {
|
||||
const Layer &layer = *object.layers()[i];
|
||||
if (layer.lslices.empty())
|
||||
@@ -466,6 +481,11 @@ void make_belt_brim(PrintObject &object)
|
||||
if (first_contact == nullptr)
|
||||
first_contact = &layer;
|
||||
expolygons_append(footprint_acc, std::move(contact));
|
||||
for (const LayerRegion *layerm : layer.regions())
|
||||
if (! layerm->slices.empty() && ! intersection(to_polygons(layerm->slices.surfaces), Polygons{ band }).empty()) {
|
||||
const double w = layerm->flow(frExternalPerimeter).width();
|
||||
contact_wall_width[i] = contact_wall_width[i] > 0. ? std::min(contact_wall_width[i], w) : w;
|
||||
}
|
||||
}
|
||||
const ExPolygons footprint = union_ex(footprint_acc);
|
||||
if (footprint.empty())
|
||||
@@ -519,17 +539,37 @@ void make_belt_brim(PrintObject &object)
|
||||
: (low_side ? fbb.min.y() : fbb.max.y());
|
||||
}
|
||||
|
||||
// How far each layer's outer wall, which the layer's brim band is levelled with, lies
|
||||
// inside where the layer's slice met the belt: half its width, less the XY contour
|
||||
// compensation that grew the slice toward the belt (none where slicing skips it, see
|
||||
// PrintObject::slice_volumes()). The first layer's walls take initial_layer_line_width.
|
||||
// A layer that does not rest on the belt takes the wall of the last one before it that
|
||||
// does, and the layers ahead of the part the first one's.
|
||||
const double contour_compensation = print.config().filament_diameter.size() > 1 && object.is_mm_painted() ?
|
||||
0. : object.config().xy_contour_compensation.value;
|
||||
std::vector<double> wall_insets(nlayers);
|
||||
{
|
||||
const auto first_wall = std::find_if(contact_wall_width.begin(), contact_wall_width.end(), [](double w) { return w > 0.; });
|
||||
double width = first_wall != contact_wall_width.end() ? *first_wall : 0.;
|
||||
for (size_t i = 0; i < nlayers; ++ i) {
|
||||
if (contact_wall_width[i] > 0.)
|
||||
width = contact_wall_width[i];
|
||||
wall_insets[i] = 0.5 * width - contour_compensation;
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Bands coincident with an object layer.
|
||||
std::vector<ExtrusionEntityCollection> by_layer(nlayers);
|
||||
std::vector<ExPolygons> areas_by_layer(nlayers);
|
||||
for (size_t i = 0; i < nlayers; ++ i) {
|
||||
const Layer &layer = *object.layers()[i];
|
||||
const Polygons obstacles = belt_brim_obstacles(print, object, bc.region_bbox, layer.print_z, 0.5 * layer.height);
|
||||
belt_brim_band_paths(bc, layer.print_z, layer.height, obstacles, by_layer[i], areas_by_layer[i]);
|
||||
belt_brim_band_paths(bc, layer.print_z, layer.height, wall_insets[i], obstacles, by_layer[i], areas_by_layer[i]);
|
||||
}
|
||||
|
||||
// 5. Apron prologue: the part of the region downhill of the object's first
|
||||
// layer, which has no object layer to ride on.
|
||||
// layer, which has no object layer to ride on. It continues the first layer's
|
||||
// band, so it takes that layer's height, and the first contact's wall.
|
||||
std::vector<BeltBrimBand> prologue;
|
||||
{
|
||||
const Layer &first = *object.layers().front();
|
||||
@@ -548,7 +588,7 @@ void make_belt_brim(PrintObject &object)
|
||||
BeltBrimBand band;
|
||||
band.print_z = z;
|
||||
band.height = h;
|
||||
belt_brim_band_paths(bc, z, h, obstacles, band.fills, band.areas);
|
||||
belt_brim_band_paths(bc, z, h, wall_insets.front(), obstacles, band.fills, band.areas);
|
||||
if (! band.fills.empty())
|
||||
prologue.emplace_back(std::move(band));
|
||||
}
|
||||
|
||||
@@ -441,6 +441,9 @@ bool ExtrusionLoop::is_smooth(double angle_threshold, double min_arm_length) con
|
||||
// scarf extrudes through both ends, and the planner nearly halts on a block that short. Drop the
|
||||
// vertex next to the seam point instead, so the loop still starts and ends at the seam. A trimmed
|
||||
// path loses its arc fitting; its geometry is unchanged, it just prints as line segments.
|
||||
// An eighth of a common line width: the path moves by less than that where a vertex is dropped.
|
||||
const double seam_path_tolerance = scale_(0.05);
|
||||
|
||||
static void trim_seam_ends(ExtrusionPaths &paths, double tolerance)
|
||||
{
|
||||
const auto shorter = [tolerance](const Point3 &a, const Point3 &b) { return (b - a).cast<double>().norm() < tolerance; };
|
||||
@@ -480,10 +483,13 @@ static void trim_seam_ends(ExtrusionPaths &paths, double tolerance)
|
||||
}
|
||||
}
|
||||
|
||||
// Split `polyline` where the scarf ramp ends. When the split would leave a remainder shorter
|
||||
// than half a slope step before the next vertex, the ramp is extended to that vertex instead:
|
||||
// a stub that short makes the motion planner slow down at the end of the ramp. Planners treat
|
||||
// moves of a millimetre and more as ordinary, so the ramp never grows by more than that.
|
||||
// Split `polyline` where the scarf ramp ends. A remainder shorter than half a slope step before
|
||||
// the next vertex would be a flat stub that makes the motion planner slow down at the end of the
|
||||
// ramp. Where that vertex lies within `seam_path_tolerance` of the straight line from the exact
|
||||
// ramp end to the vertex after it, the flat path skips it: the ramp keeps its exact length, so it
|
||||
// ends at the same place on every layer however the loop's vertices fall there. At a corner, or
|
||||
// when the vertex ends the path, the ramp is extended to the vertex instead. Planners treat moves
|
||||
// of a millimetre and more as ordinary, so the ramp never grows by more than that.
|
||||
static void split_at_slope_end(const Polyline3 &polyline, double length, double slope_max_segment_length, Polyline3 &slope, Polyline3 &flat)
|
||||
{
|
||||
const double snap_distance = std::min(0.5 * slope_max_segment_length, scale_(1.));
|
||||
@@ -493,6 +499,21 @@ static void split_at_slope_end(const Polyline3 &polyline, double length, double
|
||||
const double end_length = acc_length + line.length();
|
||||
if (end_length >= length) {
|
||||
if (end_length - length < snap_distance) {
|
||||
const size_t after = line_idx + 2;
|
||||
if (length >= SCALED_EPSILON && after < polyline.size()) {
|
||||
// Distance of the skipped vertex from the chord, in 3D so that a Z contour is kept too.
|
||||
const Vec3d a = lerp(line.a, line.b, (length - acc_length) / line.length()).cast<double>();
|
||||
const Vec3d b = polyline.points[after].cast<double>();
|
||||
const Vec3d p = line.b.cast<double>();
|
||||
const double t = (b - a).squaredNorm() > 0. ? std::clamp((p - a).dot(b - a) / (b - a).squaredNorm(), 0., 1.) : 0.;
|
||||
if ((p - a - t * (b - a)).norm() <= seam_path_tolerance) {
|
||||
Polyline3 rest;
|
||||
polyline.split_at_length(length, &slope, &rest);
|
||||
polyline.split_at_index(after, &rest, &flat);
|
||||
flat.append_before(slope.last_point());
|
||||
return;
|
||||
}
|
||||
}
|
||||
polyline.split_at_index(line_idx + 1, &slope, &flat);
|
||||
return;
|
||||
}
|
||||
@@ -512,8 +533,7 @@ ExtrusionLoopSloped::ExtrusionLoopSloped(ExtrusionPaths& original_paths,
|
||||
ExtrusionLoopRole role)
|
||||
: ExtrusionLoop(role)
|
||||
{
|
||||
// An eighth of a common line width: the path moves by less than that at the seam.
|
||||
trim_seam_ends(original_paths, scale_(0.05));
|
||||
trim_seam_ends(original_paths, seam_path_tolerance);
|
||||
// The caller measured the loop before the trim; a scarf that covers the whole loop must still end at 1.
|
||||
double trimmed_length = 0.;
|
||||
for (const ExtrusionPath &path : original_paths)
|
||||
|
||||
+144
-16
@@ -3489,9 +3489,13 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||
// Undo what point_to_gcode() added (m_origin, minus the extruder offset) and
|
||||
// what the writer then took off (its XY offset, the plate origin).
|
||||
const Vec2d plate_offset = m_writer.get_xy_offset().cast<double>();
|
||||
// Judged like the path the travel leads to (see belt_path_height()).
|
||||
if (m_belt_travel_target != nullptr && m_belt_travel_target->role() == erBrim)
|
||||
return true;
|
||||
return this->on_first_layer(Vec3d(point_logical.x() - (m_origin.x() - plate_offset.x()) + extruder_offset.x(),
|
||||
point_logical.y() - (m_origin.y() - plate_offset.y()) + extruder_offset.y(),
|
||||
point_logical.z()));
|
||||
point_logical.z()),
|
||||
m_belt_travel_target != nullptr ? m_belt_travel_target->width : 0.);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9229,6 +9233,89 @@ static bool overhang_fan_active(float overlap, int overhang_fan_threshold, Extru
|
||||
}
|
||||
|
||||
std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_description, double speed)
|
||||
{
|
||||
std::vector<std::vector<double>> uncut_line_lengths;
|
||||
const ExtrusionPaths pieces = this->belt_cut_at_band_edges(path, uncut_line_lengths);
|
||||
if (pieces.size() < 2)
|
||||
return this->_extrude_piece(path, path_description, speed);
|
||||
std::string gcode;
|
||||
for (size_t i = 0; i < pieces.size(); ++ i) {
|
||||
m_belt_uncut_line_lengths = &uncut_line_lengths[i];
|
||||
gcode += this->_extrude_piece(pieces[i], path_description, speed);
|
||||
}
|
||||
m_belt_uncut_line_lengths = nullptr;
|
||||
return gcode;
|
||||
}
|
||||
|
||||
// Belt printers: whether a path is on the first layer, and its step of the slow_down_layers
|
||||
// ramp, set its speed, flow and acceleration as a whole. A wall loop runs from the belt up
|
||||
// the part, so a path is cut where it crosses the edge of the first-layer band above the belt
|
||||
// or of a band of the ramp, and each piece is judged on its own. Otherwise the loop would
|
||||
// take the settings of wherever its seam is all the way round. Returns no pieces when the
|
||||
// path stays in one band, and else, for each piece, the length of the uncut line each of its
|
||||
// lines comes from, so that small-area flow compensation sees the line as it was.
|
||||
ExtrusionPaths GCode::belt_cut_at_band_edges(const ExtrusionPath &path, std::vector<std::vector<double>> &uncut_line_lengths) const
|
||||
{
|
||||
ExtrusionPaths pieces;
|
||||
// A sloped seam carries its slope along it, and a contoured path scales each line's
|
||||
// extrusion by the Z offset at the line's end, which a cut would move; both are judged
|
||||
// whole.
|
||||
if (! m_config.belt_printer.value || path.z_contoured || dynamic_cast<const ExtrusionPathSloped*>(&path) != nullptr)
|
||||
return pieces;
|
||||
// Band 0 is the first layer as on_first_layer() has it, band k > 0 the heights the ramp
|
||||
// gives step k (effective_layer_index_for_point()), the last one everything above it.
|
||||
const double first = m_config.initial_layer_print_height.value;
|
||||
const double band = this->first_layer_band_mm();
|
||||
const int last = std::max(1, m_config.slow_down_layers.value);
|
||||
auto band_of = [this, first, last](double h) {
|
||||
return h <= first + EPSILON ? 0 : std::clamp(this->belt_band_index(h), 1, last);
|
||||
};
|
||||
auto band_top = [first, band](int k) { return k == 0 ? first : (k + 1) * band; };
|
||||
const Points3 &points = path.polyline.points;
|
||||
double h_prev;
|
||||
if (points.size() < 2 || ! this->belt_path_height(path, points.front(), h_prev))
|
||||
return pieces;
|
||||
int band_prev = band_of(h_prev);
|
||||
Points3 current{ points.front() };
|
||||
std::vector<double> current_lengths;
|
||||
auto extend = [¤t, ¤t_lengths](const Point3 &p, double uncut_length) {
|
||||
if (p != current.back()) {
|
||||
current.push_back(p);
|
||||
current_lengths.push_back(uncut_length);
|
||||
}
|
||||
};
|
||||
for (size_t i = 1; i < points.size(); ++ i) {
|
||||
double h;
|
||||
this->belt_path_height(path, points[i], h);
|
||||
const int band_i = band_of(h);
|
||||
const double length = unscale<double>((points[i] - points[i - 1]).cast<double>().norm());
|
||||
// Cut at each edge the segment crosses. The belt is a plane, so the height is
|
||||
// linear along the segment.
|
||||
for (int k = band_prev; k != band_i; k += band_i > band_prev ? 1 : -1) {
|
||||
const double edge = band_top(band_i > band_prev ? k : k - 1);
|
||||
const double t = std::clamp((edge - h_prev) / (h - h_prev), 0., 1.);
|
||||
const Vec3d cut = points[i - 1].cast<double>() + t * (points[i] - points[i - 1]).cast<double>();
|
||||
const Point3 cut_point(cut.x(), cut.y(), cut.z());
|
||||
extend(cut_point, length);
|
||||
if (current.size() > 1) {
|
||||
pieces.emplace_back(Polyline3(current), path);
|
||||
uncut_line_lengths.emplace_back(std::move(current_lengths));
|
||||
}
|
||||
current = { cut_point };
|
||||
current_lengths.clear();
|
||||
}
|
||||
extend(points[i], length);
|
||||
h_prev = h;
|
||||
band_prev = band_i;
|
||||
}
|
||||
if (! pieces.empty() && current.size() > 1) {
|
||||
pieces.emplace_back(Polyline3(current), path);
|
||||
uncut_line_lengths.emplace_back(std::move(current_lengths));
|
||||
}
|
||||
return pieces;
|
||||
}
|
||||
|
||||
std::string GCode::_extrude_piece(const ExtrusionPath &path, const std::string &path_description, double speed)
|
||||
{
|
||||
std::string gcode;
|
||||
|
||||
@@ -9240,15 +9327,29 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
// evaluator is inactive (non-belt printers, or belt printers without
|
||||
// a Z-axis shear) `path_on_first_layer` falls back to the legacy
|
||||
// layer-id check, so behavior is bit-identical to the pre-feature path.
|
||||
// A belt brim apron band has no Layer of its own, so it publishes its Z
|
||||
// through m_belt_brim_z instead; without that the plane would be probed at
|
||||
// Z=0 and the apron mis-classified for fan and speed.
|
||||
const Vec3d path_point_mm{
|
||||
unscale<double>(path.first_point().x()),
|
||||
unscale<double>(path.first_point().y()),
|
||||
m_layer ? m_layer->print_z : (m_belt_brim_z ? *m_belt_brim_z : 0.0)
|
||||
};
|
||||
const bool path_on_first_layer = this->on_first_layer(path_point_mm);
|
||||
bool path_on_first_layer = this->on_first_layer(path_point_mm);
|
||||
// On a belt a path is judged by how high above the belt all of it is: it is on the first
|
||||
// layer when all of it is, and takes the slow_down_layers step of its middle. A piece cut
|
||||
// at the edge of a band (see belt_cut_at_band_edges()) starts or ends on the edge, so
|
||||
// neither of its ends would do.
|
||||
int belt_layer = -1;
|
||||
if (m_config.belt_printer.value) {
|
||||
double lo = std::numeric_limits<double>::max(), hi = std::numeric_limits<double>::lowest(), h;
|
||||
for (const Point3 &p : path.polyline.points)
|
||||
if (this->belt_path_height(path, p, h)) {
|
||||
lo = std::min(lo, h);
|
||||
hi = std::max(hi, h);
|
||||
}
|
||||
if (lo <= hi) {
|
||||
path_on_first_layer = hi <= m_config.initial_layer_print_height.value + EPSILON;
|
||||
belt_layer = path_on_first_layer ? 0 : std::max(1, this->belt_band_index(0.5 * (lo + hi)));
|
||||
}
|
||||
}
|
||||
|
||||
const ExtrusionPathSloped* sloped = dynamic_cast<const ExtrusionPathSloped*>(&path);
|
||||
|
||||
@@ -9277,7 +9378,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
z = unscale_(path.polyline.lines().begin()->a.z()) + m_nominal_z;
|
||||
}
|
||||
|
||||
// The writer's first-layer test judges the travel like the path it leads to.
|
||||
m_belt_travel_target = &path;
|
||||
gcode += this->travel_to(first_point, path.role(), "move to first " + description + " point", z);
|
||||
m_belt_travel_target = nullptr;
|
||||
|
||||
// Orca: ensure Z matches planned layer height
|
||||
if (!slope_need_z_travel && (_last_pos_undefined || m_need_change_layer_lift_z)) {
|
||||
@@ -9483,16 +9587,18 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
// Use the belt-aware effective layer index when on a belt printer so
|
||||
// the speed fade tracks perpendicular distance from the plane on
|
||||
// belt printers; otherwise this falls back to the slicing layer id.
|
||||
const int _layer = this->effective_layer_index_for_point(path_point_mm);
|
||||
const int _layer = belt_layer >= 0 ? belt_layer : this->effective_layer_index_for_point(path_point_mm);
|
||||
// Belt printers: a tilted layer runs from the belt to the top of the part, so the
|
||||
// "first layers" the fan stays off for are a band along the belt. Mark where the
|
||||
// extrusion enters and leaves it, per segment, for the cooling buffer.
|
||||
const bool belt_band_tags = m_enable_cooling_markers && m_config.belt_printer.value;
|
||||
const int belt_band_layers = belt_band_tags ? m_config.close_fan_the_first_x_layers.get_at(m_writer.filament()->id()) : 0;
|
||||
auto tag_belt_band = [this, &gcode, belt_band_tags, belt_band_layers, z = path_point_mm.z()](coord_t x, coord_t y) {
|
||||
auto tag_belt_band = [this, &gcode, &path, &path_point_mm, belt_band_tags, belt_band_layers](const Point3 &p) {
|
||||
if (! belt_band_tags)
|
||||
return;
|
||||
const bool in_band = this->effective_layer_index_for_point(Vec3d(unscale<double>(x), unscale<double>(y), z)) < belt_band_layers;
|
||||
double h;
|
||||
const int layer = this->belt_path_height(path, p, h) ? this->belt_band_index(h) : this->effective_layer_index_for_point(path_point_mm);
|
||||
const bool in_band = layer < belt_band_layers;
|
||||
if (in_band != m_belt_in_band) {
|
||||
gcode += in_band ? ";_BELT_BAND_START\n" : ";_BELT_BAND_END\n";
|
||||
m_belt_in_band = in_band;
|
||||
@@ -9620,6 +9726,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
fan_overlap_threshold = overhang_fan_overlap_threshold(FILAMENT_CONFIG(overhang_fan_threshold));
|
||||
|
||||
if (NOZZLE_CONFIG(slowdown_for_curled_perimeters)){
|
||||
const FloatOrPercent fully_unsupported_speed = path.role() == erBridgeInfill ?
|
||||
FloatOrPercent{NOZZLE_CONFIG(bridge_speed) * 100 / ref_speed, true} :
|
||||
(NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5 ?
|
||||
FloatOrPercent{100, true} :
|
||||
FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true});
|
||||
ConfigOptionFloatsOrPercents dynamic_overhang_speeds(
|
||||
{FloatOrPercent{100, true},
|
||||
(NOZZLE_CONFIG(overhang_1_4_speed).get_abs_value(ref_speed) < 0.5) ?
|
||||
@@ -9634,9 +9745,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
(NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ?
|
||||
FloatOrPercent{100, true} :
|
||||
FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true},
|
||||
(NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) < 0.5) ?
|
||||
FloatOrPercent{100, true} :
|
||||
FloatOrPercent{NOZZLE_CONFIG(overhang_4_4_speed).get_abs_value(ref_speed) * 100 / ref_speed, true}});
|
||||
fully_unsupported_speed});
|
||||
|
||||
new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds,
|
||||
ref_speed, speed, NOZZLE_CONFIG(slowdown_for_curled_perimeters),
|
||||
@@ -9960,7 +10069,11 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
double total_length = sloped == nullptr ? 0. : path.polyline.length() * SCALING_FACTOR;
|
||||
double saved_z = m_writer.get_position().z();
|
||||
|
||||
size_t line_idx = 0;
|
||||
for (const Line3& line : path.polyline.lines()) {
|
||||
// A line cut at a band edge above a belt is compensated as the line it was.
|
||||
const double uncut_length = m_belt_uncut_line_lengths != nullptr ? (*m_belt_uncut_line_lengths)[line_idx] : 0.;
|
||||
++ line_idx;
|
||||
std::string flow_description;
|
||||
const double line_length = line.length() * SCALING_FACTOR;
|
||||
if (line_length < EPSILON)
|
||||
@@ -9969,13 +10082,13 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
auto dE = e_per_mm * line_length;
|
||||
if (_needSAFC(path)) {
|
||||
auto oldE = dE;
|
||||
dE = m_small_area_infill_flow_compensator->modify_flow(line_length, dE, path.role());
|
||||
dE = m_small_area_infill_flow_compensator->modify_flow(m_belt_uncut_line_lengths != nullptr ? uncut_length : line_length, dE, path.role());
|
||||
|
||||
if (m_config.gcode_comments && oldE > 0 && oldE != dE) {
|
||||
flow_description = description + Slic3r::format(" | Old Flow Value: %0.5f Length: %0.5f",oldE, line_length);
|
||||
}
|
||||
}
|
||||
tag_belt_band((line.a.x() + line.b.x()) / 2, (line.a.y() + line.b.y()) / 2);
|
||||
tag_belt_band(line.midpoint());
|
||||
if (path.z_contoured) {
|
||||
// ZAA: Z anti-aliased extrusion with variable Z per point
|
||||
Vec2d dest2d = this->point_to_gcode(line.b.to_point());
|
||||
@@ -10106,7 +10219,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &path_d
|
||||
const ProcessedPoint &processed_point = new_points[i];
|
||||
const ProcessedPoint &pre_processed_point = new_points[i-1];
|
||||
Vec3d p = this->point_to_gcode_quantized(processed_point.p);
|
||||
tag_belt_band((pre_processed_point.p.x() + processed_point.p.x()) / 2, (pre_processed_point.p.y() + processed_point.p.y()) / 2);
|
||||
tag_belt_band(Point3((pre_processed_point.p + processed_point.p) / 2));
|
||||
if (m_enable_cooling_markers) {
|
||||
if (enable_overhang_bridge_fan) {
|
||||
cur_fan_enabled = overhang_fan_active(processed_point.overlap, overhang_fan_threshold, path.role());
|
||||
@@ -11493,7 +11606,22 @@ int GCode::belt_layer_past_first_layer_band(const Layer *object_layer) const
|
||||
return min_height >= this->first_layer_band_mm() - EPSILON ? 1 : 0;
|
||||
}
|
||||
|
||||
bool GCode::belt_height_above_floor(const Vec3d &point_slicing_mm, double &height_mm) const
|
||||
bool GCode::belt_path_height(const ExtrusionPath &path, const Point3 &p, double &height_mm) const
|
||||
{
|
||||
// A belt brim apron band has no Layer of its own, so it publishes its Z through
|
||||
// m_belt_brim_z; without that the belt would be probed at Z=0 and the apron
|
||||
// misjudged for fan and speed.
|
||||
const double z = m_layer ? m_layer->print_z : (m_belt_brim_z ? *m_belt_brim_z : 0.0);
|
||||
const Vec3d point(unscale<double>(p.x()), unscale<double>(p.y()), path.z_contoured ? z + unscale<double>(p.z()) : z);
|
||||
if (! this->belt_height_above_floor(point, height_mm, path.width))
|
||||
return false;
|
||||
// The brim's lines are as wide as the bands are far apart, not as the bead they lay.
|
||||
if (path.role() == erBrim)
|
||||
height_mm = 0.;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GCode::belt_height_above_floor(const Vec3d &point_slicing_mm, double &height_mm, double width) const
|
||||
{
|
||||
// The owning object, which is what carries the belt description. During
|
||||
// object-brim and coincident-apron emission m_layer still points at whichever
|
||||
@@ -11517,7 +11645,7 @@ bool GCode::belt_height_above_floor(const Vec3d &point_slicing_mm, double &heigh
|
||||
// horizontal slabs in the sliced frame, so the slab holding the material that
|
||||
// rests on the belt at this point is the one within one layer height of it.
|
||||
// A perpendicular measure would shrink the band by 1/cos(tilt).
|
||||
height_mm = point_slicing_mm.z() - floor_z;
|
||||
height_mm = point_slicing_mm.z() - floor_z - 0.5 * width * std::abs(sp.belt_floor_shear_factor);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+31
-8
@@ -962,6 +962,12 @@ protected:
|
||||
|
||||
// The last extrusion segment was inside the belt's first-layer fan band (see _extrude()).
|
||||
bool m_belt_in_band{false};
|
||||
// The path that the travel being emitted leads to, for the writer's first-layer test on a
|
||||
// belt; null for any other travel.
|
||||
const ExtrusionPath *m_belt_travel_target{nullptr};
|
||||
// For a path cut at the edges of the bands above a belt (see _extrude()), the length, mm,
|
||||
// of the uncut line each of its lines comes from; null for any other path.
|
||||
const std::vector<double> *m_belt_uncut_line_lengths{nullptr};
|
||||
|
||||
std::set<unsigned int> m_initial_layer_extruders;
|
||||
std::vector<std::vector<unsigned int>> m_sorted_layer_filaments;
|
||||
@@ -973,6 +979,9 @@ protected:
|
||||
|
||||
double calc_max_volumetric_speed(const double layer_height, const double line_width, const std::string co_str);
|
||||
std::string _extrude(const ExtrusionPath &path, const std::string &path_description = "", double speed = -1);
|
||||
ExtrusionPaths belt_cut_at_band_edges(const ExtrusionPath &path, std::vector<std::vector<double>> &uncut_line_lengths) const;
|
||||
// _extrude() of a path that stays in one band above the belt (see belt_cut_at_band_edges()).
|
||||
std::string _extrude_piece(const ExtrusionPath &path, const std::string &path_description, double speed);
|
||||
bool _needSAFC(const ExtrusionPath &path);
|
||||
void print_machine_envelope(GCodeOutputStream& file, Print& print);
|
||||
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
@@ -983,10 +992,12 @@ protected:
|
||||
// Per-point first-layer test. On a belt printer the result depends on the
|
||||
// supplied slicing-frame point (its height above the belt); otherwise we
|
||||
// delegate to the legacy per-layer test. This is the entry point used by
|
||||
// per-path call sites in _extrude.
|
||||
bool on_first_layer(const Vec3d &point_slicing_mm) const {
|
||||
// per-path call sites in _extrude and by travels, which pass the width of the
|
||||
// extrusion they lead to (see belt_height_above_floor()). _extrude_piece()
|
||||
// judges a belt path by all of its points (see belt_path_height()).
|
||||
bool on_first_layer(const Vec3d &point_slicing_mm, double width = 0.) const {
|
||||
double h;
|
||||
if (this->belt_height_above_floor(point_slicing_mm, h))
|
||||
if (this->belt_height_above_floor(point_slicing_mm, h, width))
|
||||
return h <= m_config.initial_layer_print_height.value + EPSILON;
|
||||
return on_first_layer();
|
||||
}
|
||||
@@ -995,12 +1006,14 @@ protected:
|
||||
// first_layer_band_mm() units; otherwise it is the legacy slicing layer index.
|
||||
int effective_layer_index_for_point(const Vec3d &point_slicing_mm) const {
|
||||
double h;
|
||||
if (this->belt_height_above_floor(point_slicing_mm, h)) {
|
||||
const double lh = this->first_layer_band_mm();
|
||||
return h <= 0. ? 0 : int(std::floor(h / lh));
|
||||
}
|
||||
if (this->belt_height_above_floor(point_slicing_mm, h))
|
||||
return this->belt_band_index(h);
|
||||
return on_first_layer() ? 0 : layer_id();
|
||||
}
|
||||
// The effective layer index of a height above the belt.
|
||||
int belt_band_index(double height_mm) const {
|
||||
return height_mm <= 0. ? 0 : int(std::floor(height_mm / this->first_layer_band_mm()));
|
||||
}
|
||||
|
||||
// Band thickness for the *effective layer index*: one first layer height, so
|
||||
// "the first N layers" means the same height above the belt as on a flat bed.
|
||||
@@ -1016,7 +1029,17 @@ protected:
|
||||
// parameters (belt_floor_shear_factor / _from_axis / _z_shift) -- the same
|
||||
// description the support generator uses, independent of every remap and
|
||||
// back-transform.
|
||||
bool belt_height_above_floor(const Vec3d &point_slicing_mm, double &height_mm) const;
|
||||
//
|
||||
// With `width`, the point is the nozzle over an extrusion that wide, and the height
|
||||
// is taken above the highest belt under the bead: the belt rises across it, so the
|
||||
// wall of a tilted layer that rests on the belt has its nozzle half a layer plus
|
||||
// half its width x tan(tilt) up, more than one first layer at 45 degrees.
|
||||
bool belt_height_above_floor(const Vec3d &point_slicing_mm, double &height_mm, double width = 0.) const;
|
||||
// Height above the belt of a point of `path` on the layer being emitted, with the nozzle
|
||||
// over the path's bead and the Z offset of a contoured path; false when this is not a belt
|
||||
// print. A brim line rests on the belt by construction, however narrow the spacing of the
|
||||
// bands makes its bead, so it is at 0.
|
||||
bool belt_path_height(const ExtrusionPath &path, const Point3 &p, double &height_mm) const;
|
||||
// 1 / 0 / -1: the object layer is entirely past the first-layer band above the
|
||||
// belt / reaches into it / the belt surface is not known for it.
|
||||
int belt_layer_past_first_layer_band(const Layer *object_layer) const;
|
||||
|
||||
@@ -271,6 +271,10 @@ triangle_mesh_to_cgal(const std::vector<stl_vertex> &V,
|
||||
{
|
||||
std::unique_ptr<CGALMesh, CGALMeshDeleter> out(new CGALMesh{});
|
||||
triangle_mesh_to_cgal(V, F, out->m);
|
||||
// CGAL's volume predicate dereferences an incident halfedge for every vertex.
|
||||
// Remove isolated vertices and compact their indices for conversion back to an ITS.
|
||||
if (CGALProc::remove_isolated_vertices(out->m) != 0)
|
||||
out->m.collect_garbage();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,10 +117,9 @@ void CacheDictionary::load(cereal::BinaryInputArchive& ar)
|
||||
throw std::runtime_error("preset cache: dictionary is missing its unnamed-enum slot");
|
||||
// Resolved once per file: every option read after this is a vector index.
|
||||
m_defs.resize(m_keys.size());
|
||||
for (size_t i = 0; i < m_keys.size(); ++ i) {
|
||||
const ConfigOptionDef* def = print_config_def.get(m_keys[i]);
|
||||
m_defs[i] = (def != nullptr && uint16_t(def->type) == m_types[i]) ? def : nullptr;
|
||||
}
|
||||
m_reported.assign(m_keys.size(), char(0));
|
||||
for (size_t i = 0; i < m_keys.size(); ++ i)
|
||||
m_defs[i] = print_config_def.get(m_keys[i]);
|
||||
}
|
||||
|
||||
// ---- one config -----------------------------------------------------------
|
||||
@@ -138,10 +137,14 @@ static void save_enum_option(cereal::BinaryOutputArchive& ar, const ConfigOption
|
||||
}
|
||||
}
|
||||
|
||||
// `config` may be null, in which case the option is read and dropped.
|
||||
// `config` may be null, in which case the option is read and dropped. With
|
||||
// `text` given, the value is also returned as the text a JSON profile would
|
||||
// carry — the names, comma-separated for a vector, with an int the writer
|
||||
// could not name as a number or "nil" — for read_config to place a key this
|
||||
// build types differently through handle_legacy.
|
||||
static void load_enum_option(cereal::BinaryInputArchive& ar, ConfigOptionType type,
|
||||
const ConfigOptionDef* def, DynamicPrintConfig* config,
|
||||
const CacheDictionary& dict)
|
||||
const CacheDictionary& dict, std::string* text = nullptr)
|
||||
{
|
||||
uint32_t cnt = 0;
|
||||
ar(cnt);
|
||||
@@ -151,32 +154,38 @@ static void load_enum_option(cereal::BinaryInputArchive& ar, ConfigOptionType ty
|
||||
// whatever follows this option still loads.
|
||||
bool usable = def != nullptr && config != nullptr;
|
||||
std::vector<int> values;
|
||||
values.reserve(cnt);
|
||||
if (usable)
|
||||
values.reserve(cnt);
|
||||
for (uint32_t i = 0; i < cnt; ++ i) {
|
||||
uint16_t idx = 0;
|
||||
ar(idx);
|
||||
if (! dict.valid_enum_index(idx))
|
||||
throw std::runtime_error("preset cache: enum value index past the end of the dictionary");
|
||||
if (idx == CacheDictionary::ENUM_UNNAMED) {
|
||||
// An int the writer could not name — a nil, or an option whose
|
||||
// definition carried no enum_keys_map. It travels verbatim.
|
||||
int32_t raw = 0;
|
||||
// An int the writer could not name — a nil, or an option whose
|
||||
// definition carried no enum_keys_map — follows its index verbatim.
|
||||
int32_t raw = 0;
|
||||
if (idx == CacheDictionary::ENUM_UNNAMED)
|
||||
ar(raw);
|
||||
values.push_back(int(raw));
|
||||
continue;
|
||||
}
|
||||
if (! usable)
|
||||
continue; // the index above was this element's whole payload
|
||||
if (def->enum_keys_map == nullptr) {
|
||||
usable = false; // this build no longer maps this option's names
|
||||
continue;
|
||||
}
|
||||
const auto it = def->enum_keys_map->find(dict.enum_name_at(idx));
|
||||
if (it == def->enum_keys_map->end()) {
|
||||
if (usable) {
|
||||
if (idx == CacheDictionary::ENUM_UNNAMED) {
|
||||
values.push_back(int(raw));
|
||||
continue;
|
||||
}
|
||||
const auto it = def->enum_keys_map == nullptr ? def->enum_keys_map->end() : def->enum_keys_map->find(dict.enum_name_at(idx));
|
||||
if (def->enum_keys_map != nullptr && it != def->enum_keys_map->end()) {
|
||||
values.push_back(it->second);
|
||||
continue;
|
||||
}
|
||||
usable = false; // a value this build dropped: the option goes with it
|
||||
continue;
|
||||
}
|
||||
values.push_back(it->second);
|
||||
if (text != nullptr) {
|
||||
if (! text->empty())
|
||||
*text += ',';
|
||||
if (idx != CacheDictionary::ENUM_UNNAMED)
|
||||
*text += dict.enum_name_at(idx);
|
||||
else
|
||||
*text += raw == ConfigOptionIntsNullable::nil_value() ? std::string("nil") : std::to_string(raw);
|
||||
}
|
||||
}
|
||||
if (! usable)
|
||||
return;
|
||||
@@ -209,6 +218,41 @@ void save_config(cereal::BinaryOutputArchive& ar, const DynamicPrintConfig& conf
|
||||
}
|
||||
}
|
||||
|
||||
// The nullable form of a vector type reads the same bytes as the plain form
|
||||
// and serializes a nil entry as "nil", which a nullable option parses back.
|
||||
static bool has_nullable_form(ConfigOptionType type)
|
||||
{
|
||||
return type == coFloats || type == coInts || type == coPercents || type == coBools || type == coFloatsOrPercents;
|
||||
}
|
||||
|
||||
// Place the value of a key this build types differently from the writer, the
|
||||
// way a JSON profile's text is placed: handle_legacy maps the old spelling (a
|
||||
// bool's 1 onto an enum's enabled) and a bool or enum that still does not
|
||||
// parse is substituted, silently as for a system preset. The parse goes
|
||||
// through a scratch config: set_deserialize_raw creates an option before
|
||||
// parsing into it, so a failed parse must leave nothing behind, and the
|
||||
// placing of one key must not take the whole cache down.
|
||||
static void set_from_text(DynamicPrintConfig& config, const CacheDictionary& dict, uint16_t idx,
|
||||
const std::string& text, ConfigSubstitutionContext& substitutions)
|
||||
{
|
||||
const std::string& key = dict.key_at(idx);
|
||||
DynamicPrintConfig parsed;
|
||||
bool placed = false;
|
||||
try {
|
||||
placed = parsed.set_deserialize_nothrow(key, text, substitutions);
|
||||
} catch (const std::exception&) {
|
||||
placed = false;
|
||||
}
|
||||
if (placed) {
|
||||
config.apply(parsed);
|
||||
return;
|
||||
}
|
||||
if (dict.first_report(idx))
|
||||
// The key and the types only: the value may be a G-code template.
|
||||
BOOST_LOG_TRIVIAL(warning) << "preset cache: dropped " << key << ", written as type " << int(dict.type_at(idx))
|
||||
<< ", which this build cannot read as type " << int(dict.def_at(idx)->type);
|
||||
}
|
||||
|
||||
// `config` null means: read everything, keep nothing.
|
||||
static void read_config(cereal::BinaryInputArchive& ar, DynamicPrintConfig* config, const CacheDictionary& dict)
|
||||
{
|
||||
@@ -216,26 +260,42 @@ static void read_config(cereal::BinaryInputArchive& ar, DynamicPrintConfig* conf
|
||||
ar(cnt);
|
||||
if (config != nullptr)
|
||||
config->clear();
|
||||
// Reused across the loop: constructing a ConfigOptionDef per dropped option
|
||||
// would allocate its strings and vectors for nothing.
|
||||
// Reused across the loop: constructing a ConfigOptionDef per option read by
|
||||
// the writer's type would allocate its strings and vectors for nothing.
|
||||
ConfigOptionDef scratch;
|
||||
ConfigSubstitutionContext substitutions(ForwardCompatibilitySubstitutionRule::EnableSilent);
|
||||
for (uint32_t i = 0; i < cnt; ++ i) {
|
||||
uint16_t idx = 0;
|
||||
ar(idx);
|
||||
if (! dict.valid_key_index(idx))
|
||||
throw std::runtime_error("preset cache: option index past the end of the dictionary");
|
||||
const ConfigOptionType type = dict.type_at(idx);
|
||||
const ConfigOptionDef* def = dict.def_at(idx);
|
||||
const ConfigOptionType type = dict.type_at(idx);
|
||||
const ConfigOptionDef* def = dict.def_at(idx);
|
||||
const bool as_written = def != nullptr && def->type == type;
|
||||
// Built from the bytes where this build defines the key as written.
|
||||
// Otherwise read by the type the writer recorded: dropped where this
|
||||
// build has no such key, the same outcome a JSON profile gets, and
|
||||
// placed from its text, as a JSON profile's value is, where it has the
|
||||
// key under another type.
|
||||
const bool retyped = def != nullptr && ! as_written && config != nullptr;
|
||||
std::string text;
|
||||
std::string* text_out = retyped ? &text : nullptr;
|
||||
if (type == coEnum || type == coEnums) {
|
||||
load_enum_option(ar, type, def, config, dict);
|
||||
} else if (def != nullptr && config != nullptr) {
|
||||
load_enum_option(ar, type, as_written ? def : nullptr, config, dict, text_out);
|
||||
if (! retyped)
|
||||
continue;
|
||||
} else if (as_written && config != nullptr) {
|
||||
config->set_key_value(def->opt_key, def->load_option_from_archive(ar));
|
||||
continue;
|
||||
} else {
|
||||
// Read by the type the writer recorded, then drop: the same outcome
|
||||
// a JSON profile gets for an option this build no longer has.
|
||||
scratch.type = type;
|
||||
std::unique_ptr<ConfigOption> discard(scratch.load_option_from_archive(ar));
|
||||
scratch.type = type;
|
||||
scratch.nullable = has_nullable_form(type);
|
||||
std::unique_ptr<ConfigOption> value(scratch.load_option_from_archive(ar));
|
||||
if (! retyped)
|
||||
continue;
|
||||
text = value->serialize();
|
||||
}
|
||||
set_from_text(*config, dict, idx, text, substitutions);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <cereal/archives/binary.hpp>
|
||||
@@ -61,17 +62,22 @@ public:
|
||||
|
||||
// ---- reading ----
|
||||
|
||||
// The definition an index resolves to in THIS build, or nullptr where the
|
||||
// key is unknown here or is now defined with a different type. A nullptr
|
||||
// entry's value is still read — using type_at(idx), the type the writer
|
||||
// recorded — and then dropped, which is what a JSON profile gets for an
|
||||
// option this build no longer has.
|
||||
// The definition THIS build has for an index's key, or nullptr where the key
|
||||
// is unknown here. type_at(idx) is the type the writer recorded; the value
|
||||
// is read by that type whatever this build's is. With no definition it is
|
||||
// then dropped, which is what a JSON profile gets for an option this build
|
||||
// no longer has; with a definition of another type it is placed as a JSON
|
||||
// profile's text would be (see read_config), so the key is never left at
|
||||
// the collection default while a JSON profile would have mapped it.
|
||||
const ConfigOptionDef* def_at(uint16_t idx) const { return m_defs[idx]; }
|
||||
const std::string& key_at(uint16_t idx) const { return m_keys[idx]; }
|
||||
ConfigOptionType type_at(uint16_t idx) const { return ConfigOptionType(m_types[idx]); }
|
||||
const std::string& enum_name_at(uint16_t idx) const { return m_enum_values[idx]; }
|
||||
// m_defs, not m_keys: only load() sizes it, so this is false for every index
|
||||
// on a dictionary that was collected rather than read.
|
||||
bool valid_key_index(uint16_t idx) const { return size_t(idx) < m_defs.size(); }
|
||||
// True the first time it is asked for an index, false after.
|
||||
bool first_report(uint16_t idx) const { return ! std::exchange(m_reported[idx], char(1)); }
|
||||
bool valid_enum_index(uint16_t idx) const { return size_t(idx) < m_enum_values.size(); }
|
||||
|
||||
// The layout these two agree on is covered by CACHE_VERSION (PresetCacheFormat.cpp);
|
||||
@@ -99,6 +105,10 @@ private:
|
||||
std::unordered_map<std::string, uint16_t> m_enum_index;
|
||||
// Reading, resolved once by load().
|
||||
std::vector<const ConfigOptionDef*> m_defs;
|
||||
// Keys whose value read_config already reported dropping from this file,
|
||||
// so a key set by every preset is logged once, not once per preset. The
|
||||
// entries of one file are read in sequence, never concurrently.
|
||||
mutable std::vector<char> m_reported;
|
||||
};
|
||||
|
||||
// One config, keyed through `dict`. Options print_config_def does not know are
|
||||
|
||||
+7
-13
@@ -2362,19 +2362,13 @@ StringObjectException Print::validate(std::vector<StringObjectException> *warnin
|
||||
// A mixed (virtual) filament always resolves to multiple physical components, which
|
||||
// spiral vase cannot print.
|
||||
const auto &is_mixed = m_config.filament_is_mixed.values;
|
||||
for (const PrintObject *object : m_objects)
|
||||
for (unsigned int ext : object->object_extruders())
|
||||
if (ext < is_mixed.size() && is_mixed[ext])
|
||||
return {L("Spiral (vase) mode does not work when an object contains more than one material."), nullptr, "spiral_mode"};
|
||||
assert(m_objects.size() == 1);
|
||||
const auto all_regions = m_objects.front()->all_regions();
|
||||
if (all_regions.size() > 1) {
|
||||
// Orca: make sure regions are not compatible
|
||||
if (std::any_of(all_regions.begin() + 1, all_regions.end(), [this, ra = all_regions.front()](const auto rb) {
|
||||
return !Layer::is_perimeter_compatible(*this, ra, rb);
|
||||
})) {
|
||||
for (const PrintObject *object : m_objects) {
|
||||
const auto used_filament_ids = object->object_extruders();
|
||||
if (used_filament_ids.size() > 1 ||
|
||||
std::any_of(used_filament_ids.begin(), used_filament_ids.end(), [&is_mixed](unsigned int filament_id) {
|
||||
return filament_id < is_mixed.size() && is_mixed[filament_id];
|
||||
}))
|
||||
return {L("Spiral (vase) mode does not work when an object contains more than one material."), nullptr, "spiral_mode"};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2440,7 +2434,7 @@ StringObjectException Print::validate(std::vector<StringObjectException> *warnin
|
||||
print_object.model_object(),
|
||||
""
|
||||
};
|
||||
} else if (effective_max_z > this->config().printable_height + EPSILON) {
|
||||
} else if (compensated_max_z > this->config().printable_height + EPSILON) {
|
||||
return StringObjectException{
|
||||
last_layer_below_max ?
|
||||
Slic3r::format(_u8L("While the object %1% itself fits the build volume, its last layer exceeds the maximum build volume height."), print_object.model_object()->name) +
|
||||
|
||||
@@ -427,10 +427,12 @@ public:
|
||||
};
|
||||
|
||||
LayerRanges() = default;
|
||||
LayerRanges(const t_layer_config_ranges &in) { this->assign(in); }
|
||||
LayerRanges(const t_layer_config_ranges &in, double shrinkage_compensation_z) { this->assign(in, shrinkage_compensation_z); }
|
||||
|
||||
// Convert input config ranges into continuous non-overlapping sorted vector of intervals and their configs.
|
||||
void assign(const t_layer_config_ranges &in) {
|
||||
// The input ranges are uncompensated print heights, the intervals are scaled by the Z shrinkage compensation
|
||||
// like the PrintObject trafo the regions are generated in.
|
||||
void assign(const t_layer_config_ranges &in, double shrinkage_compensation_z) {
|
||||
m_ranges.clear();
|
||||
m_ranges.reserve(in.size());
|
||||
// Input ranges are sorted lexicographically. First range trims the other ranges.
|
||||
@@ -454,6 +456,11 @@ public:
|
||||
m_ranges.back().layer_height_range.second = DBL_MAX;
|
||||
else
|
||||
m_ranges.push_back({ t_layer_height_range(m_ranges.back().layer_height_range.second, DBL_MAX) });
|
||||
for (LayerRange &range : m_ranges) {
|
||||
range.layer_height_range.first *= shrinkage_compensation_z;
|
||||
if (range.layer_height_range.second != DBL_MAX)
|
||||
range.layer_height_range.second *= shrinkage_compensation_z;
|
||||
}
|
||||
}
|
||||
|
||||
const DynamicPrintConfig* config(const t_layer_height_range &range) const {
|
||||
@@ -1063,6 +1070,12 @@ static PrintObjectRegions* generate_print_object_regions(
|
||||
all_regions.clear();
|
||||
|
||||
bool reuse_old = print_object_regions_old && !print_object_regions_old->layer_ranges.empty();
|
||||
if (reuse_old && ! std::equal(model_layer_ranges.begin(), model_layer_ranges.end(), layer_ranges_regions.begin(), layer_ranges_regions.end(),
|
||||
[](const LayerRanges::LayerRange &range, const PrintObjectRegions::LayerRangeRegions &r) { return range.layer_height_range == r.layer_height_range; })) {
|
||||
// The ranges carry the Z shrinkage compensation, which may have changed together with the volumes.
|
||||
out->clear();
|
||||
reuse_old = false;
|
||||
}
|
||||
|
||||
if (reuse_old) {
|
||||
// Reuse old bounding boxes of some ModelVolumes and their ranges.
|
||||
@@ -2162,10 +2175,12 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||
if (print_object_regions == nullptr || model_object_status.print_object_regions_status != ModelObjectStatus::PrintObjectRegionsStatus::Valid) {
|
||||
// Layer ranges with their associated configurations. Remove overlaps between the ranges
|
||||
// and create the regions from scratch.
|
||||
// A belt printer slices in the rotated frame, which the ranges do not follow (see slices_to_regions()),
|
||||
// so they stay as they are there.
|
||||
print_object_regions = generate_print_object_regions(
|
||||
print_object_regions,
|
||||
print_object.model_object()->volumes,
|
||||
LayerRanges(print_object.model_object()->layer_config_ranges),
|
||||
LayerRanges(print_object.model_object()->layer_config_ranges, m_config.belt_printer.value ? 1. : this->shrinkage_compensation().z()),
|
||||
m_default_region_config,
|
||||
model_object_status.print_instances.front().trafo,
|
||||
num_extruders ,
|
||||
|
||||
@@ -4467,6 +4467,7 @@ void PrintObject::update_slicing_parameters()
|
||||
coordf_t object_height = this->model_object()->max_z();
|
||||
BeltTransformPipeline::BeltFloorParams belt_floor;
|
||||
const auto &pcfg = this->print()->config();
|
||||
const Vec3d shrinkage_compensation = this->print()->shrinkage_compensation();
|
||||
if (pcfg.belt_printer.value) {
|
||||
// The box of the mesh in the frame it is sliced in: XY centred and Z as
|
||||
// placed on the bed (trafo_centered()). raw_bounding_box() has the
|
||||
@@ -4479,12 +4480,14 @@ void PrintObject::update_slicing_parameters()
|
||||
for (const ModelVolume *v : this->model_object()->volumes)
|
||||
if (v->is_model_part())
|
||||
bb.merge(v->mesh().transformed_bounding_box(trafo * v->get_matrix()));
|
||||
auto hr = BeltTransformPipeline::compute_belt_height_and_floor(pcfg, bb, object_height);
|
||||
object_height = hr.object_height;
|
||||
// trafo() already carries the shrinkage compensation, so the belt height is
|
||||
// compensated, while create_from_config() expects object_height without it.
|
||||
auto hr = BeltTransformPipeline::compute_belt_height_and_floor(pcfg, bb, object_height * shrinkage_compensation.z());
|
||||
object_height = hr.object_height / shrinkage_compensation.z();
|
||||
belt_floor = hr.floor_params;
|
||||
}
|
||||
m_slicing_params = SlicingParameters::create_from_config(pcfg, m_config, object_height,
|
||||
this->object_extruders(), this->print()->shrinkage_compensation());
|
||||
this->object_extruders(), shrinkage_compensation);
|
||||
// Populate belt floor parameters into slicing params for support clipping.
|
||||
m_slicing_params.belt_floor_shear_factor = belt_floor.shear_factor;
|
||||
m_slicing_params.belt_floor_from_axis = belt_floor.from_axis;
|
||||
|
||||
@@ -228,26 +228,31 @@ static std::vector<VolumeSlices> slice_volumes_inner(
|
||||
MeshSlicingParamsEx params { params_base };
|
||||
if (! model_volume->is_negative_volume())
|
||||
params.extra_offset = extra_offset;
|
||||
if (layer_ranges.size() == 1) {
|
||||
if (const PrintObjectRegions::LayerRangeRegions &layer_range = layer_ranges.front(); layer_range.has_volume(model_volume->id())) {
|
||||
if (model_volume->is_model_part() && print_config.spiral_mode) {
|
||||
auto it = std::find_if(layer_range.volume_regions.begin(), layer_range.volume_regions.end(),
|
||||
[model_volume](const auto &slice){ return model_volume == slice.model_volume; });
|
||||
if (model_volume->is_model_part() && print_config.spiral_mode) {
|
||||
if (const auto layer_range_it = std::find_if(layer_ranges.begin(), layer_ranges.end(),
|
||||
[model_volume](const auto &layer_range) { return layer_range.has_volume(model_volume->id()); });
|
||||
layer_range_it != layer_ranges.end()) {
|
||||
if (const auto volume_region_it = std::find_if(layer_range_it->volume_regions.begin(), layer_range_it->volume_regions.end(),
|
||||
[model_volume](const auto &slice) { return model_volume == slice.model_volume; });
|
||||
volume_region_it != layer_range_it->volume_regions.end()) {
|
||||
params.mode = MeshSlicingParams::SlicingMode::PositiveLargestContour;
|
||||
// Slice the bottom layers with SlicingMode::Regular.
|
||||
// This needs to be in sync with LayerRegion::make_perimeters() spiral_mode!
|
||||
const PrintRegionConfig ®ion_config = it->region->config();
|
||||
const PrintRegionConfig ®ion_config = volume_region_it->region->config();
|
||||
params.slicing_mode_normal_below_layer = size_t(region_config.bottom_shell_layers.value);
|
||||
for (; params.slicing_mode_normal_below_layer < zs.size() && zs[params.slicing_mode_normal_below_layer] < region_config.bottom_shell_thickness - EPSILON;
|
||||
++ params.slicing_mode_normal_below_layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (layer_ranges.size() == 1) {
|
||||
if (const PrintObjectRegions::LayerRangeRegions &layer_range = layer_ranges.front(); layer_range.has_volume(model_volume->id())) {
|
||||
out.push_back({
|
||||
model_volume->id(),
|
||||
slice_volume(*model_volume, zs, params, throw_on_cancel_callback)
|
||||
});
|
||||
}
|
||||
} else {
|
||||
assert(! print_config.spiral_mode);
|
||||
slicing_ranges.clear();
|
||||
for (const PrintObjectRegions::LayerRangeRegions &layer_range : layer_ranges)
|
||||
if (layer_range.has_volume(model_volume->id()))
|
||||
|
||||
@@ -255,7 +255,7 @@ std::vector<coordf_t> layer_height_profile_from_ranges(
|
||||
// The height ranges are sorted lexicographically by low / high layer boundaries.
|
||||
for (t_layer_config_ranges::const_iterator it_range = layer_config_ranges.begin(); it_range != layer_config_ranges.end(); ++ it_range) {
|
||||
coordf_t lo = it_range->first.first;
|
||||
coordf_t hi = std::min(it_range->first.second, slicing_params.object_print_z_height());
|
||||
coordf_t hi = std::min(it_range->first.second, slicing_params.object_print_z_uncompensated_height());
|
||||
coordf_t height = it_range->second.option("layer_height")->getFloat();
|
||||
if (! ranges_non_overlapping.empty())
|
||||
// Trim current low with the last high.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
|
||||
#define AMS_SETTING_DEF_COLOUR wxColour(255, 255, 255)
|
||||
#define AMS_SETTING_GREY800 wxColour(50, 58, 61)
|
||||
@@ -130,7 +130,7 @@ private:
|
||||
std::weak_ptr<DevAmsSystemFirmwareSwitch> m_ams_firmware_switch;
|
||||
|
||||
int m_ams_firmware_current_idx{ -1 };
|
||||
std::unordered_map<int, DevAmsSystemFirmwareSwitch::DevAmsSystemFirmware> m_ams_firmwares;
|
||||
std::map<int, DevAmsSystemFirmwareSwitch::DevAmsSystemFirmware> m_ams_firmwares;
|
||||
|
||||
// widgets
|
||||
AMSSetting* m_setting_dlg;
|
||||
|
||||
@@ -76,7 +76,7 @@ CloneDialog::CloneDialog(wxWindow *parent)
|
||||
// Keep pointer to OK button so we can trigger it manually on Enter.
|
||||
Button *ok_btn = dlg_btns->GetOK();
|
||||
|
||||
dlg_btns->GetFIRST()->SetToolTip(_L("Fill bed with copies"));
|
||||
dlg_btns->GetFIRST()->SetToolTip(_L("Fill bed with instances"));
|
||||
dlg_btns->GetFIRST()->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
m_plater->fill_bed_with_instances();
|
||||
EndModal(wxID_OK);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <unordered_map> // Orca: for m_firmwares / GetSuppotedFirmwares() — the unordered_map AMSSetting.cpp mirrors and iterates
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "DevCtrl.h"
|
||||
|
||||
@@ -78,7 +78,8 @@ public:
|
||||
|
||||
DevAmsSystemIdx GetCurrentFirmwareIdxSel() const { return m_current_firmware_sel.m_firmare_idx; };
|
||||
DevAmsSystemIdx GetCurrentFirmwareIdxRun() const { return m_current_firmware_run.m_firmare_idx; };
|
||||
std::unordered_map<int, DevAmsSystemFirmware> GetSuppotedFirmwares() const { return m_firmwares;}; // Orca: unordered (mirrored by AMSSetting.cpp)
|
||||
// Ordered by firmware id: the AMS type combo lists these in order and uses the id as its row index.
|
||||
std::map<int, DevAmsSystemFirmware> GetSuppotedFirmwares() const { return m_firmwares;};
|
||||
|
||||
bool IsSwitching() const { return m_status == "SWITCHING";};
|
||||
bool IsIdle() const { return m_status == "IDLE";};
|
||||
@@ -97,7 +98,7 @@ private:
|
||||
|
||||
DevAmsSystemFirmware m_current_firmware_run;
|
||||
DevAmsSystemFirmware m_current_firmware_sel;
|
||||
std::unordered_map<int, DevAmsSystemFirmware> m_firmwares; // Orca: unordered (mirrored by AMSSetting.cpp)
|
||||
std::map<int, DevAmsSystemFirmware> m_firmwares;
|
||||
|
||||
DevCtrlInfo m_ctrl_switching;
|
||||
};
|
||||
|
||||
@@ -4326,7 +4326,9 @@ void GUI_App::set_live_printer_agent(std::shared_ptr<IPrinterAgent> agent)
|
||||
}
|
||||
|
||||
m_agent->set_printer_agent(agent);
|
||||
sidebar().update_all_preset_comboboxes();
|
||||
// Before mainframe is shown this runs from load_current_presets(), right after
|
||||
// printer refilled the filament combos; no printer is connected yet, so they would not change
|
||||
sidebar().update_all_preset_comboboxes(mainframe == nullptr || mainframe->IsShown());
|
||||
}
|
||||
|
||||
std::string GUI_App::resolve_printer_agent_id(const std::string& stored_id) const
|
||||
|
||||
@@ -1189,7 +1189,8 @@ void MenuFactory::append_menu_item_change_extruder(wxMenu* menu)
|
||||
void MenuFactory::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu)
|
||||
{
|
||||
append_menu_item(menu, wxID_ANY, _L("Scale to build volume"), _L("Scale an object to fit the build volume"),
|
||||
[](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu);
|
||||
[](wxCommandEvent&) { plater()->scale_selection_to_fit_print_volume(); }, "", menu,
|
||||
[]() { return plater()->can_scale_to_print_volume(); }, m_parent);
|
||||
}
|
||||
|
||||
void MenuFactory::append_menu_items_flush_options(wxMenu* menu, size_t pos)
|
||||
|
||||
@@ -347,11 +347,13 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||
//Bind(wxCUSTOMEVT_LAST_VOLUME_IS_DELETED, [this](wxCommandEvent& e) { last_volume_is_deleted(e.GetInt()); });
|
||||
|
||||
Bind(wxEVT_SIZE, ([this](wxSizeEvent &e) {
|
||||
if (m_last_size == this->GetSize()) {
|
||||
// ORCA: compare client size instead window size
|
||||
// Name column stays wide that shows horizontal scrollbar when vertical scrollbar (dis)appears
|
||||
if (m_last_size == this->GetClientSize()) {
|
||||
e.Skip();
|
||||
return;
|
||||
} else {
|
||||
m_last_size = this->GetSize();
|
||||
m_last_size = this->GetClientSize();
|
||||
}
|
||||
|
||||
update_name_column_width();
|
||||
@@ -361,7 +363,7 @@ ObjectList::ObjectList(wxWindow* parent) :
|
||||
|
||||
e.Skip();
|
||||
}));
|
||||
m_last_size = this->GetSize();
|
||||
m_last_size = this->GetClientSize();
|
||||
}
|
||||
|
||||
ObjectList::~ObjectList()
|
||||
@@ -697,12 +699,14 @@ void ObjectList::set_tooltip_for_item(const wxPoint& pt)
|
||||
tooltip = _(L("Click the icon to reset all settings of the object"));
|
||||
#endif //__WXMSW__
|
||||
}
|
||||
else if (col->GetModelColumn() == (unsigned int)colPrint)
|
||||
else if (col->GetModelColumn() == (unsigned int)colPrint) {
|
||||
if (node->IsPrintable() != piUndef)
|
||||
#ifdef __WXOSX__
|
||||
tooltip = _(L("Right click the icon to drop the object printable property"));
|
||||
tooltip = _(L("Right click the icon to drop the object printable property"));
|
||||
#else
|
||||
tooltip = _(L("Click the icon to toggle printable properties of the object"));
|
||||
tooltip = _(L("Click the icon to toggle printable properties of the object"));
|
||||
#endif //__WXMSW__
|
||||
}
|
||||
// BBS
|
||||
else if (col->GetModelColumn() == (unsigned int)colSupportPaint) {
|
||||
if (node->HasSupportPainting())
|
||||
|
||||
@@ -2582,10 +2582,6 @@ void GLGizmoTextureDisplacement::update_uv_editor()
|
||||
{
|
||||
Plater *plater = wxGetApp().plater();
|
||||
UVEditorCanvas *uv_canvas = plater->get_uv_editor_canvas();
|
||||
if (uv_canvas == nullptr)
|
||||
return;
|
||||
// Wired on every call rather than with the first unwrap: Unwrap itself is one of the pane's commands.
|
||||
uv_canvas->set_command_callback([this](UVEditorCanvas::Command cmd, float value) { on_uv_command(int(cmd), value); });
|
||||
|
||||
const ModelVolume *mv = texture_volume();
|
||||
TextureDisplacementLayer *layer = active_layer();
|
||||
@@ -2600,6 +2596,15 @@ void GLGizmoTextureDisplacement::update_uv_editor()
|
||||
plater->show_uv_editor(false);
|
||||
return;
|
||||
}
|
||||
if (uv_canvas == nullptr) {
|
||||
// The pane does not exist yet: show_uv_editor() builds it after this frame. Run again right
|
||||
// after that - both are queued on the plater, so they run in this order.
|
||||
plater->show_uv_editor(true);
|
||||
plater->CallAfter([this]() { update_uv_editor(); });
|
||||
return;
|
||||
}
|
||||
// Wired on every call rather than with the first unwrap: Unwrap itself is one of the pane's commands.
|
||||
uv_canvas->set_command_callback([this](UVEditorCanvas::Command cmd, float value) { on_uv_command(int(cmd), value); });
|
||||
|
||||
// A vertex/edge edit committing (or an undo reverting one) changes the per-vertex UV overrides
|
||||
// without going through the Unwrap button. Detect that and force a re-solve, so the pane's geometry
|
||||
|
||||
@@ -159,6 +159,7 @@
|
||||
#include <cassert>
|
||||
#include <wx/display.h>
|
||||
#include <wx/window.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
|
||||
using json = nlohmann::json;
|
||||
@@ -1214,7 +1215,11 @@ void MainFrame::update_layout()
|
||||
|
||||
wxBusyCursor busy;
|
||||
|
||||
Freeze();
|
||||
// While the main frame is being created nothing is on screen, and a freeze would only walk
|
||||
// every child window to block redraws that cannot happen.
|
||||
wxWindowUpdateLocker no_updates;
|
||||
if (IsShownOnScreen())
|
||||
no_updates.Lock(this);
|
||||
|
||||
// Remove old settings
|
||||
if (m_layout != ESettingsLayout::Unknown)
|
||||
@@ -1306,7 +1311,6 @@ void MainFrame::update_layout()
|
||||
#endif
|
||||
|
||||
Layout();
|
||||
Thaw();
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
@@ -1660,14 +1664,6 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
// get it — otherwise a Bambu user sees two Device tabs, one of them permanently empty.
|
||||
const bool want_web_device_tab = use_printer_agents && wxGetApp().preset_bundle != nullptr &&
|
||||
!wxGetApp().preset_bundle->use_bbl_device_tab();
|
||||
// An agent whose printers have nothing for the native Device and Calibration tabs leaves the web page as the only Device tab
|
||||
bool want_native_device_tabs = true;
|
||||
if (want_web_device_tab) {
|
||||
const std::string agent_id = wxGetApp().resolve_printer_agent_id(
|
||||
wxGetApp().preset_bundle->printers.get_edited_preset().config.opt_string("printer_agent"));
|
||||
const PrinterAgentInfo* agent_info = NetworkAgentFactory::get_printer_agent_info(agent_id);
|
||||
want_native_device_tabs = agent_info == nullptr || agent_info->native_device_tab;
|
||||
}
|
||||
|
||||
// Remove the extra page before switching to any layout that shouldn't have it.
|
||||
if (!want_web_device_tab) {
|
||||
@@ -1678,16 +1674,7 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
}
|
||||
|
||||
if (use_printer_agents) {
|
||||
if (!want_native_device_tabs) {
|
||||
if ((idx = m_tabpanel->FindPage(m_monitor_page)) != wxNOT_FOUND) {
|
||||
m_monitor_page->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
if ((idx = m_tabpanel->FindPage(m_calibration_page)) != wxNOT_FOUND) {
|
||||
m_calibration_page->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
}
|
||||
} else if (!m_monitor_page->in_book()) {
|
||||
if (!m_monitor_page->in_book()) {
|
||||
if ((idx = m_tabpanel->FindPage(m_printer_view_page)) != wxNOT_FOUND) {
|
||||
m_printer_view_page->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
@@ -1707,29 +1694,20 @@ void MainFrame::show_device(bool should_use_native) {
|
||||
TAB_ID_MULTI_DEVICE, m_multi_machine_page, _L("Multi-device"), "tab_multi_active");
|
||||
}
|
||||
}
|
||||
if (want_native_device_tabs && !m_calibration_page->in_book()) {
|
||||
if (!m_calibration_page->in_book()) {
|
||||
m_calibration_page->Show(false);
|
||||
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_PROJECT}), TAB_ID_CALIBRATION, m_calibration_page,
|
||||
_L("Calibration"), "tab_calibration_active");
|
||||
}
|
||||
|
||||
if (want_web_device_tab) {
|
||||
// Without the native Device tab the web page takes its id, so every way to the Device tab leads here
|
||||
const char* id = want_native_device_tabs ? TAB_ID_MONITOR_WEB : TAB_ID_MONITOR;
|
||||
const wxString label = want_native_device_tabs ? _L("Device (Web)") : _L("Device");
|
||||
idx = m_tabpanel->FindPage(m_printer_view_page);
|
||||
if (idx != wxNOT_FOUND && m_tabpanel->FindPageByName(id) != idx) {
|
||||
if ((idx = m_tabpanel->FindPage(m_printer_view_page)) == wxNOT_FOUND) {
|
||||
m_printer_view_page->Show(false);
|
||||
m_tabpanel->RemovePage(idx);
|
||||
idx = wxNOT_FOUND;
|
||||
}
|
||||
if (idx == wxNOT_FOUND) {
|
||||
m_printer_view_page->Show(false);
|
||||
// Immediately right of the native Device tab, or of Preview without it, not at the end of the tab bar.
|
||||
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR, TAB_ID_PREVIEW}), id, m_printer_view_page, label,
|
||||
"tab_monitor_active");
|
||||
// Immediately right of the native Device tab, not at the end of the tab bar.
|
||||
m_tabpanel->InsertPage(m_tabpanel->PositionAfter({TAB_ID_MONITOR}), TAB_ID_MONITOR_WEB,
|
||||
m_printer_view_page, _L("Device (Web)"), "tab_monitor_active");
|
||||
} else {
|
||||
m_tabpanel->SetPageText(idx, label);
|
||||
m_tabpanel->SetPageText(idx, _L("Device (Web)"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+115
-65
@@ -191,6 +191,8 @@
|
||||
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "I18N.hpp"
|
||||
#include "Lazy.hpp"
|
||||
#include "Shortcuts.hpp"
|
||||
#include "GUI_ObjectList.hpp"
|
||||
#ifdef __WXGTK__
|
||||
@@ -3801,7 +3803,7 @@ void Sidebar::remove_unused_filament_combos(const size_t current_extruder_count)
|
||||
}
|
||||
}
|
||||
|
||||
void Sidebar::update_all_preset_comboboxes()
|
||||
void Sidebar::update_all_preset_comboboxes(bool update_filament_combos)
|
||||
{
|
||||
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
|
||||
const auto print_tech = preset_bundle.printers.get_edited_preset().printer_technology();
|
||||
@@ -3914,7 +3916,7 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
//p->combo_printer->update();
|
||||
// Update the filament choosers to only contain the compatible presets, update the color preview,
|
||||
// update the dirty flags.
|
||||
if (print_tech == ptFFF) {
|
||||
if (print_tech == ptFFF && update_filament_combos) {
|
||||
for (PlaterPresetComboBox* cb : p->combos_filament)
|
||||
cb->update();
|
||||
}
|
||||
@@ -3957,8 +3959,11 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < filament_cnt; i++)
|
||||
p->combos_filament[i]->update();
|
||||
// Preset change must still refill the combos. Refill not needed before the mainframe shown.
|
||||
// load_current_presets() loads the printer tab right after this and refills them anyway
|
||||
if (wxGetApp().mainframe == nullptr || wxGetApp().mainframe->IsShown())
|
||||
for (size_t i = 0; i < filament_cnt; i++)
|
||||
p->combos_filament[i]->update();
|
||||
|
||||
update_dynamic_filament_list();
|
||||
break;
|
||||
@@ -4337,7 +4342,10 @@ void Sidebar::update_mixed_filament_list()
|
||||
auto* plater = dynamic_cast<Plater*>(GetParent());
|
||||
if (!plater) return;
|
||||
|
||||
wxWindowUpdateLocker noUpdates(this);
|
||||
// Freezing walks every child of the sidebar, a few ms each time; a hidden sidebar has nothing to repaint.
|
||||
wxWindowUpdateLocker noUpdates;
|
||||
if (IsShownOnScreen())
|
||||
noUpdates.Lock(this);
|
||||
|
||||
const wxColour mc_bg = StateColor::darkModeColorFor(*wxWHITE);
|
||||
const wxColour mc_border = StateColor::darkModeColorFor(wxColour("#DBDBDB")); // same color with filament combo box border
|
||||
@@ -5738,7 +5746,9 @@ void Sidebar::on_filament_count_change(size_t num_filaments)
|
||||
if (choices.size() == 1 || num_physical == 1)
|
||||
choices[0]->GetDropDown().Invalidate();
|
||||
|
||||
wxWindowUpdateLocker noUpdates_scrolled_panel(this);
|
||||
wxWindowUpdateLocker noUpdates_scrolled_panel;
|
||||
if (IsShownOnScreen())
|
||||
noUpdates_scrolled_panel.Lock(this);
|
||||
|
||||
size_t i = choices.size();
|
||||
while (i < num_physical)
|
||||
@@ -5749,8 +5759,12 @@ void Sidebar::on_filament_count_change(size_t num_filaments)
|
||||
choices.push_back(choice);
|
||||
|
||||
// initialize selection
|
||||
choice->update();
|
||||
choice->SetSelection(last_selection);
|
||||
// While the main frame is still being created the list is left empty:
|
||||
// load_current_presets() fills every filament combo once the window is built.
|
||||
if (wxGetApp().mainframe != nullptr) {
|
||||
choice->update();
|
||||
choice->SetSelection(last_selection);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
@@ -7272,11 +7286,12 @@ struct Plater::priv
|
||||
AssembleView* assemble_view { nullptr };
|
||||
// Docked/resizable 2D pane showing GLGizmoTextureDisplacement's LSCM unwrap of a painted
|
||||
// patch; a sibling AUI pane alongside "sidebar"/"main", not part of the view3D/preview/
|
||||
// assemble_view sizer - see its registration below and Plater::get_uv_editor_canvas(). The
|
||||
// pane hosts the panel (toolbar + canvas + status line); uv_editor_canvas is its inner canvas,
|
||||
// cached so the gizmo can reach it directly.
|
||||
UVEditorPanel* uv_editor_panel { nullptr };
|
||||
UVEditorCanvas* uv_editor_canvas { nullptr };
|
||||
// assemble_view sizer - see make_uv_editor() and Plater::get_uv_editor_canvas(). The
|
||||
// pane hosts the panel (toolbar + canvas + status line). Built by the first
|
||||
// show_uv_editor(true), never prebuilt.
|
||||
Lazy<UVEditorPanel> uv_editor{ "uv_editor", -1, [this] { return make_uv_editor(); } };
|
||||
// Builds the pane hidden and adds it to m_aui_mgr at its saved place.
|
||||
UVEditorPanel* make_uv_editor();
|
||||
bool first_enter_assemble{ true };
|
||||
std::unique_ptr<NotificationManager> notification_manager;
|
||||
|
||||
@@ -7293,7 +7308,8 @@ struct Plater::priv
|
||||
// UIThreadWorker can be used as a replacement for BoostThreadWorker if
|
||||
// no additional worker threads are desired (useful for debugging or profiling)
|
||||
PlaterWorker<BoostThreadWorker> m_worker;
|
||||
SLAImportDialog * m_sla_import_dlg;
|
||||
// Built on the first import, never prebuilt.
|
||||
Lazy<SLAImportDialog> m_sla_import_dlg{ "sla_import_dialog", -1, [this] { return new SLAImportDialog{ q }; } };
|
||||
|
||||
int m_job_prepare_state;
|
||||
|
||||
@@ -7876,7 +7892,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
, sidebar(new Sidebar(q))
|
||||
, notification_manager(std::make_unique<NotificationManager>(q))
|
||||
, m_worker{q, std::make_unique<NotificationProgressIndicator>(notification_manager.get()), "ui_worker"}
|
||||
, m_sla_import_dlg{new SLAImportDialog{q}}
|
||||
, m_job_prepare_state(Job::JobPrepareState::PREPARE_STATE_DEFAULT)
|
||||
, delayed_scene_refresh(false)
|
||||
, collapse_toolbar(GLToolbar::Normal, "Collapse")
|
||||
@@ -7969,24 +7984,13 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
// Orca: Make sidebar dockable
|
||||
m_aui_mgr.AddPane(sidebar, AuiMgr::sidebar_pane_info());
|
||||
|
||||
// UV editor pane for GLGizmoTextureDisplacement's LSCM unwrap preview - a resizable/dockable
|
||||
// sibling of "sidebar"/"main" like everything else registered on this same AUI manager, not a
|
||||
// change to the view3D/preview/assemble_view sizer above. Hidden by default: only relevant
|
||||
// while that gizmo is active with a layer using the "Unwrap (LSCM)" projection method (see
|
||||
// Plater::show_uv_editor()), so it stays out of the way of everyone else's window layout.
|
||||
uv_editor_panel = new UVEditorPanel(q);
|
||||
uv_editor_canvas = uv_editor_panel->canvas();
|
||||
m_aui_mgr.AddPane(uv_editor_panel, wxAuiPaneInfo()
|
||||
.Name("uv_editor")
|
||||
.Caption(_L("UV Editor"))
|
||||
.Right()
|
||||
.Hide()
|
||||
.BestSize(wxSize(40 * wxGetApp().em_unit(), 40 * wxGetApp().em_unit())));
|
||||
// The UV editor pane is added by make_uv_editor().
|
||||
// Closing the pane with its own X has to reach the gizmo, or its next update would simply show the pane again.
|
||||
q->Bind(wxEVT_AUI_PANE_CLOSE, [this](wxAuiManagerEvent &evt) {
|
||||
evt.Skip();
|
||||
if (evt.GetPane() != nullptr && evt.GetPane()->window == uv_editor_panel && uv_editor_canvas != nullptr)
|
||||
uv_editor_canvas->run_command(UVEditorCanvas::Command::PaneClosed);
|
||||
UVEditorPanel* panel = uv_editor.get();
|
||||
if (panel != nullptr && evt.GetPane() != nullptr && evt.GetPane()->window == panel)
|
||||
panel->canvas()->run_command(UVEditorCanvas::Command::PaneClosed);
|
||||
});
|
||||
|
||||
auto* panel_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
@@ -8021,7 +8025,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
#ifdef __WXGTK__
|
||||
layout = sanitize_window_layout_for_wayland(layout, &removed_floating_state);
|
||||
#endif
|
||||
|
||||
// Panes that don't exist yet (uv_editor, dock panes) are skipped here;
|
||||
// make_uv_editor() and add_dock_pane() read their entries from the saved layout when they are built.
|
||||
if (!m_aui_mgr.LoadPerspective(layout, false)) {
|
||||
BOOST_LOG_TRIVIAL(warning) << "Failed to restore saved window layout";
|
||||
m_aui_mgr.LoadPerspective(m_default_window_layout, false);
|
||||
@@ -8029,13 +8034,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
BOOST_LOG_TRIVIAL(info) << "Removed floating AUI state from saved window layout for Wayland";
|
||||
}
|
||||
|
||||
// The UV editor is a transient, gizmo-driven pane (see show_uv_editor()); a saved layout
|
||||
// from a session that happened to close with it open would otherwise restore it visible on
|
||||
// startup, with nothing painted in it. Force it hidden here so it only ever appears when the
|
||||
// texture-displacement gizmo asks for it.
|
||||
if (wxAuiPaneInfo &uv_pane = m_aui_mgr.GetPane("uv_editor"); uv_pane.IsOk())
|
||||
uv_pane.Hide();
|
||||
|
||||
sidebar_layout.is_collapsed = !sidebar.IsShown();
|
||||
}
|
||||
|
||||
@@ -10924,6 +10922,12 @@ void Plater::priv::reset(bool apply_presets_change, bool reload_presets)
|
||||
sidebar.Show();
|
||||
}
|
||||
auto layout = m_aui_mgr.SavePerspective();
|
||||
// The UV editor pane is only built when first used; keep its saved place from an earlier session.
|
||||
if (!uv_editor.built()) {
|
||||
const std::string kept = aui_pane_layout_entry(wxGetApp().app_config->get("window_layout"), "uv_editor");
|
||||
if (!kept.empty())
|
||||
layout += wxString::FromUTF8(kept) + "|";
|
||||
}
|
||||
wxGetApp().app_config->set("window_layout", layout.utf8_string());
|
||||
}
|
||||
}
|
||||
@@ -13880,6 +13884,34 @@ void Plater::priv::on_action_print_plate_from_sdcard(SimpleEvent&)
|
||||
open_machine_select_dialog(0, PrintFromType::FROM_SDCARD_VIEW);
|
||||
}
|
||||
|
||||
UVEditorPanel* Plater::priv::make_uv_editor()
|
||||
{
|
||||
auto* panel = new UVEditorPanel(q);
|
||||
// AddPane() leaves the window's visibility alone; the next m_aui_mgr.Update() shows it with the pane.
|
||||
panel->Hide();
|
||||
#ifdef _MSW_DARK_MODE
|
||||
// Built after MainFrame gave the window its dark colours, so it needs its own.
|
||||
wxGetApp().UpdateDarkUIWin(panel);
|
||||
#endif
|
||||
wxAuiPaneInfo pane = wxAuiPaneInfo()
|
||||
.Name("uv_editor")
|
||||
.Right()
|
||||
.BestSize(wxSize(40 * wxGetApp().em_unit(), 40 * wxGetApp().em_unit()));
|
||||
// The window layout was restored before this pane existed, so take its saved place from there.
|
||||
if (const std::string saved = aui_pane_layout_entry(wxGetApp().app_config->get("window_layout"), "uv_editor"); !saved.empty()) {
|
||||
wxString entry = wxString::FromUTF8(saved);
|
||||
#ifdef __WXGTK__
|
||||
entry = sanitize_window_layout_for_wayland(entry);
|
||||
#endif
|
||||
m_aui_mgr.LoadPaneInfo(entry, pane);
|
||||
}
|
||||
// After LoadPaneInfo(), which also restores the caption saved in another UI language, and
|
||||
// hidden even if the layout was saved with it open: only the gizmo shows it.
|
||||
pane.Caption(_L("UV Editor")).Hide();
|
||||
m_aui_mgr.AddPane(panel, pane);
|
||||
return panel;
|
||||
}
|
||||
|
||||
void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
||||
{
|
||||
// Ignore event raised by child controls
|
||||
@@ -13901,12 +13933,7 @@ void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
||||
const bool use_printer_agents = wxGetApp().app_config->get_bool("use_printer_agents");
|
||||
const bool use_native_device_tab = wxGetApp().preset_bundle &&
|
||||
(wxGetApp().preset_bundle->use_bbl_device_tab() || use_printer_agents);
|
||||
// Pointer test, not a name lookup: in printer-agents mode this page is TAB_ID_MONITOR_WEB
|
||||
// while the native Device tab holds TAB_ID_MONITOR, and in legacy-web mode, or for an agent
|
||||
// without the native tab, it holds TAB_ID_MONITOR itself.
|
||||
const bool selecting_web_device_tab = main_frame->m_printer_view_page &&
|
||||
main_frame->m_tabpanel->GetPage(new_sel) == main_frame->m_printer_view_page;
|
||||
if (use_native_device_tab && new_name == TAB_ID_MONITOR && !selecting_web_device_tab) {
|
||||
if (use_native_device_tab && new_name == TAB_ID_MONITOR) {
|
||||
// BBL network module is only required for BBL-vendor printers.
|
||||
// Non-BBL Python plugins (e.g. moonraker) drive the Device tab without it.
|
||||
if (!use_printer_agents && wxGetApp().preset_bundle->is_bbl_vendor() && !Slic3r::NetworkAgent::is_network_module_loaded()) {
|
||||
@@ -13918,6 +13945,11 @@ void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Pointer test, not a name lookup: in printer-agents mode this page is TAB_ID_MONITOR_WEB
|
||||
// while the native Device tab holds TAB_ID_MONITOR, and in legacy-web mode it holds
|
||||
// TAB_ID_MONITOR itself.
|
||||
const bool selecting_web_device_tab = main_frame->m_printer_view_page &&
|
||||
main_frame->m_tabpanel->GetPage(new_sel) == main_frame->m_printer_view_page;
|
||||
if (selecting_web_device_tab) {
|
||||
// Use the selected discovered machine when the preset has no host.
|
||||
main_frame->load_printer_url();
|
||||
@@ -14894,8 +14926,11 @@ bool Plater::priv::has_assemble_view() const
|
||||
bool Plater::priv::can_scale_to_print_volume() const
|
||||
{
|
||||
const BuildVolume_Type type = this->bed.build_volume().type();
|
||||
const Selection& selection = get_selection();
|
||||
// Selection::scale_to_fit_print_volume() does nothing for a selection of parts, so don't offer it
|
||||
return !sidebar->obj_list()->has_selected_cut_object()
|
||||
&& !view3D->get_canvas3d()->get_selection().is_empty()
|
||||
&& !selection.is_empty()
|
||||
&& selection.get_mode() != Selection::Volume
|
||||
&& (type == BuildVolume_Type::Rectangle || type == BuildVolume_Type::Circle);
|
||||
}
|
||||
#endif // ENABLE_ENHANCED_PRINT_VOLUME_FIT
|
||||
@@ -18140,9 +18175,12 @@ void Plater::import_zip_archive()
|
||||
void Plater::import_sl1_archive()
|
||||
{
|
||||
auto &w = get_ui_job_worker();
|
||||
if (w.is_idle() && p->m_sla_import_dlg->ShowModal() == wxID_OK) {
|
||||
if (!w.is_idle())
|
||||
return;
|
||||
SLAImportDialog* dlg = p->m_sla_import_dlg.ensure();
|
||||
if (dlg->ShowModal() == wxID_OK) {
|
||||
p->take_snapshot(_u8L("Import SLA archive"));
|
||||
replace_job(w, std::make_unique<SLAImportJob>(p->m_sla_import_dlg));
|
||||
replace_job(w, std::make_unique<SLAImportJob>(dlg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21583,6 +21621,8 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||
bool bed_shape_changed = false;
|
||||
bool exclusion_preview_changed = false;
|
||||
bool imex_changed = false;
|
||||
bool filament_colour_changed = false;
|
||||
bool filament_list_changed = false;
|
||||
//bool print_sequence_changed = false;
|
||||
t_config_option_keys diff_keys = p->config->diff(config);
|
||||
|
||||
@@ -21595,20 +21635,15 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||
}
|
||||
|
||||
for (auto opt_key : diff_keys) {
|
||||
// The filament lists are refreshed once after the loop, as these keys usually change together.
|
||||
if (opt_key == "filament_colour") {
|
||||
update_scheduled = true; // update should be scheduled (for update 3DScene) #2738
|
||||
|
||||
if (update_filament_colors_in_full_config()) {
|
||||
p->sidebar->update_mixed_filament_list();
|
||||
p->partplate_list.invalidate_exclusion_volume_previews();
|
||||
p->sidebar->obj_list()->update_filament_colors();
|
||||
p->sidebar->update_dynamic_filament_list();
|
||||
continue;
|
||||
}
|
||||
filament_colour_changed = true;
|
||||
exclusion_preview_changed = true;
|
||||
continue;
|
||||
}
|
||||
if (opt_key == "filament_type") {
|
||||
update_filament_colors_in_full_config();
|
||||
p->sidebar->update_mixed_filament_list();
|
||||
filament_list_changed = true;
|
||||
continue;
|
||||
}
|
||||
// The mixed-filament type check folds filament_is_support into the component type
|
||||
@@ -21616,7 +21651,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||
// refresh the list even though filament_type itself did not change.
|
||||
if (opt_key == "filament_is_support") {
|
||||
p->config->set_key_value(opt_key, config.option(opt_key)->clone());
|
||||
p->sidebar->update_mixed_filament_list();
|
||||
filament_list_changed = true;
|
||||
continue;
|
||||
}
|
||||
if (opt_key == "material_colour") {
|
||||
@@ -21708,6 +21743,15 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||
p->view3D->get_canvas3d()->set_as_dirty();
|
||||
}
|
||||
|
||||
if (filament_colour_changed || filament_list_changed) {
|
||||
update_filament_colors_in_full_config();
|
||||
p->sidebar->update_mixed_filament_list();
|
||||
if (filament_colour_changed) {
|
||||
p->sidebar->obj_list()->update_filament_colors();
|
||||
p->sidebar->update_dynamic_filament_list();
|
||||
}
|
||||
}
|
||||
|
||||
if (bed_shape_changed) {
|
||||
set_bed_shape();
|
||||
get_current_canvas3D()->requires_check_outside_state();
|
||||
@@ -22175,24 +22219,30 @@ GLCanvas3D* Plater::get_assmeble_canvas3D()
|
||||
|
||||
UVEditorCanvas* Plater::get_uv_editor_canvas()
|
||||
{
|
||||
return p->uv_editor_canvas;
|
||||
UVEditorPanel* panel = p->uv_editor.get();
|
||||
return panel != nullptr ? panel->canvas() : nullptr;
|
||||
}
|
||||
|
||||
void Plater::show_uv_editor(bool show)
|
||||
{
|
||||
if (p->uv_editor_panel == nullptr)
|
||||
return;
|
||||
const wxAuiPaneInfo &pane = p->m_aui_mgr.GetPane(p->uv_editor_panel);
|
||||
if (!pane.IsOk() || pane.IsShown() == show)
|
||||
return;
|
||||
if (!p->uv_editor.built()) {
|
||||
// Built below on the first show; nothing to hide before that.
|
||||
if (!show)
|
||||
return;
|
||||
} else {
|
||||
const wxAuiPaneInfo &pane = p->m_aui_mgr.GetPane(p->uv_editor.get());
|
||||
if (!pane.IsOk() || pane.IsShown() == show)
|
||||
return;
|
||||
}
|
||||
|
||||
// Deferred, because GLGizmoTextureDisplacement calls this from its ImGui panel - that is, from
|
||||
// the middle of the 3D canvas's GL frame. Showing an AUI pane re-lays out the window and
|
||||
// delivers the resulting size/paint events synchronously, and the UV canvas painting itself
|
||||
// makes its own surface current in the app's *shared* GL context, which mid-frame is the one
|
||||
// the 3D canvas is drawing into. Doing the layout once the frame is over avoids that entirely.
|
||||
// Building the pane creates a wxGLCanvas, so it waits here too.
|
||||
CallAfter([this, show]() {
|
||||
wxAuiPaneInfo &deferred_pane = p->m_aui_mgr.GetPane(p->uv_editor_panel);
|
||||
wxAuiPaneInfo &deferred_pane = p->m_aui_mgr.GetPane(p->uv_editor.ensure());
|
||||
if (!deferred_pane.IsOk() || deferred_pane.IsShown() == show)
|
||||
return;
|
||||
deferred_pane.Show(show);
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
void create_printer_preset();
|
||||
void init_filament_combo(PlaterPresetComboBox **combo, const int filament_idx);
|
||||
void remove_unused_filament_combos(const size_t current_extruder_count);
|
||||
void update_all_preset_comboboxes();
|
||||
void update_all_preset_comboboxes(bool update_filament_combos = true);
|
||||
//void update_partplate(PartPlateList& list);
|
||||
void update_presets(Slic3r::Preset::Type preset_type);
|
||||
//BBS
|
||||
|
||||
+251
-236
@@ -1742,12 +1742,60 @@ void PreferencesDialog::create_items()
|
||||
//auto item_hints = create_item_checkbox(_L("Show \"Daily Tips\" after start"), page, _L("If enabled, useful hints are displayed at startup."), "show_daily_tips");
|
||||
//g_sizer->Add(item_hints);
|
||||
|
||||
auto item_downloads = create_item_downloads(_L("Downloads folder"), _L("Target folder for downloaded items"));
|
||||
g_sizer->Add(item_downloads);
|
||||
//// GENERAL > Features
|
||||
g_sizer->Add(create_item_title(_L("Features")), 1, wxEXPAND);
|
||||
|
||||
//// GENERAL > Project
|
||||
auto item_multi_machine = create_item_checkbox(_L("Multi device management"), _L("With this option enabled, you can send a task to multiple devices at the same time and manage multiple devices."), "enable_multi_machine", _L("(Requires restart)"));
|
||||
g_sizer->Add(item_multi_machine);
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
auto item_cad_feature = create_item_checkbox(_L("CAD feature (experimental)"),
|
||||
_L("With this option enabled, the Design tab is shown, where models can be built and edited "
|
||||
"parametrically. This feature is experimental and still under development."),
|
||||
"enable_cad_feature", _L("(Requires restart)"));
|
||||
g_sizer->Add(item_cad_feature);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
g_sizer->Add(create_item_title(_L("Filament Grouping")), 1, wxEXPAND);
|
||||
//temporarily disable it
|
||||
//auto item_ignore_ext_filament = create_item_checkbox(_L("Ignore ext filament when auto grouping"), _L("Ignore ext filament when auto grouping"), 50, "ignore_ext_filament_when_group");
|
||||
auto item_pop_up_filament_map_dialog = create_item_checkbox(_L("Pop up to select filament grouping mode"), _L("Pop up to select filament grouping mode"), 50, "pop_up_filament_map_dialog");
|
||||
g_sizer->Add(item_pop_up_filament_map_dialog);
|
||||
#endif
|
||||
|
||||
|
||||
//// GENERAL > Clear my choice on ...
|
||||
g_sizer->Add(create_item_title(_L("Clear my choice on...")), 1, wxEXPAND);
|
||||
|
||||
auto item_save_choise = create_item_button(_L("Unsaved projects"), _L("Clear"), "", _L("Clear my choice on the unsaved projects."), []() {
|
||||
wxGetApp().app_config->set("save_project_choise", "");
|
||||
});
|
||||
g_sizer->Add(item_save_choise);
|
||||
|
||||
auto item_save_presets = create_item_button(_L("Unsaved presets"), _L("Clear"), "", _L("Clear my choice on the unsaved presets."), []() {
|
||||
wxGetApp().app_config->set("save_preset_choise", "");
|
||||
});
|
||||
g_sizer->Add(item_save_presets);
|
||||
|
||||
auto item_restore_hide_pop_ups = create_item_button(_L("Synchronizing printer preset"), _L("Clear"), L"", _L("Clear my choice for synchronizing printer preset after loading the file."), []() {
|
||||
wxGetApp().app_config->erase("app", "sync_after_load_file_show_flag");
|
||||
});
|
||||
g_sizer->Add(item_restore_hide_pop_ups);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
//////////////////////////
|
||||
//// FILES TAB
|
||||
/////////////////////////////////////
|
||||
m_tab_index[PreferencesTab::Files] = m_pref_tabs->AppendItem(_L("Files"));
|
||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||
g_sizer = f_sizers.back();
|
||||
g_sizer->AddGrowableCol(0, 1);
|
||||
|
||||
//// FILES > Project
|
||||
g_sizer->Add(create_item_title(_L("Project")), 1, wxEXPAND);
|
||||
|
||||
std::vector<wxString> projectLoadSettingsBehaviourOptions = {_L("Load All"), _L("Ask When Relevant"), _L("Always Ask"), _L("Load Geometry Only")};
|
||||
std::vector<std::string> projectLoadSettingsConfigOptions = { OPTION_PROJECT_LOAD_BEHAVIOUR_LOAD_ALL, OPTION_PROJECT_LOAD_BEHAVIOUR_ASK_WHEN_RELEVANT, OPTION_PROJECT_LOAD_BEHAVIOUR_ALWAYS_ASK, OPTION_PROJECT_LOAD_BEHAVIOUR_LOAD_GEOMETRY };
|
||||
auto item_project_load = create_item_combobox(_L("Load behavior"), _L("Should printer/filament/process settings be loaded when opening a 3MF file?"), SETTING_PROJECT_LOAD_BEHAVIOUR, projectLoadSettingsBehaviourOptions, projectLoadSettingsConfigOptions);
|
||||
@@ -1756,6 +1804,15 @@ void PreferencesDialog::create_items()
|
||||
auto item_backup = create_item_backup(_L("Auto backup"), _L("Backup your project periodically to help with restoring from an occasional crash."));
|
||||
g_sizer->Add(item_backup);
|
||||
|
||||
auto item_full_source_paths = create_item_checkbox(_L("Store full source file paths in projects"),
|
||||
_L("If enabled, saved projects store the absolute path to imported source files (STEP/STL/...), so "
|
||||
"\"Reload from disk\" still works when the source file is kept in a different folder than the project. "
|
||||
"If disabled, only the filename is stored, which keeps projects portable and avoids embedding absolute paths."),
|
||||
"export_sources_full_pathnames");
|
||||
g_sizer->Add(item_full_source_paths);
|
||||
|
||||
//// FILES > Recent files
|
||||
g_sizer->Add(create_item_title(_L("Recent files")), 1, wxEXPAND);
|
||||
auto item_max_recent_count = create_item_input(_L("Maximum recent files"), "", _L("Maximum count of recent files"), "max_recent_count", [](wxString value) {
|
||||
long max = 0;
|
||||
if (value.ToLong(&max))
|
||||
@@ -1766,24 +1823,35 @@ void PreferencesDialog::create_items()
|
||||
auto item_recent_models = create_item_checkbox(_L("Add STL/STEP files to recent files list"), "", "recent_models");
|
||||
g_sizer->Add(item_recent_models);
|
||||
|
||||
//// FILES > Folder paths
|
||||
g_sizer->Add(create_item_title(_L("Folder paths")), 1, wxEXPAND);
|
||||
auto item_downloads = create_item_downloads(_L("Downloads folder"), _L("Target folder for downloaded items"));
|
||||
g_sizer->Add(item_downloads);
|
||||
|
||||
//// FILES > 3MF import
|
||||
g_sizer->Add(create_item_title(_L("3MF import")), 1, wxEXPAND);
|
||||
auto item_gcodes_warning = create_item_checkbox(_L("Don't warn when loading 3MF with modified G-code"), "", "no_warn_when_modified_gcodes");
|
||||
g_sizer->Add(item_gcodes_warning);
|
||||
|
||||
//// FILES > STEP import
|
||||
g_sizer->Add(create_item_title(_L("STEP import")), 1, wxEXPAND);
|
||||
auto item_step_dialog = create_item_checkbox(
|
||||
_L("Show options when importing STEP file"), _L("If enabled, a parameter settings dialog will appear during STEP file import."),
|
||||
"enable_step_mesh_setting", wxEmptyString, "import_export#dont-show-again"
|
||||
);
|
||||
g_sizer->Add(item_step_dialog);
|
||||
|
||||
auto item_step_linear = create_item_decimal_input(_L("STEP importing: linear deflection"), "mm", _L("Linear deflection used when meshing imported STEP files.\nSmaller values produce higher-quality meshes but increase processing time.\nUsed as the default in the import dialog, or directly when the import dialog is disabled.\nDefault: 0.003 mm."), "linear_deflection", 0.001, 0.1, 3);
|
||||
auto item_step_linear = create_item_decimal_input(_L("Linear deflection"), "mm", _L("Linear deflection used when meshing imported STEP files.\nSmaller values produce higher-quality meshes but increase processing time.\nUsed as the default in the import dialog, or directly when the import dialog is disabled.\nDefault: 0.003 mm."), "linear_deflection", 0.001, 0.1, 3);
|
||||
g_sizer->Add(item_step_linear);
|
||||
|
||||
auto item_step_angle = create_item_decimal_input(_L("STEP importing: angle deflection"), "", _L("Angle deflection used when meshing imported STEP files.\nSmaller values produce higher-quality meshes but increase processing time.\nUsed as the default in the import dialog, or directly when the import dialog is disabled.\nDefault: 0.5."), "angle_deflection", 0.01, 1.0, 2);
|
||||
auto item_step_angle = create_item_decimal_input(_L("Angle deflection"), "", _L("Angle deflection used when meshing imported STEP files.\nSmaller values produce higher-quality meshes but increase processing time.\nUsed as the default in the import dialog, or directly when the import dialog is disabled.\nDefault: 0.5."), "angle_deflection", 0.01, 1.0, 2);
|
||||
g_sizer->Add(item_step_angle);
|
||||
|
||||
auto item_step_split = create_item_checkbox(_L("STEP importing: Split into multiple objects"), _L("If enabled, compound and compsolid shapes in imported STEP files are split into multiple objects.\nUsed as the default in the import dialog, or directly when the import dialog is disabled.\nDefault: disabled."), "is_split_compound");
|
||||
auto item_step_split = create_item_checkbox(_L("Split compound and compsolid into multiple objects"), _L("If enabled, compound and compsolid shapes in imported STEP files are split into multiple objects.\nUsed as the default in the import dialog, or directly when the import dialog is disabled.\nDefault: disabled."), "is_split_compound");
|
||||
g_sizer->Add(item_step_split);
|
||||
|
||||
//// FILES > DRC export
|
||||
g_sizer->Add(create_item_title(_L("DRC export")), 1, wxEXPAND);
|
||||
auto item_draco_bits = create_item_spinctrl(_L("Quality level for Draco export"), "",
|
||||
_L("bits"),
|
||||
_L("Controls the quantization bit depth used when compressing the mesh to Draco format.\n"
|
||||
@@ -1793,14 +1861,136 @@ void PreferencesDialog::create_items()
|
||||
);
|
||||
g_sizer->Add(item_draco_bits);
|
||||
|
||||
auto item_full_source_paths = create_item_checkbox(_L("Store full source file paths in projects"),
|
||||
_L("If enabled, saved projects store the absolute path to imported source files (STEP/STL/...), so "
|
||||
"\"Reload from disk\" still works when the source file is kept in a different folder than the project. "
|
||||
"If disabled, only the filename is stored, which keeps projects portable and avoids embedding absolute paths."),
|
||||
"export_sources_full_pathnames");
|
||||
g_sizer->Add(item_full_source_paths);
|
||||
#ifdef _WIN32
|
||||
// MSIX: associations are declared in the package manifest and defaults are
|
||||
// managed by Windows Settings; the runtime registry toggles below cannot work.
|
||||
// Show a minimal page that sends the user to Windows' Default Apps settings instead.
|
||||
if (is_running_in_msix()) {
|
||||
g_sizer->Add(create_item_title(_L("Associate files to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
//// GENERAL > Preset
|
||||
auto item_open_default_apps = create_item_button(
|
||||
_L("File associations for the Microsoft Store version are managed by Windows Settings."),
|
||||
_L("Open Windows Default Apps Settings"), "", "",
|
||||
[]() { wxLaunchDefaultBrowser("ms-settings:defaultapps"); });
|
||||
g_sizer->Add(item_open_default_apps);
|
||||
} else {
|
||||
//// FILES > Extensions
|
||||
g_sizer->Add(create_item_title(_L("Associate files to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
auto item_associate_3mf = create_item_checkbox(_L("Associate 3MF files to OrcaSlicer"), _L("If enabled, this sets OrcaSlicer as the default application to open 3MF files.") , "associate_3mf");
|
||||
g_sizer->Add(item_associate_3mf);
|
||||
|
||||
auto item_associate_drc = create_item_checkbox(_L("Associate DRC files to OrcaSlicer"), _L("If enabled, sets OrcaSlicer as default application to open DRC files."), "associate_drc");
|
||||
g_sizer->Add(item_associate_drc);
|
||||
|
||||
auto item_associate_stl = create_item_checkbox(_L("Associate STL files to OrcaSlicer"), _L("If enabled, this sets OrcaSlicer as the default application to open STL files.") , "associate_stl");
|
||||
g_sizer->Add(item_associate_stl);
|
||||
|
||||
auto item_associate_step = create_item_checkbox(_L("Associate STEP files to OrcaSlicer"), _L("If enabled, this sets OrcaSlicer as the default application to open STEP files."), "associate_step");
|
||||
g_sizer->Add(item_associate_step);
|
||||
|
||||
//// FILES > WebLinks
|
||||
g_sizer->Add(create_item_title(_L("Associate web links to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
auto associate_url_prusa = create_item_link_association(L"prusaslicer", "Printables.com");
|
||||
g_sizer->Add(associate_url_prusa);
|
||||
|
||||
auto associate_url_bambu = create_item_link_association(L"bambustudio", "Makerworld.com");
|
||||
g_sizer->Add(associate_url_bambu);
|
||||
|
||||
auto associate_url_cura = create_item_link_association(L"cura", "Thingiverse.com");
|
||||
g_sizer->Add(associate_url_cura);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
//////////////////////////
|
||||
//// BEHAVIOUR TAB
|
||||
/////////////////////////////////////
|
||||
m_tab_index[PreferencesTab::Behaviour] = m_pref_tabs->AppendItem(_L("Behaviour"));
|
||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||
g_sizer = f_sizers.back();
|
||||
g_sizer->AddGrowableCol(0, 1);
|
||||
|
||||
//// BEHAVIOUR > Prepare
|
||||
g_sizer->Add(create_item_title(_L("Prepare")), 1, wxEXPAND);
|
||||
|
||||
std::vector<wxString> FlushOptionLabels = {_L("All"),_L("Color"),_L("None")};
|
||||
std::vector<std::string> FlushOptionValues = { "all","color change","disabled" };
|
||||
auto item_auto_flush = create_item_combobox(_L("Auto flush after changing..."), _L("Auto calculate flushing volumes when selected values changed"), "auto_calculate_flush", FlushOptionLabels, FlushOptionValues);
|
||||
g_sizer->Add(item_auto_flush);
|
||||
|
||||
auto item_auto_arrange = create_item_checkbox(_L("Auto arrange plate after cloning"), "", "auto_arrange");
|
||||
g_sizer->Add(item_auto_arrange);
|
||||
|
||||
auto item_auto_reslice = create_item_auto_reslice(
|
||||
_L("Auto slice after changes"),
|
||||
_L("If enabled, OrcaSlicer will re-slice automatically whenever slicing-related settings change."),
|
||||
_L("Delay in seconds before auto slicing starts, allowing multiple edits to be grouped. Use 0 to slice immediately."));
|
||||
g_sizer->Add(item_auto_reslice);
|
||||
|
||||
auto item_primitive_dialog = create_item_checkbox(_L("Show options when adding a primitive"),
|
||||
_L("If enabled, a dialog asks for the dimensions of a primitive shape before it is added."), "enable_primitive_size_dialog");
|
||||
g_sizer->Add(item_primitive_dialog);
|
||||
|
||||
auto item_mix_print_high_low_temperature = create_item_checkbox(_L("Remove mixed temperature restriction"), _L("With this option enabled, you can print materials with a large temperature difference together."), "enable_high_low_temp_mixed_printing");
|
||||
g_sizer->Add(item_mix_print_high_low_temperature);
|
||||
|
||||
auto item_remember_print_action = create_item_checkbox(_L("Remember last print action"), _L("If enabled, OrcaSlicer will remember the last selected option in the print button's dropdown (e.g. Print, Export plate sliced file, Export G-code file) and use it as the default on next startup."), "remember_print_action");
|
||||
g_sizer->Add(item_remember_print_action);
|
||||
|
||||
//// BEHAVIOUR > Preview
|
||||
g_sizer->Add(create_item_title(_L("Preview")), 1, wxEXPAND);
|
||||
|
||||
// ORCA: view type the preview opens with
|
||||
std::vector<wxString> PreviewViewTypeLabels;
|
||||
std::vector<std::string> PreviewViewTypeValues;
|
||||
for (const auto& [value, label] : GCodeViewer::default_view_type_choices()) {
|
||||
PreviewViewTypeValues.push_back(value);
|
||||
PreviewViewTypeLabels.push_back(from_u8(label));
|
||||
}
|
||||
auto item_preview_view_type = create_item_combobox(
|
||||
_L("Default view type"),
|
||||
_L("The color scheme the sliced preview opens with.\n"
|
||||
"Automatic: Filament for multi material prints, Line Type for single material ones.\n"
|
||||
"Last used: the view type you selected last.\n"
|
||||
"Any other value always opens that view type.\n"
|
||||
"You can still switch the view type in the preview afterwards."),
|
||||
"preview_default_view_type", PreviewViewTypeLabels, PreviewViewTypeValues);
|
||||
g_sizer->Add(item_preview_view_type);
|
||||
|
||||
auto item_dim_previous_layers = create_item_checkbox(
|
||||
_L("Dim lower layers"),
|
||||
_L("When scrubbing the layer slider in the sliced preview, render the layers below the current one darkened so that only the layer being viewed is shown at full brightness."),
|
||||
"preview_dim_previous_layers"
|
||||
);
|
||||
g_sizer->Add(item_dim_previous_layers);
|
||||
|
||||
auto item_dim_previous_layers_brightness = create_item_spinctrl(
|
||||
_L("Dimmed layer brightness"),
|
||||
"",
|
||||
_L("%"),
|
||||
_L("How brightly the dimmed layers are rendered when \"Dim lower layers\" is enabled.\n"
|
||||
"99% is barely darkened, 0% renders them black. Capped at 99% because 100% would be the same as disabling the option."),
|
||||
"preview_dim_previous_layers_brightness",
|
||||
0,
|
||||
99,
|
||||
// ORCA: apply the new brightness immediately to the currently loaded preview
|
||||
[](int value) {
|
||||
if (Plater* plater = wxGetApp().plater()) {
|
||||
if (GLCanvas3D* canvas = plater->get_preview_canvas3D()) {
|
||||
canvas->get_gcode_viewer().set_dim_previous_layers_brightness(0.01f * value);
|
||||
canvas->set_as_dirty();
|
||||
canvas->request_extra_frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
g_sizer->Add(item_dim_previous_layers_brightness);
|
||||
|
||||
//// BEHAVIOUR > Preset
|
||||
g_sizer->Add(create_item_title(_L("Preset")), 1, wxEXPAND);
|
||||
|
||||
auto item_remember_printer = create_item_checkbox(_L("Remember printer configuration"), _L("If enabled, Orca will remember and switch filament/process configuration for each printer automatically."), "remember_printer_config");
|
||||
@@ -1822,11 +2012,47 @@ void PreferencesDialog::create_items()
|
||||
auto item_shared_profiles = create_item_checkbox(_L("Show shared profiles notification"), _L("Show a notification with a link to browse shared profiles when the selected printer is changed."), "show_shared_profiles_notification");
|
||||
g_sizer->Add(item_shared_profiles);
|
||||
|
||||
//// GENERAL > Features
|
||||
g_sizer->Add(create_item_title(_L("Features")), 1, wxEXPAND);
|
||||
//// BEHAVIOUR > Plugins
|
||||
g_sizer->Add(create_item_title(_L("Plugins")), 1, wxEXPAND);
|
||||
|
||||
auto item_multi_machine = create_item_checkbox(_L("Multi device management"), _L("With this option enabled, you can send a task to multiple devices at the same time and manage multiple devices."), "enable_multi_machine", _L("(Requires restart)"));
|
||||
g_sizer->Add(item_multi_machine);
|
||||
auto item_plugin_pages_visible_count = create_item_spinctrl(
|
||||
_L("Visible plugin pages"),
|
||||
"",
|
||||
_L("pages"),
|
||||
_L("Number of plugin pages shown as fixed tabs before the remaining pages collapse into a dropdown on the last tab."),
|
||||
SETTING_PLUGIN_PAGES_VISIBLE_COUNT,
|
||||
PLUGIN_PAGES_VISIBLE_COUNT_MIN,
|
||||
PLUGIN_PAGES_VISIBLE_COUNT_MAX,
|
||||
[](int value) { wxGetApp().mainframe->plugin_pages().set_visible_page_count(value); }
|
||||
);
|
||||
g_sizer->Add(item_plugin_pages_visible_count);
|
||||
|
||||
//// BEHAVIOUR > Design
|
||||
#ifdef SLIC3R_CAD
|
||||
// Design-tab only, so it stays out of the way while the CAD feature is switched off.
|
||||
if (wxGetApp().is_enable_cad_feature()) {
|
||||
g_sizer->Add(create_item_title(_L("Design")), 1, wxEXPAND);
|
||||
auto item_connector_face_glyph = create_item_checkbox(_L("Draw mate connectors as a face"),
|
||||
_L("In the Design tab, draw a mate connector as a small face instead of the conventional "
|
||||
"disc with a roll quadrant. A face shows its orientation at a glance, without learning the disc convention. "
|
||||
"Turn this off for the conventional CAD representation."), "design_connector_face_glyph");
|
||||
g_sizer->Add(item_connector_face_glyph);
|
||||
|
||||
// Saved WITH each design (it decides which loops are closed, i.e. what solid a project
|
||||
// rebuilds into), so it applies to designs started from now on; an open design keeps
|
||||
// the rule it was made with.
|
||||
auto item_auto_close_sketch_loops = create_item_checkbox(_L("Auto-close sketch loops"),
|
||||
_L("Treat sketch endpoints within 0.001 mm as one joint and weld the loop shut. "
|
||||
"Off: only exactly coincident endpoints join, so a loop with a tiny gap is "
|
||||
"shown as open instead of being closed for you. Saved with each design; "
|
||||
"applies to designs started after the change."),
|
||||
"auto_close_sketch_loops");
|
||||
g_sizer->Add(item_auto_close_sketch_loops);
|
||||
}
|
||||
#endif
|
||||
|
||||
//// BEHAVIOUR > Speed dial
|
||||
g_sizer->Add(create_item_title(_L("Speed dial")), 1, wxEXPAND);
|
||||
|
||||
auto item_speed_dial = create_item_checkbox(_L("Open the Speed Dial from the keyboard"),
|
||||
_L("When enabled, the Speed Dial keyboard shortcut (Space by default) opens the action search from any page."),
|
||||
@@ -1844,37 +2070,6 @@ void PreferencesDialog::create_items()
|
||||
SPEED_DIAL_RECENT_COUNT_MAX);
|
||||
g_sizer->Add(item_speed_dial_recents);
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
auto item_cad_feature = create_item_checkbox(_L("CAD feature (experimental)"),
|
||||
_L("With this option enabled, the Design tab is shown, where models can be built and edited "
|
||||
"parametrically. This feature is experimental and still under development."),
|
||||
"enable_cad_feature", _L("(Requires restart)"));
|
||||
g_sizer->Add(item_cad_feature);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
g_sizer->Add(create_item_title(_L("Filament Grouping")), 1, wxEXPAND);
|
||||
//temporarily disable it
|
||||
//auto item_ignore_ext_filament = create_item_checkbox(_L("Ignore ext filament when auto grouping"), _L("Ignore ext filament when auto grouping"), 50, "ignore_ext_filament_when_group");
|
||||
auto item_pop_up_filament_map_dialog = create_item_checkbox(_L("Pop up to select filament grouping mode"), _L("Pop up to select filament grouping mode"), 50, "pop_up_filament_map_dialog");
|
||||
g_sizer->Add(item_pop_up_filament_map_dialog);
|
||||
#endif
|
||||
|
||||
//// GENERAL > Plugins
|
||||
g_sizer->Add(create_item_title(_L("Plugins")), 1, wxEXPAND);
|
||||
|
||||
auto item_plugin_pages_visible_count = create_item_spinctrl(
|
||||
_L("Visible plugin pages"),
|
||||
"",
|
||||
_L("pages"),
|
||||
_L("Number of plugin pages shown as fixed tabs before the remaining pages collapse into a dropdown on the last tab."),
|
||||
SETTING_PLUGIN_PAGES_VISIBLE_COUNT,
|
||||
PLUGIN_PAGES_VISIBLE_COUNT_MIN,
|
||||
PLUGIN_PAGES_VISIBLE_COUNT_MAX,
|
||||
[](int value) { wxGetApp().mainframe->plugin_pages().set_visible_page_count(value); }
|
||||
);
|
||||
g_sizer->Add(item_plugin_pages_visible_count);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
@@ -1886,36 +2081,6 @@ void PreferencesDialog::create_items()
|
||||
g_sizer = f_sizers.back();
|
||||
g_sizer->AddGrowableCol(0, 1);
|
||||
|
||||
//// CONTROL > Behaviour
|
||||
g_sizer->Add(create_item_title(_L("Behavior")), 1, wxEXPAND);
|
||||
|
||||
std::vector<wxString> FlushOptionLabels = {_L("All"),_L("Color"),_L("None")};
|
||||
std::vector<std::string> FlushOptionValues = { "all","color change","disabled" };
|
||||
auto item_auto_flush = create_item_combobox(_L("Auto flush after changing..."), _L("Auto calculate flushing volumes when selected values changed"), "auto_calculate_flush", FlushOptionLabels, FlushOptionValues);
|
||||
g_sizer->Add(item_auto_flush);
|
||||
|
||||
auto item_auto_arrange = create_item_checkbox(_L("Auto arrange plate after cloning"), "", "auto_arrange");
|
||||
g_sizer->Add(item_auto_arrange);
|
||||
|
||||
auto item_primitive_dialog = create_item_checkbox(_L("Show options when adding a primitive"),
|
||||
_L("If enabled, a dialog asks for the dimensions of a primitive shape before it is added."), "enable_primitive_size_dialog");
|
||||
g_sizer->Add(item_primitive_dialog);
|
||||
|
||||
//// CONTROL > Slicing
|
||||
g_sizer->Add(create_item_title(_L("Slicing")), 1, wxEXPAND);
|
||||
|
||||
auto item_auto_reslice = create_item_auto_reslice(
|
||||
_L("Auto slice after changes"),
|
||||
_L("If enabled, OrcaSlicer will re-slice automatically whenever slicing-related settings change."),
|
||||
_L("Delay in seconds before auto slicing starts, allowing multiple edits to be grouped. Use 0 to slice immediately."));
|
||||
g_sizer->Add(item_auto_reslice);
|
||||
|
||||
auto item_mix_print_high_low_temperature = create_item_checkbox(_L("Remove mixed temperature restriction"), _L("With this option enabled, you can print materials with a large temperature difference together."), "enable_high_low_temp_mixed_printing");
|
||||
g_sizer->Add(item_mix_print_high_low_temperature);
|
||||
|
||||
auto item_remember_print_action = create_item_checkbox(_L("Remember last print action"), _L("If enabled, OrcaSlicer will remember the last selected option in the print button's dropdown (e.g. Print, Export plate sliced file, Export G-code file) and use it as the default on next startup."), "remember_print_action");
|
||||
g_sizer->Add(item_remember_print_action);
|
||||
|
||||
//// CONTROL > Camera
|
||||
g_sizer->Add(create_item_title(_L("Camera")), 1, wxEXPAND);
|
||||
|
||||
@@ -1935,28 +2100,6 @@ void PreferencesDialog::create_items()
|
||||
auto reverse_mouse_zoom = create_item_checkbox(_L("Reverse mouse zoom"), _L("If enabled, reverses the direction of zoom with mouse wheel."), "reverse_mouse_wheel_zoom");
|
||||
g_sizer->Add(reverse_mouse_zoom);
|
||||
|
||||
#ifdef SLIC3R_CAD
|
||||
// Design-tab only, so it stays out of the way while the CAD feature is switched off.
|
||||
if (wxGetApp().is_enable_cad_feature()) {
|
||||
auto item_connector_face_glyph = create_item_checkbox(_L("Draw mate connectors as a face"),
|
||||
_L("In the Design tab, draw a mate connector as a small face instead of the conventional "
|
||||
"disc with a roll quadrant. A face shows its orientation at a glance, without learning the disc convention. "
|
||||
"Turn this off for the conventional CAD representation."), "design_connector_face_glyph");
|
||||
g_sizer->Add(item_connector_face_glyph);
|
||||
|
||||
// Saved WITH each design (it decides which loops are closed, i.e. what solid a project
|
||||
// rebuilds into), so it applies to designs started from now on; an open design keeps
|
||||
// the rule it was made with.
|
||||
auto item_auto_close_sketch_loops = create_item_checkbox(_L("Auto-close sketch loops"),
|
||||
_L("Treat sketch endpoints within 0.001 mm as one joint and weld the loop shut. "
|
||||
"Off: only exactly coincident endpoints join, so a loop with a tiny gap is "
|
||||
"shown as open instead of being closed for you. Saved with each design; "
|
||||
"applies to designs started after the change."),
|
||||
"auto_close_sketch_loops");
|
||||
g_sizer->Add(item_auto_close_sketch_loops);
|
||||
}
|
||||
#endif
|
||||
|
||||
std::vector<wxString> ButtonDragActions = {_L("None"), _L("Pan"), _L("Rotate")};
|
||||
auto item_left_mouse_drag = create_item_combobox(_L("Left Mouse Drag"), _L("Set the action that dragging the left mouse button should perform."), "left_mouse_drag_action", ButtonDragActions);
|
||||
g_sizer->Add(item_left_mouse_drag);
|
||||
@@ -1973,24 +2116,6 @@ void PreferencesDialog::create_items()
|
||||
});
|
||||
g_sizer->Add(item_shortcuts);
|
||||
|
||||
//// CONTROL > Clear my choice on ...
|
||||
g_sizer->Add(create_item_title(_L("Clear my choice on...")), 1, wxEXPAND);
|
||||
|
||||
auto item_save_choise = create_item_button(_L("Unsaved projects"), _L("Clear"), "", _L("Clear my choice on the unsaved projects."), []() {
|
||||
wxGetApp().app_config->set("save_project_choise", "");
|
||||
});
|
||||
g_sizer->Add(item_save_choise);
|
||||
|
||||
auto item_save_presets = create_item_button(_L("Unsaved presets"), _L("Clear"), "", _L("Clear my choice on the unsaved presets."), []() {
|
||||
wxGetApp().app_config->set("save_preset_choise", "");
|
||||
});
|
||||
g_sizer->Add(item_save_presets);
|
||||
|
||||
auto item_restore_hide_pop_ups = create_item_button(_L("Synchronizing printer preset"), _L("Clear"), L"", _L("Clear my choice for synchronizing printer preset after loading the file."), []() {
|
||||
wxGetApp().app_config->erase("app", "sync_after_load_file_show_flag");
|
||||
});
|
||||
g_sizer->Add(item_restore_hide_pop_ups);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
@@ -2013,6 +2138,13 @@ void PreferencesDialog::create_items()
|
||||
);
|
||||
g_sizer->Add(smooth_normals);
|
||||
|
||||
auto item_translucent_filaments = create_item_checkbox(
|
||||
_L("Translucent filaments"),
|
||||
_L("Draw the toolpaths of filaments whose color is partly transparent as see-through, as the 3D view draws their objects. Turn it off to draw every filament opaque."),
|
||||
"preview_translucent_filaments"
|
||||
);
|
||||
g_sizer->Add(item_translucent_filaments);
|
||||
|
||||
//// GRAPHICS > Realistic view
|
||||
g_sizer->Add(create_item_title(_L("Realistic View")), 1, wxEXPAND);
|
||||
|
||||
@@ -2151,62 +2283,6 @@ void PreferencesDialog::create_items()
|
||||
g_sizer->Add(item_benchmark);
|
||||
}
|
||||
|
||||
//// GRAPHICS > G-code Preview
|
||||
g_sizer->Add(create_item_title(_L("G-code Preview")), 1, wxEXPAND);
|
||||
|
||||
// ORCA: view type the preview opens with
|
||||
std::vector<wxString> PreviewViewTypeLabels;
|
||||
std::vector<std::string> PreviewViewTypeValues;
|
||||
for (const auto& [value, label] : GCodeViewer::default_view_type_choices()) {
|
||||
PreviewViewTypeValues.push_back(value);
|
||||
PreviewViewTypeLabels.push_back(from_u8(label));
|
||||
}
|
||||
auto item_preview_view_type = create_item_combobox(
|
||||
_L("Default view type"),
|
||||
_L("The color scheme the sliced preview opens with.\n"
|
||||
"Automatic: Filament for multi material prints, Line Type for single material ones.\n"
|
||||
"Last used: the view type you selected last.\n"
|
||||
"Any other value always opens that view type.\n"
|
||||
"You can still switch the view type in the preview afterwards."),
|
||||
"preview_default_view_type", PreviewViewTypeLabels, PreviewViewTypeValues);
|
||||
g_sizer->Add(item_preview_view_type);
|
||||
|
||||
auto item_dim_previous_layers = create_item_checkbox(
|
||||
_L("Dim lower layers"),
|
||||
_L("When scrubbing the layer slider in the sliced preview, render the layers below the current one darkened so that only the layer being viewed is shown at full brightness."),
|
||||
"preview_dim_previous_layers"
|
||||
);
|
||||
g_sizer->Add(item_dim_previous_layers);
|
||||
|
||||
auto item_dim_previous_layers_brightness = create_item_spinctrl(
|
||||
_L("Dimmed layer brightness"),
|
||||
"",
|
||||
_L("%"),
|
||||
_L("How brightly the dimmed layers are rendered when \"Dim lower layers\" is enabled.\n"
|
||||
"99% is barely darkened, 0% renders them black. Capped at 99% because 100% would be the same as disabling the option."),
|
||||
"preview_dim_previous_layers_brightness",
|
||||
0,
|
||||
99,
|
||||
// ORCA: apply the new brightness immediately to the currently loaded preview
|
||||
[](int value) {
|
||||
if (Plater* plater = wxGetApp().plater()) {
|
||||
if (GLCanvas3D* canvas = plater->get_preview_canvas3D()) {
|
||||
canvas->get_gcode_viewer().set_dim_previous_layers_brightness(0.01f * value);
|
||||
canvas->set_as_dirty();
|
||||
canvas->request_extra_frame();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
g_sizer->Add(item_dim_previous_layers_brightness);
|
||||
|
||||
auto item_translucent_filaments = create_item_checkbox(
|
||||
_L("Translucent filaments"),
|
||||
_L("Draw the toolpaths of filaments whose color is partly transparent as see-through, as the 3D view draws their objects. Turn it off to draw every filament opaque."),
|
||||
"preview_translucent_filaments"
|
||||
);
|
||||
g_sizer->Add(item_translucent_filaments);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
@@ -2283,67 +2359,6 @@ void PreferencesDialog::create_items()
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
|
||||
//////////////////////////
|
||||
//// ASSOCIATE TAB
|
||||
/////////////////////////////////////
|
||||
#ifdef _WIN32
|
||||
// MSIX: associations are declared in the package manifest and defaults are
|
||||
// managed by Windows Settings; the runtime registry toggles below cannot work.
|
||||
// Show a minimal page that sends the user to Windows' Default Apps settings instead.
|
||||
if (is_running_in_msix()) {
|
||||
m_pref_tabs->AppendItem(_L("Associate"));
|
||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||
g_sizer = f_sizers.back();
|
||||
g_sizer->AddGrowableCol(0, 1);
|
||||
|
||||
g_sizer->Add(create_item_title(_L("Associate files to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
auto item_open_default_apps = create_item_button(
|
||||
_L("File associations for the Microsoft Store version are managed by Windows Settings."),
|
||||
_L("Open Windows Default Apps Settings"), "", "",
|
||||
[]() { wxLaunchDefaultBrowser("ms-settings:defaultapps"); });
|
||||
g_sizer->Add(item_open_default_apps);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
} else {
|
||||
m_pref_tabs->AppendItem(_L("Associate"));
|
||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||
g_sizer = f_sizers.back();
|
||||
g_sizer->AddGrowableCol(0, 1);
|
||||
|
||||
//// ASSOCIATE > Extensions
|
||||
g_sizer->Add(create_item_title(_L("Associate files to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
auto item_associate_3mf = create_item_checkbox(_L("Associate 3MF files to OrcaSlicer"), _L("If enabled, this sets OrcaSlicer as the default application to open 3MF files.") , "associate_3mf");
|
||||
g_sizer->Add(item_associate_3mf);
|
||||
|
||||
auto item_associate_drc = create_item_checkbox(_L("Associate DRC files to OrcaSlicer"), _L("If enabled, sets OrcaSlicer as default application to open DRC files."), "associate_drc");
|
||||
g_sizer->Add(item_associate_drc);
|
||||
|
||||
auto item_associate_stl = create_item_checkbox(_L("Associate STL files to OrcaSlicer"), _L("If enabled, this sets OrcaSlicer as the default application to open STL files.") , "associate_stl");
|
||||
g_sizer->Add(item_associate_stl);
|
||||
|
||||
auto item_associate_step = create_item_checkbox(_L("Associate STEP files to OrcaSlicer"), _L("If enabled, this sets OrcaSlicer as the default application to open STEP files."), "associate_step");
|
||||
g_sizer->Add(item_associate_step);
|
||||
|
||||
//// ASSOCIATE > WebLinks
|
||||
g_sizer->Add(create_item_title(_L("Associate web links to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
auto associate_url_prusa = create_item_link_association(L"prusaslicer", "Printables.com");
|
||||
g_sizer->Add(associate_url_prusa);
|
||||
|
||||
auto associate_url_bambu = create_item_link_association(L"bambustudio", "Makerworld.com");
|
||||
g_sizer->Add(associate_url_bambu);
|
||||
|
||||
auto associate_url_cura = create_item_link_association(L"cura", "Thingiverse.com");
|
||||
g_sizer->Add(associate_url_cura);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
//////////////////////////
|
||||
//// DEVELOPER TAB
|
||||
/////////////////////////////////////
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Slic3r { namespace GUI {
|
||||
#define DESIGN_LEFT_MARGIN 25
|
||||
|
||||
// The tabs other dialogs open Preferences on.
|
||||
enum class PreferencesTab { General, Control, Graphics, Online };
|
||||
enum class PreferencesTab { General, Files, Behaviour, Control, Graphics, Online };
|
||||
|
||||
class PreferencesDialog : public DPIDialog
|
||||
{
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <wx/window.h>
|
||||
#include <wx/variant.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/defs.h>
|
||||
|
||||
#include "wx/dataview.h"
|
||||
#include "wx/numformatter.h"
|
||||
@@ -76,6 +77,19 @@ bool focus_left_popup(wxWindow* popup, wxWindow* focus_window, wxWindow* related
|
||||
focus_window != related_window_2 && focus_window != related_window_3;
|
||||
}
|
||||
|
||||
// Close a search popup on Esc and stop the key there. Without this, Esc reaches the window holding the search,
|
||||
// and a settings dialog closes while the popup keeps the input grab. Only GTK puts the search field inside the
|
||||
// popup, so only there does the key pass through it; elsewhere the field stays outside and this never runs.
|
||||
template<class Close> void close_on_escape(wxWindow* popup, Close close)
|
||||
{
|
||||
popup->Bind(wxEVT_CHAR_HOOK, [close](wxKeyEvent& e) {
|
||||
if (e.GetKeyCode() == WXK_ESCAPE)
|
||||
close();
|
||||
else
|
||||
e.Skip();
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace Search {
|
||||
@@ -515,6 +529,13 @@ SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindo
|
||||
search_line->Bind(wxEVT_LEFT_UP, &SearchDialog::OnLeftUpInTextCtrl, this);
|
||||
search_line2 = search_line->GetTextCtrl();
|
||||
|
||||
close_on_escape(this, [this] {
|
||||
Die();
|
||||
// The focused field hides with the popup. Give the focus back to the search button once the exit event
|
||||
// has shown it again, so a second Esc reaches the dialog.
|
||||
CallAfter([this] { m_search_item_tag->SetFocus(); });
|
||||
});
|
||||
|
||||
// scroll window
|
||||
m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em /2), POPUP_HEIGHT * em), wxVSCROLL, 6, 6);
|
||||
m_scrolledWindow->SetMarginColor(m_bg_colour);
|
||||
@@ -768,6 +789,7 @@ SearchObjectDialog::SearchObjectDialog(GUI::ObjectList* object_list, wxWindow* p
|
||||
search_line->Bind(wxEVT_TEXT, &SearchObjectDialog::OnInputText, this);
|
||||
search_line->Bind(wxEVT_LEFT_UP, &SearchObjectDialog::OnLeftUpInTextCtrl, this);
|
||||
search_line2 = search_line->GetTextCtrl();
|
||||
close_on_escape(this, [this] { Die(); });
|
||||
|
||||
|
||||
// scroll window
|
||||
|
||||
@@ -3699,7 +3699,8 @@ void TabPrint::update()
|
||||
toggle_options();
|
||||
// update() could be called during undo/redo execution
|
||||
// Update of objectList can cause a crash in this case (because m_objects doesn't match ObjectList)
|
||||
if (m_type != Preset::TYPE_MODEL && !wxGetApp().plater()->inside_snapshot_capture())
|
||||
// Before the main window is shown no object can be selected, and the refresh would only lay out the sidebar.
|
||||
if (m_type != Preset::TYPE_MODEL && !wxGetApp().plater()->inside_snapshot_capture() && wxGetApp().mainframe->IsShown())
|
||||
wxGetApp().obj_list()->update_and_show_object_settings_item();
|
||||
|
||||
wxGetApp().mainframe->on_config_changed(m_config);
|
||||
|
||||
@@ -375,13 +375,13 @@ void ModeSwitchButton::doRender(wxDC& dc)
|
||||
}
|
||||
}
|
||||
else { // Developer mode
|
||||
double scale = 1.00;
|
||||
#ifdef __WXOSX__
|
||||
scale = Slic3r::GUI::mac_max_scaling_factor();
|
||||
dc.SetFont(dc.GetFont().Scaled(scale));
|
||||
#elif defined(__WXMSW__)
|
||||
scale = m_parent->GetDPIScaleFactor();
|
||||
dc.SetFont(dc.GetFont().Scaled(scale));
|
||||
// Only the MSW DC draws in physical pixels, so the font and its baseline offset follow the
|
||||
// DPI scale there. macOS and GTK draw in logical units: scaling the font again by the Retina
|
||||
// backing factor made "DEV" overflow the switch.
|
||||
double y_offset = 0.0;
|
||||
#if defined(__WXMSW__)
|
||||
y_offset = m_parent->GetDPIScaleFactor();
|
||||
dc.SetFont(dc.GetFont().Scaled(y_offset));
|
||||
#endif
|
||||
wxString str = "DEV";
|
||||
int kerning = 3; // pixels between chars
|
||||
@@ -397,11 +397,6 @@ void ModeSwitchButton::doRender(wxDC& dc)
|
||||
wxFontMetrics fm = dc.GetFontMetrics();
|
||||
int lineHeight = fm.ascent + fm.descent + fm.internalLeading;
|
||||
|
||||
double y_offset = scale;
|
||||
#if defined(__WXGTK__)
|
||||
y_offset = 0;
|
||||
#endif
|
||||
|
||||
wxCoord y = std::floor(v_center - lineHeight * 0.50 - y_offset);
|
||||
|
||||
for (char c : str) {
|
||||
|
||||
@@ -32,7 +32,6 @@ struct AgentInfo {
|
||||
std::string name; ///< Human-readable agent name, e.g. "Orca", "Bambu Lab"
|
||||
std::string version; ///< Agent version string, e.g. "1.0.0"
|
||||
std::string description; ///< Brief description of the agent's capabilities, e.g. "Orca printer agent"
|
||||
bool native_device_tab = true; ///< False when the native Device and Calibration tabs don't apply to the agent's printers
|
||||
};
|
||||
|
||||
struct PrinterConnectionParams
|
||||
|
||||
@@ -76,20 +76,16 @@ template<typename T> void register_agent()
|
||||
if (cloud_agent)
|
||||
agent->set_cloud_agent(cloud_agent);
|
||||
return agent;
|
||||
},
|
||||
info.native_device_tab);
|
||||
});
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
bool NetworkAgentFactory::register_printer_agent(const std::string& id, const std::string& display_name, PrinterAgentFactory factory,
|
||||
bool native_device_tab)
|
||||
bool NetworkAgentFactory::register_printer_agent(const std::string& id, const std::string& display_name, PrinterAgentFactory factory)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(s_registry_mutex);
|
||||
auto& agents = get_printer_agents();
|
||||
PrinterAgentInfo info(id, display_name, std::move(factory));
|
||||
info.native_device_tab = native_device_tab;
|
||||
return agents.emplace(id, std::move(info)).second;
|
||||
return agents.emplace(id, PrinterAgentInfo(id, display_name, std::move(factory))).second;
|
||||
}
|
||||
|
||||
bool NetworkAgentFactory::is_printer_agent_registered(const std::string& id)
|
||||
|
||||
@@ -31,7 +31,6 @@ struct PrinterAgentInfo
|
||||
std::string display_name; // e.g., "Orca Native", "Bambu Lab"
|
||||
std::string plugin_identifier; // Empty for built-ins, otherwise <plugin_key>;<uuid>;<capability_name>
|
||||
PrinterAgentFactory factory; // Function to create the agent
|
||||
bool native_device_tab = true; // See AgentInfo::native_device_tab
|
||||
|
||||
bool is_plugin() const { return !plugin_identifier.empty(); }
|
||||
PrinterAgentInfo(const std::string& id_, const std::string& display_name_, PrinterAgentFactory factory_)
|
||||
@@ -85,11 +84,9 @@ public:
|
||||
* @param id Unique identifier for the agent (e.g., "orca", "bbl")
|
||||
* @param display_name Human-readable name for UI
|
||||
* @param factory Factory function to create the agent
|
||||
* @param native_device_tab Whether the native Device and Calibration tabs apply to the agent's printers
|
||||
* @return true if registration succeeded, false if already registered
|
||||
*/
|
||||
static bool register_printer_agent(const std::string& id, const std::string& display_name, PrinterAgentFactory factory,
|
||||
bool native_device_tab = true);
|
||||
static bool register_printer_agent(const std::string& id, const std::string& display_name, PrinterAgentFactory factory);
|
||||
|
||||
/**
|
||||
* Check if an agent registry/config key is registered
|
||||
|
||||
@@ -46,8 +46,7 @@ QidiPrinterAgent::QidiPrinterAgent(std::string log_dir) : MoonrakerPrinterAgent(
|
||||
|
||||
AgentInfo QidiPrinterAgent::get_agent_info_static()
|
||||
{
|
||||
// The native Device and Calibration tabs have nothing to show for Qidi printers yet, so Fluidd's web Device tab is the only one
|
||||
return AgentInfo{"qidi", "Qidi", QidiPrinterAgent_VERSION, "Qidi printer agent", false};
|
||||
return AgentInfo{"qidi", "Qidi", QidiPrinterAgent_VERSION, "Qidi printer agent"};
|
||||
}
|
||||
|
||||
bool QidiPrinterAgent::fetch_filament_info(std::string dev_id, FilamentSyncMode /*sync_mode*/)
|
||||
|
||||
@@ -91,31 +91,80 @@ SCENARIO("Polygon flattening", "[ExtrusionEntity]") {
|
||||
}
|
||||
}
|
||||
|
||||
static ExtrusionPaths straight_path(const std::vector<double> &xs)
|
||||
static ExtrusionPaths path_through(const std::vector<Vec2d> &points)
|
||||
{
|
||||
ExtrusionPath path{erExternalPerimeter, 1.0, 0.45f, 0.2f};
|
||||
for (double x : xs)
|
||||
path.polyline.append(Point3::new_scale(x, 0., 0.));
|
||||
for (const Vec2d &point : points)
|
||||
path.polyline.append(Point3::new_scale(point.x(), point.y(), 0.));
|
||||
return {path};
|
||||
}
|
||||
|
||||
TEST_CASE("Scarf ramp ends on the next loop vertex instead of leaving a short stub", "[ExtrusionEntity]")
|
||||
static ExtrusionPaths straight_path(const std::vector<double> &xs)
|
||||
{
|
||||
std::vector<Vec2d> points;
|
||||
for (double x : xs)
|
||||
points.emplace_back(x, 0.);
|
||||
return path_through(points);
|
||||
}
|
||||
|
||||
TEST_CASE("Scarf ramp leaves no short stub before the next loop vertex", "[ExtrusionEntity]")
|
||||
{
|
||||
using Catch::Matchers::WithinAbs;
|
||||
// A 20 mm scarf in 10 steps: a remainder shorter than half a 2 mm step is snapped forward.
|
||||
// A 20 mm scarf in 10 steps: a remainder shorter than half a 2 mm step is merged away.
|
||||
const double slope_length = 20.;
|
||||
const double max_segment = scale_(slope_length / 10);
|
||||
|
||||
SECTION("a 0.09 mm remainder extends the ramp to the vertex") {
|
||||
SECTION("a 0.09 mm remainder before a vertex on the straight line skips that vertex") {
|
||||
ExtrusionPaths paths = straight_path({0., 5., 10., 15., 20.09, 25., 30.});
|
||||
ExtrusionLoopSloped loop(paths, 0., slope_length, max_segment, 0.);
|
||||
REQUIRE(loop.starts.size() == 1);
|
||||
REQUIRE(loop.ends.size() == 1);
|
||||
REQUIRE(loop.paths.size() == 1);
|
||||
CHECK_THAT(unscale_(loop.starts.front().polyline.last_point().x()), WithinAbs(20.09, 1e-3));
|
||||
CHECK_THAT(unscale_(loop.ends.front().polyline.last_point().x()), WithinAbs(20.09, 1e-3));
|
||||
CHECK_THAT(unscale_(loop.paths.front().polyline.first_point().x()), WithinAbs(20.09, 1e-3));
|
||||
CHECK_THAT(unscale_(loop.paths.front().polyline.lines().front().length()), WithinAbs(4.91, 1e-3));
|
||||
CHECK_THAT(unscale_(loop.starts.front().polyline.last_point().x()), WithinAbs(20., 1e-3));
|
||||
CHECK_THAT(unscale_(loop.ends.front().polyline.last_point().x()), WithinAbs(20., 1e-3));
|
||||
const Polyline3 &flat = loop.paths.front().polyline;
|
||||
CHECK_THAT(unscale_(flat.first_point().x()), WithinAbs(20., 1e-3));
|
||||
CHECK_THAT(unscale_(flat.lines().front().length()), WithinAbs(5., 1e-3));
|
||||
CHECK_THAT(unscale_(flat.last_point().x()), WithinAbs(30., 1e-3));
|
||||
}
|
||||
|
||||
SECTION("the ramp ends at the same place whichever vertex the loop has just past it") {
|
||||
// One layer's wall has a vertex 0.1 mm past the scarf length, the next layer's 0.4 mm past it.
|
||||
for (double vertex : {20.1, 20.4}) {
|
||||
ExtrusionPaths paths = straight_path({0., 5., 10., 15., vertex, 25., 30.});
|
||||
ExtrusionLoopSloped loop(paths, 0., slope_length, max_segment, 0.);
|
||||
REQUIRE(loop.paths.size() == 1);
|
||||
CHECK_THAT(unscale_(loop.starts.front().polyline.last_point().x()), WithinAbs(20., 1e-3));
|
||||
CHECK_THAT(unscale_(loop.paths.front().polyline.lines().front().length()), WithinAbs(5., 1e-3));
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("a slight bend within the window is skipped, a corner is not") {
|
||||
// Skipping a vertex 0.3 mm past the ramp moves the path by 0.3 mm times the sine of its turn:
|
||||
// 0.026 mm at 5 degrees, 0.15 mm at 30 degrees, against a tolerance of 0.05 mm.
|
||||
ExtrusionPaths bend = path_through({{0., 0.}, {5., 0.}, {10., 0.}, {15., 0.}, {20.3, 0.}, {25.28, 0.436}, {30.26, 0.872}});
|
||||
ExtrusionLoopSloped bend_loop(bend, 0., slope_length, max_segment, 0.);
|
||||
REQUIRE(bend_loop.paths.size() == 1);
|
||||
CHECK_THAT(unscale_(bend_loop.starts.front().polyline.last_point().x()), WithinAbs(20., 1e-3));
|
||||
CHECK(bend_loop.paths.front().polyline.size() == 3);
|
||||
|
||||
ExtrusionPaths corner = path_through({{0., 0.}, {5., 0.}, {10., 0.}, {15., 0.}, {20.3, 0.}, {24.63, 2.5}, {28.96, 5.}});
|
||||
ExtrusionLoopSloped corner_loop(corner, 0., slope_length, max_segment, 0.);
|
||||
REQUIRE(corner_loop.paths.size() == 1);
|
||||
CHECK_THAT(unscale_(corner_loop.starts.front().polyline.last_point().x()), WithinAbs(20.3, 1e-3));
|
||||
CHECK(corner_loop.paths.front().polyline.size() == 3);
|
||||
}
|
||||
|
||||
SECTION("the ramp that ends in a loop's second path keeps its exact length too") {
|
||||
ExtrusionPaths paths = straight_path({0., 5., 12.});
|
||||
ExtrusionPaths rest = straight_path({12., 15., 20.2, 25., 30.});
|
||||
paths.push_back(rest.front());
|
||||
ExtrusionLoopSloped loop(paths, 0., slope_length, max_segment, 0.);
|
||||
REQUIRE(loop.starts.size() == 2);
|
||||
REQUIRE(loop.paths.size() == 1);
|
||||
CHECK_THAT(unscale_(loop.starts.back().polyline.last_point().x()), WithinAbs(20., 1e-3));
|
||||
CHECK_THAT(unscale_(loop.paths.front().polyline.first_point().x()), WithinAbs(20., 1e-3));
|
||||
CHECK_THAT(unscale_(loop.paths.front().polyline.lines().front().length()), WithinAbs(5., 1e-3));
|
||||
}
|
||||
|
||||
SECTION("a remainder longer than half a step keeps the exact scarf length") {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <limits>
|
||||
#include "libslic3r/Line.hpp"
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include <cstddef>
|
||||
@@ -128,6 +129,44 @@ template<typename KeepLine> std::vector<double> outer_wall_feed_rates(const std:
|
||||
return feed_rates;
|
||||
}
|
||||
|
||||
std::vector<double> bridge_center_feed_rates(const std::string& gcode)
|
||||
{
|
||||
struct BridgeMove { double start_x, end_x, speed; };
|
||||
std::vector<BridgeMove> bridge_moves;
|
||||
bool bridge = false;
|
||||
GCodeReader parser;
|
||||
parser.parse_buffer(gcode, [&bridge_moves, &bridge](GCodeReader& self, const GCodeReader::GCodeLine& line) {
|
||||
const std::string_view comment = line.comment();
|
||||
if (comment.find("FEATURE:") != std::string_view::npos || comment.find("TYPE:") != std::string_view::npos)
|
||||
bridge = comment.find("Bridge") != std::string_view::npos && comment.find("Internal Bridge") == std::string_view::npos;
|
||||
|
||||
const double start_x = self.x();
|
||||
const double end_x = line.new_X(self);
|
||||
if (bridge && line.extruding(self) && std::abs(line.new_Z(self) - 5.2) < 0.01 &&
|
||||
std::abs(end_x - start_x) > 1.0)
|
||||
bridge_moves.push_back({start_x, end_x, line.new_F(self) / MM_PER_MIN});
|
||||
});
|
||||
|
||||
if (bridge_moves.empty())
|
||||
return {};
|
||||
|
||||
double min_x = std::numeric_limits<double>::max();
|
||||
double max_x = std::numeric_limits<double>::lowest();
|
||||
for (const BridgeMove& move : bridge_moves) {
|
||||
min_x = std::min({min_x, move.start_x, move.end_x});
|
||||
max_x = std::max({max_x, move.start_x, move.end_x});
|
||||
}
|
||||
|
||||
const double center_margin = 0.25 * (max_x - min_x);
|
||||
std::vector<double> feed_rates;
|
||||
for (const BridgeMove& move : bridge_moves) {
|
||||
const double mid_x = 0.5 * (move.start_x + move.end_x);
|
||||
if (mid_x > min_x + center_margin && mid_x < max_x - center_margin)
|
||||
feed_rates.push_back(move.speed);
|
||||
}
|
||||
return feed_rates;
|
||||
}
|
||||
|
||||
// The caged 45 degree overhang: outer walls crossing the sloped face for most of its width, on the
|
||||
// layers where the face genuinely overhangs.
|
||||
// Both ends are tested against the slope plane rather than requiring a constant Y. Arachne's
|
||||
@@ -729,6 +768,31 @@ TEST_CASE("Curled walls are estimated only when overhang speed and the slowdown
|
||||
CHECK(has_curled_lines(*cage.object) == estimated);
|
||||
}
|
||||
|
||||
TEST_CASE("Bridge infill keeps bridge speed with curled perimeter slowdown", "[ExtrusionProcessor][Regression]")
|
||||
{
|
||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
||||
config.set_deserialize_strict({
|
||||
{"initial_layer_print_height", "0.2"},
|
||||
{"layer_height", "0.2"},
|
||||
{"enable_overhang_speed", "1"},
|
||||
{"slowdown_for_curled_perimeters", "1"},
|
||||
{"overhang_1_4_speed", "0"},
|
||||
{"overhang_2_4_speed", "50"},
|
||||
{"overhang_3_4_speed", "30"},
|
||||
{"overhang_4_4_speed", "10"},
|
||||
{"bridge_speed", "45"},
|
||||
{"filament_max_volumetric_speed", "1000"},
|
||||
{"slow_down_for_layer_cooling", "0"},
|
||||
{"slow_down_layers", "0"},
|
||||
});
|
||||
|
||||
const std::vector<double> feed_rates = bridge_center_feed_rates(slice({TestMesh::bridge}, config));
|
||||
|
||||
REQUIRE_FALSE(feed_rates.empty());
|
||||
for (const double feed_rate : feed_rates)
|
||||
CHECK_THAT(feed_rate, Catch::Matchers::WithinAbs(45.0, 0.5));
|
||||
}
|
||||
|
||||
TEST_CASE("Curled walls are estimated when overhang speed and the slowdown for curled perimeters are on in different objects", "[ExtrusionProcessor]")
|
||||
{
|
||||
const std::vector<std::vector<ConfigBase::SetDeserializeItem>> overrides{
|
||||
|
||||
@@ -1372,9 +1372,14 @@ TEST_CASE("Belt printers refuse an object taller than the gantry clearance", "[P
|
||||
// On a belt every tilted layer starts on the belt, so "the first layers" the fan stays off
|
||||
// for are a band along the belt, not the first slicing layers. The generator marks where
|
||||
// each extrusion segment enters and leaves that band and the cooling buffer keeps the fan
|
||||
// off inside it, on every layer.
|
||||
// off inside it, on every layer. The lowest wall of each tilted layer rests on the belt with
|
||||
// its nozzle half a layer plus half its width up (0.1 + 0.21 mm here), so a band of one
|
||||
// first layer has to be judged from the bead, not the nozzle, to hold it.
|
||||
TEST_CASE("Belt printers keep the part fan off within the band above the belt", "[Print][belt][Cooling]")
|
||||
{
|
||||
// Fan-off layers, and the gantry Y below which an extrusion is well inside that band.
|
||||
const auto [fan_off_layers, band_y] = GENERATE(table<int, double>({ { 1, 0.35 }, { 3, 0.45 } }));
|
||||
CAPTURE(fan_off_layers);
|
||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "belt_printer", 1 },
|
||||
@@ -1387,9 +1392,8 @@ TEST_CASE("Belt printers keep the part fan off within the band above the belt",
|
||||
{ "initial_layer_print_height", 0.2 },
|
||||
{ "skirt_loops", 0 },
|
||||
{ "z_hop", 0 },
|
||||
// Three layers, 0.6 mm: the lowest wall of each tilted layer is centred about 0.3 mm
|
||||
// above the belt (half a line width in from the contact edge).
|
||||
{ "close_fan_the_first_x_layers", 3 },
|
||||
{ "outer_wall_line_width", 0.42 },
|
||||
{ "close_fan_the_first_x_layers", fan_off_layers },
|
||||
{ "full_fan_speed_layer", 0 },
|
||||
{ "fan_min_speed", 100 },
|
||||
{ "fan_max_speed", 100 },
|
||||
@@ -1406,9 +1410,9 @@ TEST_CASE("Belt printers keep the part fan off within the band above the belt",
|
||||
CHECK(gcode.find(";_BELT_BAND") == std::string::npos);
|
||||
|
||||
// With this axis mapping machine Y is the height above the belt along the gantry. Walk
|
||||
// the moves with the fan state: extrusions that stay within 0.45 mm of the belt are well
|
||||
// inside the band and must print with the fan off; extrusions that stay 5 mm clear of it
|
||||
// must print with it on. The first three slicing layers have the fan off altogether.
|
||||
// the moves with the fan state: extrusions that stay below band_y are well inside the band
|
||||
// and must print with the fan off; extrusions that stay 5 mm clear of it must print with
|
||||
// it on. The first fan_off_layers slicing layers have the fan off altogether.
|
||||
size_t in_band = 0, in_band_fan_on = 0, clear = 0, clear_fan_off = 0;
|
||||
int layer = -1;
|
||||
bool fan_on = false;
|
||||
@@ -1430,8 +1434,8 @@ TEST_CASE("Belt printers keep the part fan off within the band above the belt",
|
||||
continue;
|
||||
const double y_new = std::atof(cmd.c_str() + ypos + 2);
|
||||
const bool extruding = epos != std::string::npos && std::atof(cmd.c_str() + epos + 2) > 0.;
|
||||
if (extruding && layer >= 3) {
|
||||
if (std::max(y, y_new) < 0.45) {
|
||||
if (extruding && layer >= fan_off_layers) {
|
||||
if (std::max(y, y_new) < band_y) {
|
||||
++ in_band;
|
||||
in_band_fan_on += fan_on;
|
||||
} else if (std::min(y, y_new) > 5.) {
|
||||
@@ -1448,6 +1452,144 @@ TEST_CASE("Belt printers keep the part fan off within the band above the belt",
|
||||
CHECK(clear_fan_off == 0);
|
||||
}
|
||||
|
||||
// On a belt one wall loop runs from the belt up the part, and whether a path is on the first
|
||||
// layer, and its step of the slow_down_layers ramp, set its speed, flow and acceleration as a
|
||||
// whole. Each part of the loop must take the settings of its own height above the belt,
|
||||
// wherever the seam starts the loop.
|
||||
TEST_CASE("Belt printers use first-layer settings only where a wall rests on the belt", "[Print][belt][Regression]")
|
||||
{
|
||||
const std::string seam = GENERATE("back", "random");
|
||||
const int slow_down_layers = GENERATE(0, 4);
|
||||
CAPTURE(seam, slow_down_layers);
|
||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "belt_printer", 1 },
|
||||
{ "belt_slice_rotation", "x" },
|
||||
{ "belt_slice_rotation_angle", 45 },
|
||||
{ "gcode_remap_x", "rev_x" },
|
||||
{ "gcode_remap_y", "pos_z" },
|
||||
{ "gcode_remap_z", "pos_y" },
|
||||
{ "layer_height", 0.2 },
|
||||
{ "initial_layer_print_height", 0.2 },
|
||||
{ "skirt_loops", 0 },
|
||||
{ "brim_type", "no_brim" },
|
||||
{ "z_hop", 0 },
|
||||
{ "wall_generator", "classic" },
|
||||
{ "outer_wall_line_width", 0.42 },
|
||||
{ "seam_position", seam },
|
||||
// One path per wall loop, so nothing but the edges of the bands cut it.
|
||||
{ "detect_overhang_wall", 0 },
|
||||
{ "enable_overhang_speed", 0 },
|
||||
{ "initial_layer_speed", 10 },
|
||||
{ "outer_wall_speed", 40 },
|
||||
{ "slow_down_layers", slow_down_layers },
|
||||
{ "filament_max_volumetric_speed", 20 },
|
||||
{ "slow_down_for_layer_cooling", 0 },
|
||||
{ "set_other_flow_ratios", 1 },
|
||||
{ "first_layer_flow_ratio", 0.8 },
|
||||
{ "machine_start_gcode", "T[initial_tool]\n" },
|
||||
{ "layer_change_gcode", "G92 E0\n" },
|
||||
});
|
||||
const std::string gcode = slice({ cube(20) }, config);
|
||||
|
||||
// As above, machine Y is the height above the belt. The outer wall's nozzle is half its
|
||||
// width, 0.21 mm, higher than the belt under its edge, so the first layer, up to 0.2 mm,
|
||||
// ends at Y = 0.41 and step k of the ramp spans Y = 0.21 + [0.2 k, 0.2 (k + 1)). Its wall
|
||||
// resting on the belt is at Y = 0.31.
|
||||
const double ramp_step_2 = 10. + (40. - 10.) * 2. / 4.;
|
||||
std::vector<double> in_band_e, clear_e; // E per mm
|
||||
size_t in_band = 0, in_band_fast = 0, step_2 = 0, step_2_off = 0, clear = 0, clear_slow = 0;
|
||||
std::string type;
|
||||
GCodeReader reader;
|
||||
reader.parse_buffer(gcode, [&](GCodeReader &self, const GCodeReader::GCodeLine &line) {
|
||||
if (boost::starts_with(line.raw(), ";TYPE:")) {
|
||||
type = line.raw().substr(6);
|
||||
return;
|
||||
}
|
||||
if (type != "Outer wall" || ! line.extruding(self) || line.dist_XY(self) <= EPSILON)
|
||||
return;
|
||||
const double y_lo = std::min(self.y(), line.new_Y(self));
|
||||
const double y_hi = std::max(self.y(), line.new_Y(self));
|
||||
const double f = line.new_F(self);
|
||||
// Long moves only for the flow, so that the rounding of E does not blur it.
|
||||
const bool long_move = line.dist_XY(self) >= 0.5;
|
||||
if (y_hi < 0.35) {
|
||||
++ in_band;
|
||||
in_band_fast += std::abs(f - 10. * 60.) > 1.;
|
||||
if (long_move)
|
||||
in_band_e.push_back(line.dist_E(self) / line.dist_XY(self));
|
||||
} else if (slow_down_layers == 4 && y_lo > 0.61 - 1e-3 && y_hi < 0.81 + 1e-3) {
|
||||
++ step_2;
|
||||
step_2_off += std::abs(f - ramp_step_2 * 60.) > 1.;
|
||||
} else if (y_lo > 1.5) {
|
||||
++ clear;
|
||||
clear_slow += std::abs(f - 40. * 60.) > 1.;
|
||||
if (long_move)
|
||||
clear_e.push_back(line.dist_E(self) / line.dist_XY(self));
|
||||
}
|
||||
});
|
||||
REQUIRE(in_band > 20);
|
||||
REQUIRE(clear > 20);
|
||||
CHECK(in_band_fast == 0);
|
||||
CHECK(clear_slow == 0);
|
||||
if (slow_down_layers == 4) {
|
||||
REQUIRE(step_2 > 10);
|
||||
CHECK(step_2_off == 0);
|
||||
}
|
||||
// first_layer_flow_ratio on the belt and nowhere else.
|
||||
auto median = [](std::vector<double> v) {
|
||||
std::nth_element(v.begin(), v.begin() + v.size() / 2, v.end());
|
||||
return v[v.size() / 2];
|
||||
};
|
||||
CHECK_THAT(median(in_band_e) / median(clear_e), Catch::Matchers::WithinRel(0.8, 0.02));
|
||||
}
|
||||
|
||||
// Small-area flow compensation scales a line's flow by the line's length. The cuts a belt path
|
||||
// gets at the edges of the bands above the belt must not make it see the pieces as short lines.
|
||||
TEST_CASE("Belt band cuts leave small-area flow compensation unchanged", "[Print][belt][Regression]")
|
||||
{
|
||||
// Plastic per role. The slow_down_layers ramp adds band edges every 0.2 mm above the belt,
|
||||
// here up to well past the top of the part, and with them cuts through the solid infill
|
||||
// under its top face, but changes nothing else about how much plastic is laid.
|
||||
auto plastic = [](int slow_down_layers) {
|
||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "belt_printer", 1 },
|
||||
{ "belt_slice_rotation", "x" },
|
||||
{ "belt_slice_rotation_angle", 45 },
|
||||
{ "gcode_remap_x", "rev_x" },
|
||||
{ "gcode_remap_y", "pos_z" },
|
||||
{ "gcode_remap_z", "pos_y" },
|
||||
{ "layer_height", 0.2 },
|
||||
{ "initial_layer_print_height", 0.2 },
|
||||
{ "skirt_loops", 0 },
|
||||
{ "brim_type", "no_brim" },
|
||||
{ "z_hop", 0 },
|
||||
{ "bottom_shell_layers", 4 },
|
||||
{ "internal_solid_infill_pattern", "monotonic" },
|
||||
{ "small_area_infill_flow_compensation", 1 },
|
||||
{ "slow_down_layers", slow_down_layers },
|
||||
{ "machine_start_gcode", "T[initial_tool]\n" },
|
||||
{ "layer_change_gcode", "G92 E0\n" },
|
||||
});
|
||||
std::map<std::string, double> e;
|
||||
std::string type;
|
||||
GCodeReader reader;
|
||||
reader.parse_buffer(slice({ cube(20) }, config), [&](GCodeReader &self, const GCodeReader::GCodeLine &line) {
|
||||
if (boost::starts_with(line.raw(), ";TYPE:"))
|
||||
type = line.raw().substr(6);
|
||||
else if (line.extruding(self) && line.dist_XY(self) > EPSILON)
|
||||
e[type] += line.dist_E(self);
|
||||
});
|
||||
return e;
|
||||
};
|
||||
const std::map<std::string, double> uncut = plastic(0);
|
||||
const std::map<std::string, double> cut = plastic(200);
|
||||
REQUIRE(uncut.count("Internal solid infill") == 1);
|
||||
REQUIRE(cut.count("Internal solid infill") == 1);
|
||||
CHECK_THAT(cut.at("Internal solid infill"), Catch::Matchers::WithinRel(uncut.at("Internal solid infill"), 1e-4));
|
||||
}
|
||||
|
||||
// Organic supports under an overhang on a belt printer reach below the object's first layer,
|
||||
// where the virtual belt raft layers sit at negative Z. The lowest of them used to get a
|
||||
// negative height and abort slicing with a negative flow error.
|
||||
@@ -2312,3 +2454,154 @@ TEST_CASE("Objects on extruders with different layer height limits can share a p
|
||||
INFO(error.string);
|
||||
CHECK(error.string.empty());
|
||||
}
|
||||
|
||||
TEST_CASE("Belt printers apply the Z shrinkage compensation to the slicing height once", "[Print][belt][Regression]")
|
||||
{
|
||||
// A 20 mm cube printed with a filament that shrinks to xy % / z % is sliced like an uncompensated box
|
||||
// 20 * 100 / xy wide and 20 * 100 / z tall. The span of the layers is compared, as the belt Z offset
|
||||
// depends on where the object is centred.
|
||||
const auto [xy, z, angle] = GENERATE(table<double, double, double>({ { 100., 95., 45. }, { 100., 105., 45. }, { 90., 95., 45. }, { 100., 105., 0. } }));
|
||||
const auto sliced_height = [](const TriangleMesh &mesh, double xy, double z, double angle) {
|
||||
DynamicPrintConfig config = belt_test_config();
|
||||
config.set_deserialize_strict({ { "filament_shrink", xy }, { "filament_shrinkage_compensation_z", z }, { "belt_slice_rotation_angle", angle } });
|
||||
Print print;
|
||||
init_and_process_print({ mesh }, print, config);
|
||||
const PrintObject &object = *print.objects().front();
|
||||
return std::make_pair(object.slicing_parameters().object_print_z_max,
|
||||
object.layers().back()->print_z - object.layers().front()->print_z);
|
||||
};
|
||||
|
||||
const auto [compensated_max_z, compensated_span] = sliced_height(cube(20.), xy, z, angle);
|
||||
const auto [expected_max_z, expected_span] = sliced_height(make_cube(20. * 100. / xy, 20. * 100. / xy, 20. * 100. / z), 100., 100., angle);
|
||||
CHECK_THAT(compensated_max_z, Catch::Matchers::WithinAbs(expected_max_z, EPSILON));
|
||||
CHECK_THAT(compensated_span, Catch::Matchers::WithinAbs(expected_span, 0.2 * 100. / z));
|
||||
}
|
||||
|
||||
TEST_CASE("The belt build height check uses the compensated height", "[Print][belt][validate][Regression]")
|
||||
{
|
||||
// printable_height is 100 mm. Z shrinkage 105 % prints 101 mm at about 96.2 mm, which fits, and 106 mm at
|
||||
// about 101 mm, which does not; with 95 % a 97 mm object only becomes too tall through the compensation.
|
||||
const auto [z, height, expected] = GENERATE(table<double, double, std::string>({
|
||||
{ 105., 101., "" },
|
||||
{ 105., 106., "exceeds the maximum build volume height." },
|
||||
{ 95., 92., "" },
|
||||
{ 95., 97., "because of material shrinkage compensation" },
|
||||
}));
|
||||
DynamicPrintConfig config = belt_test_config();
|
||||
config.set_deserialize_strict({ { "printable_height", 100. }, { "filament_shrinkage_compensation_z", z } });
|
||||
|
||||
Print print;
|
||||
Model model;
|
||||
init_print({ make_cube(20., 20., height) }, print, model, config);
|
||||
const std::string error = print.validate().string;
|
||||
INFO(error);
|
||||
if (expected.empty())
|
||||
CHECK(error.empty());
|
||||
else
|
||||
CHECK(error.find(expected) != std::string::npos);
|
||||
}
|
||||
|
||||
// A 20 mm cube on the bed with a height range override.
|
||||
static ModelObject* cube_with_height_range(Model &model, const t_layer_height_range &range, DynamicPrintConfig &&range_config)
|
||||
{
|
||||
ModelObject *object = model.add_object();
|
||||
object->add_volume(cube(20.));
|
||||
// Every layer range must carry a layer_height (see layer_height_profile_from_ranges).
|
||||
object->layer_config_ranges[range].assign_config(std::move(range_config));
|
||||
object->add_instance()->set_offset(Vec3d(90., 90., 0.));
|
||||
object->ensure_on_bed();
|
||||
return object;
|
||||
}
|
||||
|
||||
static DynamicPrintConfig height_range_test_config(double shrinkage_z)
|
||||
{
|
||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "filament_shrinkage_compensation_z", shrinkage_z },
|
||||
{ "layer_height", 0.2 },
|
||||
{ "initial_layer_print_height", 0.2 },
|
||||
{ "precise_z_height", false },
|
||||
{ "sparse_infill_density", "15%" },
|
||||
});
|
||||
return config;
|
||||
}
|
||||
|
||||
// The 0.1 mm / 50 % height range [10, 15] has to print both its layer height and its infill from 10 * 100 / z
|
||||
// up to 15 * 100 / z of the object.
|
||||
static void check_thin_dense_height_range(const PrintObject &print_object, double shrinkage_z)
|
||||
{
|
||||
size_t mismatched = 0;
|
||||
double first_dense_z = -1.;
|
||||
for (const Layer *layer : print_object.layers()) {
|
||||
const bool thin = layer->height < 0.15;
|
||||
const bool dense = std::any_of(layer->regions().begin(), layer->regions().end(), [](const LayerRegion *region) {
|
||||
return ! region->slices.empty() && region->region().config().sparse_infill_density.value > 40.;
|
||||
});
|
||||
if (thin != dense)
|
||||
++ mismatched;
|
||||
if (dense && first_dense_z < 0.)
|
||||
first_dense_z = layer->slice_z;
|
||||
}
|
||||
CHECK(mismatched == 0);
|
||||
CHECK_THAT(first_dense_z, Catch::Matchers::WithinAbs(10. * 100. / shrinkage_z, 0.2));
|
||||
}
|
||||
|
||||
static DynamicPrintConfig thin_dense_height_range()
|
||||
{
|
||||
DynamicPrintConfig range;
|
||||
range.set_key_value("layer_height", new ConfigOptionFloat(0.1));
|
||||
range.set_key_value("sparse_infill_density", new ConfigOptionPercent(50));
|
||||
return range;
|
||||
}
|
||||
|
||||
TEST_CASE("A height range above the object keeps its layer height up to the compensated top", "[Print][Regression]")
|
||||
{
|
||||
// The range [10, 100] covers the top of the 20 mm cube, which the Z shrinkage compensation moves to 20 * 100 / z.
|
||||
const double z = GENERATE(95., 105.);
|
||||
DynamicPrintConfig range;
|
||||
range.set_key_value("layer_height", new ConfigOptionFloat(0.1));
|
||||
Model model;
|
||||
cube_with_height_range(model, { 10., 100. }, std::move(range));
|
||||
Print print;
|
||||
print.apply(model, height_range_test_config(z));
|
||||
print.process();
|
||||
|
||||
const PrintObject &print_object = *print.objects().front();
|
||||
CHECK_THAT(print_object.layers().back()->print_z, Catch::Matchers::WithinAbs(20. * 100. / z, 0.1));
|
||||
const size_t thick_layers_in_range = std::count_if(print_object.layers().begin(), print_object.layers().end(),
|
||||
[z](const Layer *layer) { return layer->slice_z > 11. * 100. / z && layer->height > 0.15; });
|
||||
CHECK(thick_layers_in_range == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Height range settings apply where the height range prints", "[Print][Regression]")
|
||||
{
|
||||
// The range [10, 15] prints with 0.1 mm layers and 50 % infill. The Z shrinkage compensation moves both
|
||||
// to 10 * 100 / z ... 15 * 100 / z.
|
||||
const double z = GENERATE(100., 95., 105.);
|
||||
Model model;
|
||||
cube_with_height_range(model, { 10., 15. }, thin_dense_height_range());
|
||||
Print print;
|
||||
print.apply(model, height_range_test_config(z));
|
||||
print.process();
|
||||
|
||||
check_thin_dense_height_range(*print.objects().front(), z);
|
||||
}
|
||||
|
||||
TEST_CASE("Height range settings follow a Z shrinkage change that comes with a modifier change", "[Print][Regression]")
|
||||
{
|
||||
// Adding a modifier lets Print::apply() reuse the cached regions; the cached height ranges were
|
||||
// compensated for the old Z shrinkage.
|
||||
Model model;
|
||||
ModelObject *object = cube_with_height_range(model, { 10., 15. }, thin_dense_height_range());
|
||||
Print print;
|
||||
print.apply(model, height_range_test_config(100.));
|
||||
print.process();
|
||||
|
||||
DynamicPrintConfig modifier_config;
|
||||
modifier_config.set_key_value("wall_loops", new ConfigOptionInt(3));
|
||||
object->add_volume(cube(5.), ModelVolumeType::PARAMETER_MODIFIER, false)->config.apply(modifier_config);
|
||||
print.apply(model, height_range_test_config(95.));
|
||||
print.process();
|
||||
|
||||
check_thin_dense_height_range(*print.objects().front(), 95.);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include "libslic3r/Polygon.hpp"
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "libslic3r/Polyline.hpp"
|
||||
@@ -1409,22 +1410,30 @@ TEST_CASE("Belt brim coexists with support material", "[SkirtBrim][belt]")
|
||||
CHECK(role_passes(gc, "brim") > 0);
|
||||
}
|
||||
|
||||
// With a 0.3 mm first layer at 45 degrees the brim band on the belt is wider than one bead,
|
||||
// so its lines go on the nominal lattice instead of at a fixed fraction of the band. A
|
||||
// lattice line can then land where the belt is almost at the band's print_z; it must be
|
||||
// moved uphill to the same 0.75 fraction the single-line case uses, not laid scraping the
|
||||
// belt with its flow clamped to half a layer.
|
||||
// On a shallow belt (25 degrees, 0.3 mm layers) the brim band on the belt is wider than one
|
||||
// bead, so its lines go on the nominal lattice instead of at one fixed clearance. A lattice
|
||||
// line can then land where the belt is almost at the band's print_z; it must be moved to the
|
||||
// clearance of the object's outer wall, where every line of a steep belt sits, not laid
|
||||
// scraping the belt with its flow clamped to half a layer.
|
||||
TEST_CASE("Belt brim lattice lines keep their clearance above the belt", "[SkirtBrim][belt]")
|
||||
{
|
||||
const double layer_height = 0.3;
|
||||
const double wall_width = 0.42;
|
||||
const double tilt_deg = 25.;
|
||||
DynamicPrintConfig config = belt_brim_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "layer_height", 0.3 },
|
||||
{ "initial_layer_print_height", 0.3 },
|
||||
{ "belt_slice_rotation_angle", tilt_deg },
|
||||
{ "layer_height", layer_height },
|
||||
{ "initial_layer_print_height", layer_height },
|
||||
{ "outer_wall_line_width", wall_width },
|
||||
{ "brim_type", "outer_only" },
|
||||
{ "brim_width", 4 },
|
||||
{ "brim_object_gap", 0 },
|
||||
});
|
||||
const std::string gcode = slice({ cube(20) }, config);
|
||||
// Along slice Z: half a layer down to where the slice meets the belt, then half a wall
|
||||
// width inwards, where the belt lies lower by that times tan(tilt).
|
||||
const double wall_clearance = 0.5 * layer_height + 0.5 * wall_width * std::tan(Geometry::deg2rad(tilt_deg));
|
||||
|
||||
// Heights of the brim extrusions, from the ;HEIGHT: tags inside ;TYPE:Brim sections.
|
||||
std::vector<double> brim_heights;
|
||||
@@ -1437,12 +1446,246 @@ TEST_CASE("Belt brim lattice lines keep their clearance above the belt", "[Skirt
|
||||
brim_heights.push_back(std::stod(line.substr(8)));
|
||||
}
|
||||
REQUIRE(! brim_heights.empty());
|
||||
// Lattice lines have clearances of their own; a single clearance would mean the band
|
||||
// took the steep-belt branch and the lattice went untested.
|
||||
std::set<long> distinct_heights;
|
||||
for (const double h : brim_heights)
|
||||
distinct_heights.insert(std::lround(h * 1000.));
|
||||
REQUIRE(distinct_heights.size() > 1);
|
||||
for (const double h : brim_heights) {
|
||||
CHECK(h >= 0.75 * 0.3 - 1e-3);
|
||||
CHECK(h <= 0.3 + 1e-3);
|
||||
CHECK(h >= wall_clearance - 1e-3);
|
||||
CHECK(h <= layer_height + 1e-3);
|
||||
}
|
||||
}
|
||||
|
||||
// Lowest gantry Y of the `type` extrusions on each layer, keyed by machine Z, which is the
|
||||
// belt position and therefore one value per tilted layer. Under the belt remap the gantry is
|
||||
// the height above the belt, so for a role resting on the belt this is its nozzle clearance.
|
||||
static std::map<long, double> belt_layer_lowest_y(const std::string &gcode, const std::string &type)
|
||||
{
|
||||
std::map<long, double> lowest;
|
||||
bool in_type = false;
|
||||
GCodeReader reader;
|
||||
reader.parse_buffer(gcode, [&](GCodeReader &self, const GCodeReader::GCodeLine &line) {
|
||||
if (boost::starts_with(line.raw(), ";TYPE:")) {
|
||||
in_type = line.raw().substr(6) == type;
|
||||
return;
|
||||
}
|
||||
if (! in_type || ! line.extruding(self) || line.dist_XY(self) <= EPSILON)
|
||||
return;
|
||||
const double y = std::min(self.y(), line.new_Y(self));
|
||||
auto [it, inserted] = lowest.emplace(std::lround(line.new_Z(self) * 1000.), y);
|
||||
if (! inserted)
|
||||
it->second = std::min(it->second, y);
|
||||
});
|
||||
return lowest;
|
||||
}
|
||||
|
||||
// The brim is the first thing laid on the belt, so it is what a user levels the belt height
|
||||
// against (endstop, extruder offset). Its lines must then sit exactly as high above the belt
|
||||
// as the object's outer wall does where it rests on the belt, or a belt levelled for the brim
|
||||
// lays the part too high to stick.
|
||||
TEST_CASE("Belt brim sits as high above the belt as the object's outer wall", "[SkirtBrim][belt][Regression]")
|
||||
{
|
||||
const double layer_height = GENERATE(0.2, 0.32);
|
||||
// A wider first-layer line widens only the walls of object layer 0, so it must not lift
|
||||
// the brim off the walls of the layers that rest on the belt. 0 keeps the outer wall's.
|
||||
const double first_width = GENERATE(0., 0.6);
|
||||
// XY contour compensation moves the slice's edge, and with it the wall, toward or away
|
||||
// from the belt, also by more than half the wall's width. Shrinking it by half a layer or
|
||||
// more lifts it off the belt's contact band, and the object gets no brim.
|
||||
const double compensation = GENERATE(0., 0.05, -0.05, 0.25);
|
||||
DYNAMIC_SECTION("layer_height=" << layer_height << " initial_layer_line_width=" << first_width
|
||||
<< " xy_contour_compensation=" << compensation) {
|
||||
const double wall_width = 0.4;
|
||||
DynamicPrintConfig config = belt_brim_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "layer_height", layer_height },
|
||||
{ "initial_layer_print_height", layer_height },
|
||||
{ "outer_wall_line_width", wall_width },
|
||||
{ "initial_layer_line_width", first_width },
|
||||
{ "xy_contour_compensation", compensation },
|
||||
{ "print_flow_ratio", 1 },
|
||||
{ "brim_flow_ratio", 1 },
|
||||
{ "filament_diameter", "1.75" },
|
||||
{ "brim_type", "outer_only" },
|
||||
{ "brim_width", 4 },
|
||||
{ "brim_object_gap", 0 },
|
||||
});
|
||||
const std::string gcode = slice({ cube(20) }, config);
|
||||
const std::map<long, double> brim = belt_layer_lowest_y(gcode, "Brim");
|
||||
const std::map<long, double> wall = belt_layer_lowest_y(gcode, "Outer wall");
|
||||
REQUIRE(! brim.empty());
|
||||
REQUIRE(! wall.empty());
|
||||
|
||||
// The wall's clearance on the layers it rests on the belt, i.e. the most common lowest
|
||||
// Y. Not the lowest one: the sliver at the first contact can carry a narrower wall,
|
||||
// which sits lower; and layers past the part's bottom face do not reach the belt.
|
||||
std::map<long, int> votes;
|
||||
for (const auto &[z, y] : wall)
|
||||
++ votes[std::lround(y * 1000.)];
|
||||
const auto typical = std::max_element(votes.begin(), votes.end(),
|
||||
[](const auto &a, const auto &b) { return a.second < b.second; });
|
||||
const double wall_y = 0.001 * typical->first;
|
||||
for (const auto &[z, y] : brim)
|
||||
CHECK_THAT(y, Catch::Matchers::WithinAbs(wall_y, 0.005));
|
||||
|
||||
// Each brim line fills the cell between it and the next, one band apart on the belt
|
||||
// (the layer height / sin(45 deg)) and as tall as its clearance (its ;HEIGHT:), also
|
||||
// where the clearance is small.
|
||||
const double filament_area = 0.25 * PI * 1.75 * 1.75;
|
||||
const double pitch = layer_height * std::sqrt(2.);
|
||||
size_t long_moves = 0;
|
||||
double clearance = 0.;
|
||||
bool in_brim = false;
|
||||
GCodeReader reader;
|
||||
reader.parse_buffer(gcode, [&](GCodeReader &self, const GCodeReader::GCodeLine &line) {
|
||||
if (boost::starts_with(line.raw(), ";TYPE:"))
|
||||
in_brim = line.raw().substr(6) == "Brim";
|
||||
else if (boost::starts_with(line.raw(), ";HEIGHT:"))
|
||||
clearance = std::stod(line.raw().substr(8));
|
||||
else if (in_brim && line.extruding(self) && line.dist_XY(self) >= 1.) {
|
||||
++ long_moves;
|
||||
CHECK_THAT(line.dist_E(self) / line.dist_XY(self) * filament_area,
|
||||
Catch::Matchers::WithinRel(pitch * clearance, 0.01));
|
||||
}
|
||||
});
|
||||
CHECK(long_moves > 20);
|
||||
}
|
||||
}
|
||||
|
||||
// A modifier that gives the part a narrower outer wall away from the belt shares the tilted
|
||||
// layers with the wall that rests on the belt. The brim must be levelled with the wall that
|
||||
// rests on the belt, not with the narrowest wall in the layer.
|
||||
TEST_CASE("Belt brim follows the wall that rests on the belt rather than a modifier's", "[SkirtBrim][belt][Regression]")
|
||||
{
|
||||
DynamicPrintConfig config = belt_brim_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "gcode_comments", 1 },
|
||||
{ "outer_wall_line_width", 0.6 },
|
||||
{ "brim_type", "outer_only" },
|
||||
{ "brim_width", 4 },
|
||||
{ "brim_object_gap", 0 },
|
||||
});
|
||||
// The top half of the cube, 10 mm and more above the belt, gets a 0.4 mm outer wall.
|
||||
DynamicPrintConfig modifier_config;
|
||||
modifier_config.set_deserialize_strict({ { "outer_wall_line_width", 0.4 } });
|
||||
TriangleMesh modifier = make_cube(22., 22., 11.);
|
||||
modifier.translate(-1.f, -1.f, 10.f);
|
||||
Print print;
|
||||
Model model;
|
||||
init_print({ cube(20) }, print, model, config, nullptr, false);
|
||||
model.objects.front()->add_volume(std::move(modifier), ModelVolumeType::PARAMETER_MODIFIER, false)->config.apply(modifier_config);
|
||||
print.apply(model, config);
|
||||
const std::string out = gcode(print);
|
||||
|
||||
// Both walls print.
|
||||
std::set<long> wall_widths;
|
||||
bool in_wall = false;
|
||||
std::istringstream lines(out);
|
||||
for (std::string line; std::getline(lines, line); ) {
|
||||
if (boost::starts_with(line, ";TYPE:"))
|
||||
in_wall = line.substr(6) == "Outer wall";
|
||||
else if (in_wall && boost::starts_with(line, ";WIDTH:"))
|
||||
wall_widths.insert(std::lround(std::stod(line.substr(7)) * 100.));
|
||||
}
|
||||
REQUIRE(wall_widths.count(40) == 1);
|
||||
REQUIRE(wall_widths.count(60) == 1);
|
||||
|
||||
const std::map<long, double> brim = belt_layer_lowest_y(out, "Brim");
|
||||
const std::map<long, double> wall = belt_layer_lowest_y(out, "Outer wall");
|
||||
REQUIRE(! brim.empty());
|
||||
std::map<long, int> votes;
|
||||
for (const auto &[z, y] : wall)
|
||||
++ votes[std::lround(y * 1000.)];
|
||||
const auto typical = std::max_element(votes.begin(), votes.end(),
|
||||
[](const auto &a, const auto &b) { return a.second < b.second; });
|
||||
const double wall_y = 0.001 * typical->first;
|
||||
// Half a 0.2 mm layer plus half the 0.6 mm wall, x tan(45 deg).
|
||||
CHECK_THAT(wall_y, Catch::Matchers::WithinAbs(0.1 + 0.3, 0.005));
|
||||
for (const auto &[z, y] : brim)
|
||||
CHECK_THAT(y, Catch::Matchers::WithinAbs(wall_y, 0.005));
|
||||
}
|
||||
|
||||
// The brim rests on the belt, so it prints, and is reached, with first-layer settings, even
|
||||
// though raising it to the outer wall's clearance puts the nozzle further above the belt than
|
||||
// one first layer. With thin layers its lines are also far narrower than a bead, as narrow as
|
||||
// the bands are far apart, so their width must not decide it either.
|
||||
TEST_CASE("Belt brim lines print with first-layer settings", "[SkirtBrim][belt][Regression]")
|
||||
{
|
||||
const double layer_height = GENERATE(0.2, 0.08);
|
||||
CAPTURE(layer_height);
|
||||
DynamicPrintConfig config = belt_brim_config();
|
||||
config.set_deserialize_strict({
|
||||
{ "layer_height", layer_height },
|
||||
{ "initial_layer_print_height", 0.2 },
|
||||
{ "outer_wall_line_width", 0.45 },
|
||||
{ "brim_type", "outer_only" },
|
||||
{ "brim_width", 4 },
|
||||
{ "brim_object_gap", 0 },
|
||||
{ "z_hop", 0 },
|
||||
{ "travel_speed", 200 },
|
||||
{ "initial_layer_travel_speed", 50 },
|
||||
{ "initial_layer_speed", 15 },
|
||||
{ "filament_max_volumetric_speed", 20 },
|
||||
{ "slow_down_for_layer_cooling", 0 },
|
||||
// The fan is on everywhere but in the band above the belt.
|
||||
{ "close_fan_the_first_x_layers", 1 },
|
||||
{ "full_fan_speed_layer", 0 },
|
||||
{ "fan_min_speed", 100 },
|
||||
{ "fan_max_speed", 100 },
|
||||
{ "fan_cooling_layer_time", 1000 },
|
||||
{ "reduce_fan_stop_start_freq", 0 },
|
||||
});
|
||||
const std::string gcode = slice({ cube(20) }, config);
|
||||
|
||||
// The feedrate of the last travel before each brim line, and the feedrate and fan of
|
||||
// each of its moves.
|
||||
size_t brim_lines = 0, fast_travels = 0, brim_moves = 0, brim_fast = 0, brim_fan_on = 0, fan_on_moves = 0;
|
||||
std::string type;
|
||||
double travel_f = 0.;
|
||||
bool travelled = false, fan_on = false;
|
||||
GCodeReader reader;
|
||||
reader.parse_buffer(gcode, [&](GCodeReader &self, const GCodeReader::GCodeLine &line) {
|
||||
if (boost::starts_with(line.raw(), ";TYPE:")) {
|
||||
type = line.raw().substr(6);
|
||||
return;
|
||||
}
|
||||
if (line.cmd_is("M107")) {
|
||||
fan_on = false;
|
||||
return;
|
||||
}
|
||||
if (line.cmd_is("M106")) {
|
||||
const size_t s = line.raw().find('S');
|
||||
fan_on = s != std::string::npos && std::atof(line.raw().c_str() + s + 1) > 0.;
|
||||
return;
|
||||
}
|
||||
if (! line.cmd_is("G1") || line.dist_XY(self) <= EPSILON)
|
||||
return;
|
||||
if (! line.extruding(self)) {
|
||||
travel_f = line.new_F(self);
|
||||
travelled = true;
|
||||
return;
|
||||
}
|
||||
fan_on_moves += fan_on;
|
||||
if (type == "Brim") {
|
||||
if (travelled) {
|
||||
++ brim_lines;
|
||||
fast_travels += std::abs(travel_f - 50. * 60.) > 1.;
|
||||
}
|
||||
++ brim_moves;
|
||||
brim_fast += std::abs(line.new_F(self) - 15. * 60.) > 1.;
|
||||
brim_fan_on += fan_on;
|
||||
}
|
||||
travelled = false;
|
||||
});
|
||||
REQUIRE(brim_lines > 20);
|
||||
REQUIRE(fan_on_moves > 0);
|
||||
CHECK(fast_travels == 0);
|
||||
CHECK(brim_fast == 0);
|
||||
CHECK(brim_fan_on == 0);
|
||||
}
|
||||
|
||||
// The brim prints in the object's outer wall filament even when every extrusion of the object
|
||||
// is offered to purging (flush_into_objects): the tool ordering registers the brim filament
|
||||
// itself, so the writer always knows it.
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
#include <libslic3r/MeshBoolean.hpp>
|
||||
#include <libslic3r/Point.hpp>
|
||||
#include <cstddef>
|
||||
#include <vector>
|
||||
|
||||
using namespace Slic3r;
|
||||
@@ -27,6 +29,41 @@ TEST_CASE("CGAL and TriangleMesh conversions", "[MeshBoolean]") {
|
||||
REQUIRE(! MeshBoolean::cgal::does_self_intersect(M));
|
||||
}
|
||||
|
||||
TEST_CASE("CGAL volume checks ignore unreferenced vertices", "[MeshBoolean][Regression]") {
|
||||
indexed_triangle_set mesh = its_make_cube(10., 10., 10.);
|
||||
// Leave isolated vertices before, between, and after the vertices used by faces.
|
||||
mesh.vertices.insert(mesh.vertices.begin(), Vec3f(-1.f, -1.f, -1.f));
|
||||
mesh.vertices.insert(mesh.vertices.begin() + 4, Vec3f(5.f, 5.f, 5.f));
|
||||
mesh.vertices.emplace_back(20.f, 20.f, 20.f);
|
||||
for (Vec3i32 &face : mesh.indices)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
face[i] += face[i] >= 3 ? 2 : 1;
|
||||
|
||||
auto cgal_mesh = MeshBoolean::cgal::triangle_mesh_to_cgal(mesh);
|
||||
REQUIRE(cgal_mesh);
|
||||
REQUIRE(MeshBoolean::cgal::does_bound_a_volume(*cgal_mesh));
|
||||
REQUIRE_FALSE(MeshBoolean::cgal::does_self_intersect(*cgal_mesh));
|
||||
|
||||
TriangleMesh result = MeshBoolean::cgal::cgal_to_triangle_mesh(*cgal_mesh);
|
||||
REQUIRE(result.its.indices.size() == mesh.indices.size());
|
||||
for (const Vec3i32 &face : result.its.indices)
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
REQUIRE(face[i] >= 0);
|
||||
REQUIRE(static_cast<std::size_t>(face[i]) < result.its.vertices.size());
|
||||
}
|
||||
REQUIRE_THAT(result.volume(), Catch::Matchers::WithinRel(1000., 1e-6));
|
||||
}
|
||||
|
||||
TEST_CASE("CGAL volume checks reject open meshes with unreferenced vertices", "[MeshBoolean][Regression]") {
|
||||
indexed_triangle_set mesh = its_make_cube(10., 10., 10.);
|
||||
mesh.indices.pop_back();
|
||||
mesh.vertices.emplace_back(20.f, 20.f, 20.f);
|
||||
|
||||
auto cgal_mesh = MeshBoolean::cgal::triangle_mesh_to_cgal(mesh);
|
||||
REQUIRE(cgal_mesh);
|
||||
REQUIRE_FALSE(MeshBoolean::cgal::does_bound_a_volume(*cgal_mesh));
|
||||
}
|
||||
|
||||
TEST_CASE("mcut difference handles source splits between cuts", "[MeshBoolean]") {
|
||||
TriangleMesh body = make_cube(30., 10., 10.);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <iterator>
|
||||
#include "libslic3r/Semver.hpp"
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include <memory>
|
||||
#include <numeric>
|
||||
#include <random>
|
||||
@@ -36,7 +37,6 @@
|
||||
#include "libslic3r/PresetBundle.hpp"
|
||||
#include "libslic3r/PresetCacheFormat.hpp"
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
|
||||
using namespace Slic3r;
|
||||
@@ -1958,35 +1958,151 @@ TEST_CASE("an option the build no longer knows is dropped, and the rest still lo
|
||||
CHECK(out.opt_string("printer_model") == "Test Model");
|
||||
}
|
||||
|
||||
TEST_CASE("an option whose type changed is dropped, and the rest still load", "[VendorCache]")
|
||||
namespace {
|
||||
|
||||
// A payload from a build whose dictionary this build did not produce: only
|
||||
// such a dictionary can type a key differently from print_config_def. `write`
|
||||
// emits the option values in the order of `keys`.
|
||||
DynamicPrintConfig load_foreign_payload(const std::vector<std::string>& keys, const std::vector<uint16_t>& types,
|
||||
const std::vector<std::string>& enum_names,
|
||||
const std::function<void(cereal::BinaryOutputArchive&)>& write)
|
||||
{
|
||||
// A payload from a build where layer_height was a coString. This one has it
|
||||
// as a coFloat, so nothing can be done with the value - but the dictionary
|
||||
// says how it was written, so its bytes are still consumed and printer_model
|
||||
// behind it still lands. Hand-written rather than round-tripped: only a
|
||||
// dictionary this build did not produce can disagree with it.
|
||||
std::ostringstream os(std::ios::binary);
|
||||
{
|
||||
cereal::BinaryOutputArchive ar(os);
|
||||
const std::vector<std::string> keys { "layer_height", "printer_model" };
|
||||
const std::vector<uint16_t> types { uint16_t(coString), uint16_t(coString) };
|
||||
const std::vector<std::string> enums { std::string() }; // the ENUM_UNNAMED slot
|
||||
std::vector<std::string> enums { std::string() }; // the ENUM_UNNAMED slot
|
||||
enums.insert(enums.end(), enum_names.begin(), enum_names.end());
|
||||
ar(keys, types, enums);
|
||||
ar(uint32_t(2));
|
||||
ar(uint16_t(0)); ar(ConfigOptionString("0.28"));
|
||||
ar(uint16_t(1)); ar(ConfigOptionString("Test Model"));
|
||||
ar(uint32_t(keys.size()));
|
||||
write(ar);
|
||||
}
|
||||
|
||||
std::istringstream is(os.str(), std::ios::binary);
|
||||
cereal::BinaryInputArchive ar(is);
|
||||
CacheDictionary rdict;
|
||||
rdict.load(ar);
|
||||
DynamicPrintConfig out;
|
||||
REQUIRE_NOTHROW(load_config(ar, out, rdict));
|
||||
CHECK(out.option("layer_height") == nullptr);
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("an option whose type changed is read as a JSON profile's text, and the rest still load", "[VendorCache]")
|
||||
{
|
||||
// A payload from a build where layer_height was a coString. This one has it
|
||||
// as a coFloat, so the value goes in as the text "0.28" would from a JSON
|
||||
// profile, and printer_model behind it still lands.
|
||||
REQUIRE(print_config_def.get("layer_height")->type == coFloat);
|
||||
const DynamicPrintConfig out = load_foreign_payload(
|
||||
{ "layer_height", "printer_model" }, { uint16_t(coString), uint16_t(coString) }, {},
|
||||
[](cereal::BinaryOutputArchive& ar) {
|
||||
ar(uint16_t(0)); ar(ConfigOptionString("0.28"));
|
||||
ar(uint16_t(1)); ar(ConfigOptionString("Test Model"));
|
||||
});
|
||||
REQUIRE(out.option("layer_height") != nullptr);
|
||||
CHECK_THAT(out.opt_float("layer_height"), Catch::Matchers::WithinAbs(0.28, 1e-9));
|
||||
CHECK(out.opt_string("printer_model") == "Test Model");
|
||||
}
|
||||
|
||||
TEST_CASE("a bool an older build cached is read by the enum that replaced it", "[VendorCache]")
|
||||
{
|
||||
// enable_arc_fitting was a coBool until it became an enum. A cache written
|
||||
// before that carries true/false; this build maps them through handle_legacy
|
||||
// to enabled/disabled, as it does for a JSON profile, instead of dropping the
|
||||
// key and leaving the preset at the collection default.
|
||||
REQUIRE(print_config_def.get("enable_arc_fitting")->type == coEnum);
|
||||
const DynamicPrintConfig out = load_foreign_payload(
|
||||
{ "enable_arc_fitting", "printer_model" }, { uint16_t(coBool), uint16_t(coString) }, {},
|
||||
[](cereal::BinaryOutputArchive& ar) {
|
||||
ar(uint16_t(0)); ar(ConfigOptionBool(true));
|
||||
ar(uint16_t(1)); ar(ConfigOptionString("Test Model"));
|
||||
});
|
||||
REQUIRE(out.option("enable_arc_fitting") != nullptr);
|
||||
CHECK(out.option("enable_arc_fitting")->serialize() == "enabled");
|
||||
CHECK(out.opt_string("printer_model") == "Test Model");
|
||||
}
|
||||
|
||||
TEST_CASE("an enum a newer build cached is read by the bool this build still has", "[VendorCache]")
|
||||
{
|
||||
// The other direction: a cache from a build that turned a bool into an enum,
|
||||
// read by a build where the key is still a bool. The enum travels by name,
|
||||
// and the name is substituted the way a JSON profile's would be.
|
||||
REQUIRE(print_config_def.get("reduce_crossing_wall")->type == coBool);
|
||||
const DynamicPrintConfig out = load_foreign_payload(
|
||||
{ "reduce_crossing_wall", "printer_model" }, { uint16_t(coEnum), uint16_t(coString) }, { "enabled" },
|
||||
[](cereal::BinaryOutputArchive& ar) {
|
||||
ar(uint16_t(0)); ar(uint32_t(1)); ar(uint16_t(1)); // one value, enum name index 1 = "enabled"
|
||||
ar(uint16_t(1)); ar(ConfigOptionString("Test Model"));
|
||||
});
|
||||
REQUIRE(out.option("reduce_crossing_wall") != nullptr);
|
||||
CHECK(out.opt_bool("reduce_crossing_wall") == true);
|
||||
CHECK(out.opt_string("printer_model") == "Test Model");
|
||||
}
|
||||
|
||||
TEST_CASE("a retyped value this build cannot parse is dropped, and the rest still load", "[VendorCache]")
|
||||
{
|
||||
// A string that is no number for a key this build types as a float: nothing
|
||||
// to substitute it with, so the key alone is dropped, as from a JSON profile.
|
||||
REQUIRE(print_config_def.get("layer_height")->type == coFloat);
|
||||
const DynamicPrintConfig out = load_foreign_payload(
|
||||
{ "layer_height", "printer_model" }, { uint16_t(coString), uint16_t(coString) }, {},
|
||||
[](cereal::BinaryOutputArchive& ar) {
|
||||
ar(uint16_t(0)); ar(ConfigOptionString("thick"));
|
||||
ar(uint16_t(1)); ar(ConfigOptionString("Test Model"));
|
||||
});
|
||||
CHECK(out.option("layer_height") == nullptr);
|
||||
CHECK(out.keys() == t_config_option_keys{ "printer_model" });
|
||||
}
|
||||
|
||||
TEST_CASE("a nullable vector cached under another type keeps its nil entries", "[VendorCache]")
|
||||
{
|
||||
// default_acceleration is a nullable coFloats. Written as coInts by a build
|
||||
// that typed it so, its nil entry must come back as nil, not as the int the
|
||||
// sentinel happens to be.
|
||||
const ConfigOptionDef* def = print_config_def.get("default_acceleration");
|
||||
REQUIRE(def->type == coFloats);
|
||||
REQUIRE(def->nullable);
|
||||
const DynamicPrintConfig out = load_foreign_payload(
|
||||
{ "default_acceleration", "printer_model" }, { uint16_t(coInts), uint16_t(coString) }, {},
|
||||
[](cereal::BinaryOutputArchive& ar) {
|
||||
ar(uint16_t(0)); ar(ConfigOptionInts({ ConfigOptionIntsNullable::nil_value(), 5000 }));
|
||||
ar(uint16_t(1)); ar(ConfigOptionString("Test Model"));
|
||||
});
|
||||
const auto* accel = out.option<ConfigOptionFloatsNullable>("default_acceleration");
|
||||
REQUIRE(accel != nullptr);
|
||||
REQUIRE(accel->values.size() == 2);
|
||||
CHECK(accel->is_nil(0));
|
||||
CHECK_THAT(accel->values[1], Catch::Matchers::WithinAbs(5000., 1e-9));
|
||||
CHECK(out.opt_string("printer_model") == "Test Model");
|
||||
}
|
||||
|
||||
TEST_CASE("skip_config consumes a config with options this build cannot place", "[VendorCache]")
|
||||
{
|
||||
// The entries a name peek reads past may be ones this build would replay
|
||||
// from text; skipping must still consume exactly their bytes.
|
||||
std::ostringstream os(std::ios::binary);
|
||||
{
|
||||
cereal::BinaryOutputArchive ar(os);
|
||||
const std::vector<std::string> keys { "enable_arc_fitting", "sparse_infill_pattern", "no_such_option" };
|
||||
const std::vector<uint16_t> types { uint16_t(coBool), uint16_t(coEnum), uint16_t(coString) };
|
||||
const std::vector<std::string> enums { std::string(), "zig-zag" };
|
||||
ar(keys, types, enums);
|
||||
ar(uint32_t(3));
|
||||
ar(uint16_t(0)); ar(ConfigOptionBool(true));
|
||||
ar(uint16_t(1)); ar(uint32_t(1)); ar(uint16_t(1));
|
||||
ar(uint16_t(2)); ar(ConfigOptionString("x"));
|
||||
ar(std::string("sentinel"));
|
||||
}
|
||||
std::istringstream is(os.str(), std::ios::binary);
|
||||
cereal::BinaryInputArchive ar(is);
|
||||
CacheDictionary rdict;
|
||||
rdict.load(ar);
|
||||
skip_config(ar, rdict);
|
||||
std::string sentinel;
|
||||
ar(sentinel);
|
||||
CHECK(sentinel == "sentinel");
|
||||
}
|
||||
|
||||
TEST_CASE("skip_config consumes a config without building one", "[VendorCache]")
|
||||
{
|
||||
DynamicPrintConfig in;
|
||||
|
||||
@@ -57,23 +57,6 @@ TEST_CASE("unit: printer-agent registry register / lookup / duplicate-reject", "
|
||||
CHECK(count == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("The registry records whether the native Device tab applies to an agent", "[registry][unit]")
|
||||
{
|
||||
// why: ids unique to this case, as the registry is process-global
|
||||
auto stub_factory = [](std::shared_ptr<ICloudServiceAgent>, const std::string&)
|
||||
-> std::shared_ptr<IPrinterAgent> { return nullptr; };
|
||||
|
||||
REQUIRE(NetworkAgentFactory::register_printer_agent("orca-test::native-tab-default-2c91", "Default", stub_factory));
|
||||
REQUIRE(NetworkAgentFactory::register_printer_agent("orca-test::native-tab-off-2c91", "Web only", stub_factory, false));
|
||||
|
||||
const PrinterAgentInfo* with_tab = NetworkAgentFactory::get_printer_agent_info("orca-test::native-tab-default-2c91");
|
||||
const PrinterAgentInfo* web_only = NetworkAgentFactory::get_printer_agent_info("orca-test::native-tab-off-2c91");
|
||||
REQUIRE(with_tab != nullptr);
|
||||
REQUIRE(web_only != nullptr);
|
||||
CHECK(with_tab->native_device_tab);
|
||||
CHECK_FALSE(web_only->native_device_tab);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// INTEGRATION - the orca.printer_agent Python binding surface.
|
||||
// Boots the embedded interpreter and asserts the C++ to Python contract that
|
||||
|
||||
Reference in New Issue
Block a user