mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 02:41:17 +00:00
Share the Estimated First-Layer Outline of the Wipe Tower
The preview brim, the placement margin and the pre-generation validation warning each decided on their own whether the tower has a Type2 cone base, reading the wall type and cone angle three different ways. The preview's read cast the preset's enum to ConfigOptionEnum<T>, which a preset-shaped config never holds, so the cone base was never previewed. estimate_wipe_tower_first_layer_outline now answers that question once, beside the footprint estimate, from the config and the resolved planner; all three sites take the outline from it. The libslic3r case reads the outline off a preset-shaped config, where the old cast came back empty.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "libslic3r/PresetBundle.hpp"
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
#include "libslic3r/GCode/WipeTower.hpp"
|
||||
#include "libslic3r/GCode/WipeTower2.hpp"
|
||||
#include "libslic3r/GCode/WipeTowerEstimate.hpp"
|
||||
#include "libslic3r/Tesselate.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
@@ -928,25 +927,13 @@ int GLVolumeCollection::load_wipe_tower_preview(
|
||||
const float brim_height = 0.2f; // one first layer, visual only
|
||||
TriangleMesh brim_slab;
|
||||
if (show_brim) {
|
||||
// A Type2 cone-wall tower's base bulges past the body box — follow the real base
|
||||
// outline instead of the rectangle. Type1 ignores the cone option.
|
||||
Polygon cone_base;
|
||||
{
|
||||
// Preset enums are ConfigOptionEnumGeneric, so read them by value; the planner is
|
||||
// resolved as the estimate resolves it, off the printer preset.
|
||||
const DynamicPrintConfig &print_cfg = GUI::wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
const DynamicPrintConfig &printer_cfg = GUI::wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
const ConfigOption *wall_opt = print_cfg.option("wipe_tower_wall_type");
|
||||
if (wall_opt != nullptr && wall_opt->getInt() == int(WipeTowerWallType::wtwCone) && resolve_wipe_tower_type(printer_cfg) == WipeTowerType::Type2)
|
||||
cone_base = WipeTower2::cone_base_polygon(width, depth, height, print_cfg.opt_float("wipe_tower_cone_angle"));
|
||||
}
|
||||
if (!cone_base.empty()) {
|
||||
Polygons brim_outline = offset(cone_base, scaled(brim_width));
|
||||
brim_slab = WipeTower::its_make_rib_brim(brim_outline.empty() ? cone_base : brim_outline.front(), brim_height);
|
||||
} else {
|
||||
brim_slab = make_cube(width + 2.f * brim_width, depth + 2.f * brim_width, brim_height);
|
||||
brim_slab.translate({-brim_width, -brim_width, 0.f});
|
||||
}
|
||||
// The brim follows the real first-layer outline: a Type2 cone-wall tower's base bulges
|
||||
// past the body box. The wall type and angle are print settings, the planner a printer one.
|
||||
const DynamicPrintConfig &print_cfg = GUI::wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
const DynamicPrintConfig &printer_cfg = GUI::wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
||||
const Polygon outline = estimate_wipe_tower_first_layer_outline(print_cfg, resolve_wipe_tower_type(printer_cfg), width, depth, height);
|
||||
const Polygons brim_outline = offset(outline, scaled(brim_width));
|
||||
brim_slab = WipeTower::its_make_rib_brim(brim_outline.empty() ? outline : brim_outline.front(), brim_height);
|
||||
wipe_tower_shell.merge(brim_slab);
|
||||
}
|
||||
for (int extruder_id : plate_extruders) {
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Polygon.hpp"
|
||||
#include "libslic3r/GCode/WipeTowerEstimate.hpp"
|
||||
#include "libslic3r/GCode/WipeTower2.hpp"
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
@@ -2398,14 +2397,9 @@ arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const Dynamic
|
||||
// clamp put the brim off the bed. Matches set_default_wipe_tower_pos_for_plate.
|
||||
float wp_brim_width = float(footprint.brim_width);
|
||||
// A Type2 stabilization cone bulges past the body box like a brim does - fold its worst-axis
|
||||
// bulge into the same margin (Type1 ignores the cone option).
|
||||
const auto *cone_wall_opt = config.option("wipe_tower_wall_type");
|
||||
const auto *cone_angle_opt = config.option("wipe_tower_cone_angle");
|
||||
if (cone_wall_opt != nullptr && cone_wall_opt->getInt() == int(WipeTowerWallType::wtwCone) && cone_angle_opt != nullptr &&
|
||||
cone_angle_opt->getFloat() > EPSILON && resolve_wipe_tower_type(config) == WipeTowerType::Type2) {
|
||||
const BoundingBox cb = get_extents(WipeTower2::cone_base_polygon(w, depth, wt_size.z(), cone_angle_opt->getFloat()));
|
||||
wp_brim_width += float(std::max({0., unscaled(cb.max.x()) - w, unscaled(cb.max.y()) - depth, -unscaled(cb.min.x()), -unscaled(cb.min.y())}));
|
||||
}
|
||||
// bulge into the same margin.
|
||||
const BoundingBox outline = get_extents(estimate_wipe_tower_first_layer_outline(config, resolve_wipe_tower_type(config), w, depth, wt_size.z()));
|
||||
wp_brim_width += float(std::max({0., unscaled(outline.max.x()) - w, unscaled(outline.max.y()) - depth, -unscaled(outline.min.x()), -unscaled(outline.min.y())}));
|
||||
// A position valid by WIPE_TOWER_MARGIN is the user's choice and stays untouched; an
|
||||
// invalid one is re-placed with the comfort margin (falling back to the validity bounds
|
||||
// on cramped plates). std::clamp is UB if lo > hi, so keep every hi >= lo.
|
||||
|
||||
Reference in New Issue
Block a user