mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-14 20:47:33 +00:00
Compare commits
7 Commits
hanif/pari
...
nightly-bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c635d5e50 | ||
|
|
5496883493 | ||
|
|
70247ad298 | ||
|
|
ecbe1b1b90 | ||
|
|
00429da739 | ||
|
|
31f6eb2718 | ||
|
|
ffb4f192c1 |
222
.github/workflows/parity_nightly.yml
vendored
222
.github/workflows/parity_nightly.yml
vendored
@@ -1,222 +0,0 @@
|
||||
# Nightly parity checks from OrcaSlicer/orca-test-repo, kept out of the
|
||||
# per-build "Run external slicer regression tests" step because they take far
|
||||
# longer than that step's budget:
|
||||
# effect - the CLI override sweep's full effect stage: every landed option
|
||||
# re-sliced on its own to see whether it changes the G-code
|
||||
# harness - the GUI-vs-CLI parity harness (metrics only, never fails)
|
||||
# Both test the latest successful build_all.yml Linux AppImage from main, with
|
||||
# sources checked out at the commit that build was made from. Nothing here
|
||||
# gates a build or a PR.
|
||||
name: Parity Nightly
|
||||
|
||||
on:
|
||||
# TEMPORARY: pre-merge test runs; drop this commit before the PR
|
||||
push:
|
||||
branches: ["hanif/parity-nightly"]
|
||||
schedule:
|
||||
# build_all.yml starts at 17:00 UTC and has finished by ~20:00
|
||||
- cron: "0 21 * * *"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test_repo_ref:
|
||||
description: "orca-test-repo ref to run"
|
||||
required: false
|
||||
default: "main"
|
||||
build_branch:
|
||||
description: "branch whose latest successful build_all artifact to test"
|
||||
required: false
|
||||
default: "main"
|
||||
fixtures:
|
||||
description: "harness fixture ids, space-separated (empty = all)"
|
||||
required: false
|
||||
default: ""
|
||||
cli_presets:
|
||||
description: "harness lane C presets: flat = flatten inherits first, raw = leaf profile as-is"
|
||||
required: false
|
||||
default: "flat"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Find the build to test
|
||||
# Don't run scheduled checks on forks
|
||||
if: github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer'
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
run_id: ${{ steps.find.outputs.run_id }}
|
||||
head_sha: ${{ steps.find.outputs.head_sha }}
|
||||
steps:
|
||||
- id: find
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh run list --workflow build_all.yml \
|
||||
--branch "${{ inputs.build_branch || 'main' }}" \
|
||||
--status success --limit 1 --json databaseId,headSha \
|
||||
--jq '"run_id=\(.[0].databaseId)\nhead_sha=\(.[0].headSha)"' \
|
||||
>> "$GITHUB_OUTPUT"
|
||||
cat "$GITHUB_OUTPUT"
|
||||
|
||||
effect:
|
||||
name: Override sweep effect stage (shard ${{ matrix.shard }})
|
||||
needs: build
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# orca-test-repo's parity/effect_routing.json holds a 2-way split,
|
||||
# ~12.5 min a shard on this runner
|
||||
shard: [0, 1]
|
||||
steps:
|
||||
- &checkout-suite
|
||||
name: Check out the test suite
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: OrcaSlicer/orca-test-repo
|
||||
ref: ${{ inputs.test_repo_ref || 'hanif/parity-harness' }}
|
||||
path: orca-test-repo
|
||||
|
||||
# The AppImage ships only packed preset caches, so profiles and the CLI
|
||||
# option surface come from the sources the build was made from
|
||||
- &checkout-slicer
|
||||
name: Check out OrcaSlicer at the build's commit
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ needs.build.outputs.head_sha }}
|
||||
path: slicer
|
||||
lfs: 'false'
|
||||
|
||||
- &extract-appimage
|
||||
name: Download and extract the Linux AppImage
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh run download "${{ needs.build.outputs.run_id }}" --dir appimage \
|
||||
--pattern "OrcaSlicer_Linux_ubuntu_2404*"
|
||||
appimage=$(find appimage -name "*.AppImage" ! -name "*aarch64*" | head -1)
|
||||
[ -n "$appimage" ] || { echo "no x86_64 AppImage in run ${{ needs.build.outputs.run_id }}"; exit 1; }
|
||||
chmod +x "$appimage"
|
||||
"$appimage" --appimage-extract > /dev/null
|
||||
# The bare binary cannot find the AppImage's bundled libraries; AppRun
|
||||
# sets them up and execs it, so exit codes and signals pass through
|
||||
[ -x squashfs-root/AppRun ] || { echo "no AppRun in the AppImage"; exit 1; }
|
||||
echo "ORCA_BIN=$PWD/squashfs-root/AppRun" >> "$GITHUB_ENV"
|
||||
echo "ORCA_SOURCE=$PWD/slicer" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Install the AppImage's host runtime dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libopengl0 libglu1-mesa libgl1 libegl1 libwebkit2gtk-4.1-0
|
||||
|
||||
- uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install suite dependencies
|
||||
run: pip install -r orca-test-repo/requirements.txt
|
||||
|
||||
- name: Run the override sweep with the full effect stage
|
||||
id: run
|
||||
continue-on-error: true
|
||||
working-directory: orca-test-repo
|
||||
run: |
|
||||
set -o pipefail
|
||||
# -rA keeps the per-stage summaries, which pytest otherwise swallows
|
||||
# for passing tests
|
||||
python -m pytest test_cli_overrides.py -c pytest.ini -v -rA \
|
||||
--effect-full --effect-shard ${{ matrix.shard }}/2 \
|
||||
--orca-bin "$ORCA_BIN" --orca-source "$ORCA_SOURCE" \
|
||||
2>&1 | tee ../sweep.log
|
||||
|
||||
- name: Publish job summary
|
||||
if: always()
|
||||
run: |
|
||||
{
|
||||
echo "## Override sweep effect stage, shard ${{ matrix.shard }}/2"
|
||||
echo "Build ${{ needs.build.outputs.head_sha }} (run ${{ needs.build.outputs.run_id }})"
|
||||
echo '```'
|
||||
grep -E "\[override sweep" sweep.log || echo "no stage summaries, see the log"
|
||||
grep -E "^=+ .*(passed|failed)" sweep.log | tail -1 || true
|
||||
echo '```'
|
||||
} >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
- name: Upload the override report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: override-report-shard${{ matrix.shard }}
|
||||
path: |
|
||||
orca-test-repo/.pytest_cache/override_report.json
|
||||
sweep.log
|
||||
if-no-files-found: warn
|
||||
retention-days: 30
|
||||
|
||||
# The sweep step continues on error so the summary and report still get
|
||||
# published; this puts the failure back on the job
|
||||
- name: Fail the job if the sweep failed
|
||||
if: steps.run.outcome == 'failure'
|
||||
run: |
|
||||
echo "the override sweep failed, see the job summary and the uploaded report" >&2
|
||||
exit 1
|
||||
|
||||
harness:
|
||||
name: GUI-vs-CLI parity harness
|
||||
needs: build
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 180
|
||||
steps:
|
||||
- *checkout-suite
|
||||
- *checkout-slicer
|
||||
- *extract-appimage
|
||||
|
||||
- name: Install display tooling and the AppImage's host runtime
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
xvfb xdotool imagemagick openbox mesa-utils \
|
||||
libopengl0 libglu1-mesa libgl1 libegl1 libwebkit2gtk-4.1-0
|
||||
|
||||
- name: Run the parity harness
|
||||
run: |
|
||||
set -euo pipefail
|
||||
fixtures=()
|
||||
for f in ${{ inputs.fixtures || '' }}; do
|
||||
fixtures+=(--fixture "$f")
|
||||
done
|
||||
# 2 GUI displays: ~1.5 cores peak / ~1.9 GB on this 4-vCPU runner,
|
||||
# and each fixture is fully isolated, so results match a serial run
|
||||
python3 orca-test-repo/parity/run_parity.py \
|
||||
--slicer-root "$ORCA_SOURCE" --bin "$ORCA_BIN" \
|
||||
--cli-presets "${{ inputs.cli_presets || 'flat' }}" \
|
||||
--gui-workers 2 --out "$PWD/parity-out" "${fixtures[@]}"
|
||||
|
||||
- name: Publish job summary
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f parity-out/report.md ]; then
|
||||
cat parity-out/report.md >> "$GITHUB_STEP_SUMMARY"
|
||||
else
|
||||
echo "the harness produced no report, see the log" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
|
||||
- name: Drop per-lane datadirs before upload
|
||||
if: always()
|
||||
run: rm -rf parity-out/*/seed parity-out/*/datadir-* || true
|
||||
|
||||
- name: Upload the scorecard and evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: parity-scorecard
|
||||
path: parity-out/
|
||||
if-no-files-found: warn
|
||||
retention-days: 30
|
||||
@@ -587,10 +587,15 @@ if ((NOT MSVC OR IS_CLANG_CL) AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
|
||||
add_compile_options(-Wno-${w})
|
||||
endforeach ()
|
||||
|
||||
# Turn everything else into an error. Dependency headers are exempt because the SYSTEM
|
||||
# include flag (-imsvc on clang-cl, -isystem elsewhere) keeps their diagnostics out,
|
||||
# apart from GCC's maybe-uninitialized, demoted below.
|
||||
add_compile_options(-Werror)
|
||||
# GCC is not built in CI, so don't throw errors CI won't catch.
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Werror=return-type)
|
||||
else ()
|
||||
# Turn everything else into an error. Dependency headers are exempt because the
|
||||
# SYSTEM include flag (-imsvc on clang-cl, -isystem elsewhere) keeps their
|
||||
# diagnostics out.
|
||||
add_compile_options(-Werror)
|
||||
endif ()
|
||||
|
||||
# Demoted. Remove a name once its category is cleared on every compiler.
|
||||
set(warnings_demoted)
|
||||
@@ -612,20 +617,6 @@ if ((NOT MSVC OR IS_CLANG_CL) AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
|
||||
cast-function-type-mismatch
|
||||
)
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
list(APPEND warnings_demoted
|
||||
# maybe-uninitialized runs after inlining and reports inside boost/variant,
|
||||
# boost/tuple and the bundled clipper header even with -isystem.
|
||||
maybe-uninitialized
|
||||
|
||||
# array-bounds is reported once, where ConfigOptionVector::set_at inlines
|
||||
# into OrcaSlicer.cpp on a branch the preceding type test rules out.
|
||||
array-bounds
|
||||
|
||||
# template-id-cdtor is a GCC 14+ warning in the bundled Clipper2 headers.
|
||||
template-id-cdtor
|
||||
)
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
list(APPEND warnings_demoted
|
||||
# enum-constexpr-conversion is a Clang warning that defaults to an error,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Snapmaker",
|
||||
"version": "02.04.00.12",
|
||||
"version": "02.04.00.13",
|
||||
"force_update": "0",
|
||||
"description": "Snapmaker configurations",
|
||||
"machine_model_list": [
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
"1"
|
||||
],
|
||||
"cool_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"cool_plate_temp_initial_layer": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"eng_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"eng_plate_temp_initial_layer": [
|
||||
"100"
|
||||
@@ -48,7 +48,7 @@
|
||||
"Polymaker"
|
||||
],
|
||||
"hot_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"hot_plate_temp_initial_layer": [
|
||||
"100"
|
||||
@@ -72,7 +72,7 @@
|
||||
"110.8"
|
||||
],
|
||||
"textured_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"textured_plate_temp_initial_layer": [
|
||||
"100"
|
||||
|
||||
@@ -15,16 +15,16 @@
|
||||
"1"
|
||||
],
|
||||
"cool_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"cool_plate_temp_initial_layer": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"eng_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"eng_plate_temp_initial_layer": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"fan_cooling_layer_time": [
|
||||
"12"
|
||||
@@ -51,10 +51,10 @@
|
||||
"Polymaker"
|
||||
],
|
||||
"hot_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"hot_plate_temp_initial_layer": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"nozzle_temperature": [
|
||||
"300"
|
||||
@@ -81,10 +81,10 @@
|
||||
"110"
|
||||
],
|
||||
"textured_plate_temp": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"textured_plate_temp_initial_layer": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"filament_type": [
|
||||
"ABS"
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
""
|
||||
],
|
||||
"hot_plate_temp": [
|
||||
"110"
|
||||
"100"
|
||||
],
|
||||
"hot_plate_temp_initial_layer": [
|
||||
"105"
|
||||
"100"
|
||||
],
|
||||
"overhang_fan_speed": [
|
||||
"20"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
""
|
||||
],
|
||||
"hot_plate_temp": [
|
||||
"110"
|
||||
"100"
|
||||
],
|
||||
"hot_plate_temp_initial_layer": [
|
||||
"100"
|
||||
|
||||
@@ -53,6 +53,7 @@ using namespace nlohmann;
|
||||
|
||||
#include "libslic3r/libslic3r.h"
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "libslic3r/FilamentMixer.hpp"
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/GCode.hpp"
|
||||
@@ -162,6 +163,7 @@ std::map<int, std::string> cli_errors = {
|
||||
{CLI_FILAMENT_CAN_NOT_MAP, "Some filaments cannot be mapped to correct extruders for multi-extruder Printer."},
|
||||
{CLI_ONLY_ONE_TPU_SUPPORTED, "Not support printing 2 or more TPU filaments."},
|
||||
{CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER, "Some filaments cannot be printed on the extruder mapped to."},
|
||||
{CLI_MIXED_FILAMENT_INVALID, "A mixed filament is invalid: its components are different filament types, or it has no filament of its own."},
|
||||
{CLI_SLICING_ERROR, "Failed slicing the model. Please verify the slicing of all plates on Orca Slicer before uploading."},
|
||||
{CLI_GCODE_PATH_CONFLICTS, " G-code conflicts detected after slicing. Please make sure the 3mf file can be successfully sliced in the latest Orca Slicer. If the file slices normally in Orca Slicer, try moving the wipe tower further from other models, as we use more conservative parameters for it during upload."},
|
||||
{CLI_GCODE_PATH_IN_UNPRINTABLE_AREA, "Found G-code in unprintable area of multi-extruder printers after slicing. Please make sure the 3mf file can be successfully sliced in the latest Orca Slicer."}
|
||||
@@ -3700,6 +3702,15 @@ int CLI::run(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
// A mixed slot never reaches a nozzle, so its row and column stay empty, as in the GUI.
|
||||
// Command line options are not merged into m_print_config yet, so they win here.
|
||||
const ConfigOptionBools *is_mixed_opt = m_extra_config.option<ConfigOptionBools>("filament_is_mixed");
|
||||
if (!is_mixed_opt)
|
||||
is_mixed_opt = m_print_config.option<ConfigOptionBools>("filament_is_mixed");
|
||||
auto is_mixed_slot = [is_mixed_opt](int idx) {
|
||||
return is_mixed_opt && idx < static_cast<int>(is_mixed_opt->values.size()) && is_mixed_opt->values[idx];
|
||||
};
|
||||
|
||||
for (size_t nozzle_id = 0; nozzle_id < new_extruder_count; ++nozzle_id) {
|
||||
std::vector<double> flush_vol_mtx = get_flush_volumes_matrix(flush_vol_matrix, nozzle_id, new_extruder_count);
|
||||
for (int from_idx = 0; from_idx < project_filament_count; from_idx++) {
|
||||
@@ -3709,7 +3720,7 @@ int CLI::run(int argc, char **argv)
|
||||
bool is_from_support = filament_is_support->get_at(from_idx);
|
||||
for (int to_idx = 0; to_idx < project_filament_count; to_idx++) {
|
||||
bool is_to_support = filament_is_support->get_at(to_idx);
|
||||
if (from_idx == to_idx) {
|
||||
if (from_idx == to_idx || is_mixed_slot(from_idx) || is_mixed_slot(to_idx)) {
|
||||
flush_vol_mtx[project_filament_count * from_idx + to_idx] = 0.f;
|
||||
} else {
|
||||
int flushing_volume = 0;
|
||||
@@ -3937,6 +3948,22 @@ int CLI::run(int argc, char **argv)
|
||||
// Normalizing after importing the 3MFs / AMFs
|
||||
m_print_config.normalize_fdm();
|
||||
|
||||
// A mixed slot is virtual but still needs a filament entry of its own. Without one, feature
|
||||
// filament ids aimed at it fall outside the filament count, are reset to the first filament
|
||||
// and the model silently prints in a single colour.
|
||||
if (const auto *is_mixed_opt = m_print_config.option<ConfigOptionBools>("filament_is_mixed")) {
|
||||
const auto &is_mixed = is_mixed_opt->values;
|
||||
for (size_t slot = static_cast<size_t>(std::max(filament_count, 0)); slot < is_mixed.size(); ++slot) {
|
||||
if (!is_mixed[slot])
|
||||
continue;
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("mixed filament slot %1% has no filament of its own, only %2% filaments are loaded; "
|
||||
"load one filament per slot, including each mixed one")
|
||||
% (slot + 1) % filament_count;
|
||||
record_exit_reson(outfile_dir, CLI_MIXED_FILAMENT_INVALID, 0, cli_errors[CLI_MIXED_FILAMENT_INVALID], sliced_info);
|
||||
flush_and_exit(CLI_MIXED_FILAMENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
m_print_config.option<ConfigOptionEnum<PrinterTechnology>>("printer_technology", true)->value = printer_technology;
|
||||
|
||||
bool has_wipe_tower_position = m_print_config.option<ConfigOptionFloats>("wipe_tower_x") && m_print_config.option<ConfigOptionFloats>("wipe_tower_y");
|
||||
@@ -3991,6 +4018,15 @@ int CLI::run(int argc, char **argv)
|
||||
bool is_smooth_timelapse = false;
|
||||
if (enable_timelapse && timelapse_type_opt && (timelapse_type_opt->getInt() == TimelapseType::tlSmooth))
|
||||
is_smooth_timelapse = true;
|
||||
// A mixed filament swaps between its components every layer, so it needs the tower even when
|
||||
// every loaded preset is the same.
|
||||
if (disable_wipe_tower_after_mapping) {
|
||||
if (const auto *is_mixed_opt = m_print_config.option<ConfigOptionBools>("filament_is_mixed");
|
||||
is_mixed_opt && has_any_mixed_filament(is_mixed_opt->values)) {
|
||||
disable_wipe_tower_after_mapping = false;
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%, set disable_wipe_tower_after_mapping back to false due to a mixed filament")%__LINE__;
|
||||
}
|
||||
}
|
||||
if (disable_wipe_tower_after_mapping) {
|
||||
if (is_smooth_timelapse)
|
||||
{
|
||||
@@ -6197,6 +6233,36 @@ int CLI::run(int argc, char **argv)
|
||||
flush_and_exit(CLI_ONLY_ONE_TPU_SUPPORTED);
|
||||
}
|
||||
|
||||
// Same type gate as the GUI's Sidebar::has_broken_mixed_filament: refuse a plate that uses a
|
||||
// mixed slot whose components are different filament types. Missing or out-of-range
|
||||
// components never get here, validate() already rejects them for the whole project.
|
||||
const auto *is_mixed_opt = m_print_config.option<ConfigOptionBools>("filament_is_mixed");
|
||||
const auto *components_opt = m_print_config.option<ConfigOptionStrings>("filament_mixed_components");
|
||||
if (is_mixed_opt && components_opt && has_any_mixed_filament(is_mixed_opt->values)) {
|
||||
const auto &is_mixed = is_mixed_opt->values;
|
||||
const auto &components = components_opt->values;
|
||||
const size_t num_physical = static_cast<size_t>(filament_count) - static_cast<size_t>(std::count(is_mixed.begin(), is_mixed.end(), true));
|
||||
std::vector<std::string> physical_types(num_physical);
|
||||
for (size_t f_index = 0; f_index < num_physical; ++f_index) {
|
||||
std::string displayed_type;
|
||||
physical_types[f_index] = m_print_config.get_filament_type(displayed_type, static_cast<int>(f_index));
|
||||
if (physical_types[f_index].empty())
|
||||
physical_types[f_index] = "PLA";
|
||||
}
|
||||
const std::vector<size_t> mismatched_slots = check_mixed_filament_type_consistency(is_mixed, components, physical_types);
|
||||
// plate_filaments has mixed slots expanded to their components; the gate needs the slots.
|
||||
const std::vector<int> plate_slots = mismatched_slots.empty() ? std::vector<int>() :
|
||||
part_plate->get_extruders_under_cli(true, m_print_config, false);
|
||||
for (size_t slot : mismatched_slots) {
|
||||
if (std::find(plate_slots.begin(), plate_slots.end(), static_cast<int>(slot) + 1) == plate_slots.end())
|
||||
continue;
|
||||
BOOST_LOG_TRIVIAL(error) << boost::format("plate %1%: mixed filament %2% mixes components of different filament types")
|
||||
% (index + 1) % (slot + 1);
|
||||
record_exit_reson(outfile_dir, CLI_MIXED_FILAMENT_INVALID, index + 1, cli_errors[CLI_MIXED_FILAMENT_INVALID], sliced_info);
|
||||
flush_and_exit(CLI_MIXED_FILAMENT_INVALID);
|
||||
}
|
||||
}
|
||||
|
||||
if (new_extruder_count > 1) {
|
||||
std::vector<std::vector<int>> unprintable_filament_vec;
|
||||
for (const std::set<int>& filamnt_ids : unprintable_filament_ids) {
|
||||
|
||||
@@ -1595,6 +1595,25 @@ Polylines Layer::generate_sparse_infill_polylines_for_anchoring(FillAdaptive::Oc
|
||||
return sparse_infill_polylines;
|
||||
}
|
||||
|
||||
// Returns the filament id (1-based) the region is ironed with, or -1 when the
|
||||
// region is not ironed. AllSolid always irons. TopSurfaces and TopmostOnly need
|
||||
// either some top shells or, in spiral mode, more than one bottom shell, and
|
||||
// TopmostOnly additionally needs the layer to be the topmost one.
|
||||
int Layer::choose_ironing_extruder(const PrintRegionConfig &cfg,
|
||||
bool spiral_mode,
|
||||
bool is_topmost_layer)
|
||||
{
|
||||
if (cfg.ironing_type == IroningType::NoIroning)
|
||||
return -1;
|
||||
const bool gate = (cfg.ironing_type == IroningType::AllSolid)
|
||||
|| ((cfg.top_shell_layers > 0 || (spiral_mode && cfg.bottom_shell_layers > 1))
|
||||
&& (cfg.ironing_type == IroningType::TopSurfaces
|
||||
|| (cfg.ironing_type == IroningType::TopmostOnly && is_topmost_layer)));
|
||||
if (!gate)
|
||||
return -1;
|
||||
return cfg.top_surface_filament_id;
|
||||
}
|
||||
|
||||
// Create ironing extrusions over top surfaces.
|
||||
void Layer::make_ironing()
|
||||
{
|
||||
@@ -1664,19 +1683,10 @@ void Layer::make_ironing()
|
||||
if (! layerm->slices.empty()) {
|
||||
IroningParams ironing_params;
|
||||
const PrintRegionConfig &config = layerm->region().config();
|
||||
if (config.ironing_type != IroningType::NoIroning &&
|
||||
(config.ironing_type == IroningType::AllSolid ||
|
||||
((config.top_shell_layers > 0 || (this->object()->print()->config().spiral_mode && config.bottom_shell_layers > 1)) &&
|
||||
(config.ironing_type == IroningType::TopSurfaces ||
|
||||
(config.ironing_type == IroningType::TopmostOnly && layerm->layer()->upper_layer == nullptr))))) {
|
||||
if (config.outer_wall_filament_id == config.top_surface_filament_id || config.wall_loops == 0) {
|
||||
// Iron the whole face.
|
||||
ironing_params.extruder = config.top_surface_filament_id;
|
||||
} else {
|
||||
// Iron just the infill.
|
||||
ironing_params.extruder = config.top_surface_filament_id;
|
||||
}
|
||||
}
|
||||
ironing_params.extruder = Layer::choose_ironing_extruder(
|
||||
config,
|
||||
/*spiral_mode=*/this->object()->print()->config().spiral_mode,
|
||||
/*is_topmost_layer=*/layerm->layer()->upper_layer == nullptr);
|
||||
if (ironing_params.extruder != -1) {
|
||||
//TODO just_infill is currently not used.
|
||||
ironing_params.just_infill = false;
|
||||
|
||||
@@ -16,6 +16,7 @@ using LayerPtrs = std::vector<Layer*>;
|
||||
class LayerRegion;
|
||||
using LayerRegionPtrs = std::vector<LayerRegion*>;
|
||||
class PrintRegion;
|
||||
class PrintRegionConfig;
|
||||
class PrintObject;
|
||||
class Print;
|
||||
|
||||
@@ -200,6 +201,11 @@ public:
|
||||
FillAdaptive::Octree *support_fill_octree,
|
||||
FillLightning::Generator* lightning_generator) const;
|
||||
void make_ironing();
|
||||
// Returns the filament id (1-based) the region is ironed with, or -1 when the
|
||||
// region is not ironed.
|
||||
static int choose_ironing_extruder(const PrintRegionConfig &cfg,
|
||||
bool spiral_mode,
|
||||
bool is_topmost_layer);
|
||||
void make_contour_z(const sla::IndexedMesh &mesh);
|
||||
|
||||
void export_region_slices_to_svg(const char *path) const;
|
||||
|
||||
@@ -10936,6 +10936,28 @@ std::vector<int> DynamicPrintConfig::update_values_to_printer_extruders(DynamicP
|
||||
return variant_index;
|
||||
}
|
||||
|
||||
// Regathers a vector option's values through per-slot source indices (one input index per
|
||||
// output slot). Out-of-range indices keep the first value, matching get_at's fallback.
|
||||
template<typename OptType, typename ValueType>
|
||||
static void gather_option_values(const char *caller, const std::string &key, OptType *opt, const std::vector<int> &slot_param_indices)
|
||||
{
|
||||
if (!opt || opt->values.empty()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << caller << boost::format(", Line %1%: option %2% not found or empty, skipping")%__LINE__%key;
|
||||
return;
|
||||
}
|
||||
std::vector<ValueType> new_values;
|
||||
new_values.reserve(slot_param_indices.size());
|
||||
for (int idx : slot_param_indices) {
|
||||
if (idx < 0 || static_cast<size_t>(idx) >= opt->values.size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << caller << boost::format(", Line %1%: option %2% slot index %3% out of range, keeping first value")%__LINE__%key%idx;
|
||||
new_values.emplace_back(opt->values.front());
|
||||
}
|
||||
else
|
||||
new_values.emplace_back(opt->values[idx]);
|
||||
}
|
||||
opt->values = std::move(new_values);
|
||||
}
|
||||
|
||||
void DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filaments(DynamicPrintConfig& printer_config, int extruder_count, int extruder_nozzle_volume_count, std::set<std::string>& key_set, std::string id_name, std::string variant_name)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", Line %1%: extruder_count %2%, extruder_nozzle_volume_count %3%")%__LINE__ %extruder_count %extruder_nozzle_volume_count;
|
||||
@@ -11013,155 +11035,18 @@ void DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filamen
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: can not find opt define for %2%")%__LINE__%key;
|
||||
continue;
|
||||
}
|
||||
// An empty option has no first value to fall back on; give it one registered default per filament.
|
||||
if (auto *vec = dynamic_cast<ConfigOptionVectorBase*>(this->option(key)); vec && vec->empty() && optdef->default_value)
|
||||
vec->resize(filament_count, optdef->default_value.get());
|
||||
|
||||
switch (optdef->type) {
|
||||
case coStrings:
|
||||
{
|
||||
ConfigOptionStrings * opt = this->option<ConfigOptionStrings>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<std::string> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coInts:
|
||||
{
|
||||
ConfigOptionInts * opt = this->option<ConfigOptionInts>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<int> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coFloats:
|
||||
{
|
||||
ConfigOptionFloats * opt = this->option<ConfigOptionFloats>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<double> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coPercents:
|
||||
{
|
||||
ConfigOptionPercents * opt = this->option<ConfigOptionPercents>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<double> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coFloatsOrPercents:
|
||||
{
|
||||
ConfigOptionFloatsOrPercents * opt = this->option<ConfigOptionFloatsOrPercents>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<FloatOrPercent> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coBools:
|
||||
{
|
||||
ConfigOptionBools * opt = this->option<ConfigOptionBools>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<unsigned char> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coEnums:
|
||||
{
|
||||
ConfigOptionEnumsGeneric * opt = this->option<ConfigOptionEnumsGeneric>(key);
|
||||
if (!opt) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found, skipping")%__LINE__%key;
|
||||
break;
|
||||
}
|
||||
std::vector<int> new_values;
|
||||
|
||||
new_values.resize(filament_count);
|
||||
for (int f_index = 0; f_index < filament_count; f_index++)
|
||||
{
|
||||
if (variant_index[f_index] < 0 || static_cast<size_t>(variant_index[f_index]) >= opt->size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% variant index %3% out of range, skipping")%__LINE__%key%variant_index[f_index];
|
||||
continue;
|
||||
}
|
||||
new_values[f_index] = opt->get_at(variant_index[f_index]);
|
||||
}
|
||||
opt->values = new_values;
|
||||
break;
|
||||
}
|
||||
case coStrings: gather_option_values<ConfigOptionStrings, std::string>(__FUNCTION__, key, this->option<ConfigOptionStrings>(key), variant_index); break;
|
||||
case coInts: gather_option_values<ConfigOptionInts, int>(__FUNCTION__, key, this->option<ConfigOptionInts>(key), variant_index); break;
|
||||
case coFloats: gather_option_values<ConfigOptionFloats, double>(__FUNCTION__, key, this->option<ConfigOptionFloats>(key), variant_index); break;
|
||||
case coPercents: gather_option_values<ConfigOptionPercents, double>(__FUNCTION__, key, this->option<ConfigOptionPercents>(key), variant_index); break;
|
||||
case coFloatsOrPercents: gather_option_values<ConfigOptionFloatsOrPercents, FloatOrPercent>(__FUNCTION__, key, this->option<ConfigOptionFloatsOrPercents>(key), variant_index); break;
|
||||
case coBools: gather_option_values<ConfigOptionBools, unsigned char>(__FUNCTION__, key, this->option<ConfigOptionBools>(key), variant_index); break;
|
||||
case coEnums: gather_option_values<ConfigOptionEnumsGeneric, int>(__FUNCTION__, key, this->option<ConfigOptionEnumsGeneric>(key), variant_index); break;
|
||||
default:
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
|
||||
break;
|
||||
@@ -11180,28 +11065,6 @@ void DynamicPrintConfig::update_values_to_printer_extruders_for_multiple_filamen
|
||||
}
|
||||
}
|
||||
|
||||
// Regathers a vector option's values through per-slot source indices (one input index per
|
||||
// output slot). Out-of-range indices keep the first value, matching get_at's fallback.
|
||||
template<typename OptType, typename ValueType>
|
||||
static void gather_option_values(const std::string &key, OptType *opt, const std::vector<int> &slot_param_indices)
|
||||
{
|
||||
if (!opt || opt->values.empty()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% not found or empty, skipping")%__LINE__%key;
|
||||
return;
|
||||
}
|
||||
std::vector<ValueType> new_values;
|
||||
new_values.reserve(slot_param_indices.size());
|
||||
for (int idx : slot_param_indices) {
|
||||
if (idx < 0 || static_cast<size_t>(idx) >= opt->values.size()) {
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: option %2% slot index %3% out of range, keeping first value")%__LINE__%key%idx;
|
||||
new_values.emplace_back(opt->values.front());
|
||||
}
|
||||
else
|
||||
new_values.emplace_back(opt->values[idx]);
|
||||
}
|
||||
opt->values = std::move(new_values);
|
||||
}
|
||||
|
||||
void DynamicPrintConfig::update_filament_config_values_for_multiple_extruders(DynamicPrintConfig& printer_config,
|
||||
const std::unordered_map<int, std::vector<FilamentVariantUse>>& filament_variant_uses,
|
||||
int extruder_count, int extruder_nozzle_volume_count,
|
||||
@@ -11296,13 +11159,13 @@ void DynamicPrintConfig::update_filament_config_values_for_multiple_extruders(Dy
|
||||
continue;
|
||||
}
|
||||
switch (optdef->type) {
|
||||
case coStrings: gather_option_values<ConfigOptionStrings, std::string>(key, this->option<ConfigOptionStrings>(key), slot_param_indices); break;
|
||||
case coInts: gather_option_values<ConfigOptionInts, int>(key, this->option<ConfigOptionInts>(key), slot_param_indices); break;
|
||||
case coFloats: gather_option_values<ConfigOptionFloats, double>(key, this->option<ConfigOptionFloats>(key), slot_param_indices); break;
|
||||
case coPercents: gather_option_values<ConfigOptionPercents, double>(key, this->option<ConfigOptionPercents>(key), slot_param_indices); break;
|
||||
case coFloatsOrPercents: gather_option_values<ConfigOptionFloatsOrPercents, FloatOrPercent>(key, this->option<ConfigOptionFloatsOrPercents>(key), slot_param_indices); break;
|
||||
case coBools: gather_option_values<ConfigOptionBools, unsigned char>(key, this->option<ConfigOptionBools>(key), slot_param_indices); break;
|
||||
case coEnums: gather_option_values<ConfigOptionEnumsGeneric, int>(key, this->option<ConfigOptionEnumsGeneric>(key), slot_param_indices); break;
|
||||
case coStrings: gather_option_values<ConfigOptionStrings, std::string>(__FUNCTION__, key, this->option<ConfigOptionStrings>(key), slot_param_indices); break;
|
||||
case coInts: gather_option_values<ConfigOptionInts, int>(__FUNCTION__, key, this->option<ConfigOptionInts>(key), slot_param_indices); break;
|
||||
case coFloats: gather_option_values<ConfigOptionFloats, double>(__FUNCTION__, key, this->option<ConfigOptionFloats>(key), slot_param_indices); break;
|
||||
case coPercents: gather_option_values<ConfigOptionPercents, double>(__FUNCTION__, key, this->option<ConfigOptionPercents>(key), slot_param_indices); break;
|
||||
case coFloatsOrPercents: gather_option_values<ConfigOptionFloatsOrPercents, FloatOrPercent>(__FUNCTION__, key, this->option<ConfigOptionFloatsOrPercents>(key), slot_param_indices); break;
|
||||
case coBools: gather_option_values<ConfigOptionBools, unsigned char>(__FUNCTION__, key, this->option<ConfigOptionBools>(key), slot_param_indices); break;
|
||||
case coEnums: gather_option_values<ConfigOptionEnumsGeneric, int>(__FUNCTION__, key, this->option<ConfigOptionEnumsGeneric>(key), slot_param_indices); break;
|
||||
default:
|
||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", Line %1%: unsupported option type for %2%")%__LINE__%key;
|
||||
break;
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#define CLI_FILAMENT_CAN_NOT_MAP -66
|
||||
#define CLI_ONLY_ONE_TPU_SUPPORTED -67
|
||||
#define CLI_FILAMENTS_NOT_SUPPORTED_BY_EXTRUDER -68
|
||||
#define CLI_MIXED_FILAMENT_INVALID -69
|
||||
|
||||
#define CLI_SLICING_ERROR -100
|
||||
#define CLI_GCODE_PATH_CONFLICTS -101
|
||||
|
||||
@@ -1717,7 +1717,7 @@ std::vector<int> PartPlate::get_extruders(bool conside_custom_gcode, const Dynam
|
||||
return plate_extruders;
|
||||
}
|
||||
|
||||
std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const
|
||||
std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config, bool expand_mixed_slots) const
|
||||
{
|
||||
std::vector<int> plate_extruders;
|
||||
|
||||
@@ -1878,7 +1878,7 @@ std::vector<int> PartPlate::get_extruders_under_cli(bool conside_custom_gcode, D
|
||||
// Expand mixed filament slots to their physical components. A mixed slot is virtual and
|
||||
// is never loaded into a tray, so callers (AMS mapping, filament checks) must see the
|
||||
// physical filaments it resolves to instead.
|
||||
{
|
||||
if (expand_mixed_slots) {
|
||||
auto* is_mixed_opt = full_config.option<ConfigOptionBools>("filament_is_mixed");
|
||||
auto* comp_strs_opt = full_config.option<ConfigOptionStrings>("filament_mixed_components");
|
||||
if (is_mixed_opt && comp_strs_opt && has_any_mixed_filament(is_mixed_opt->values)) {
|
||||
|
||||
@@ -350,7 +350,8 @@ public:
|
||||
// get used filaments from config, 1 based idx
|
||||
std::vector<int> get_extruders(bool conside_custom_gcode = false) const;
|
||||
std::vector<int> get_extruders(bool conside_custom_gcode, const DynamicPrintConfig& glb_config, const DynamicPrintConfig& project_config) const;
|
||||
std::vector<int> get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const;
|
||||
// expand_mixed_slots = false keeps mixed filament slots as slots instead of their components.
|
||||
std::vector<int> get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config, bool expand_mixed_slots = true) const;
|
||||
std::vector<int> get_extruders_without_support(bool conside_custom_gcode = false) const;
|
||||
// get used filaments from gcode result, 1 based idx
|
||||
std::vector<int> get_used_filaments();
|
||||
|
||||
@@ -1037,9 +1037,6 @@ size_t PublishSettingsDialog::section_group_for(Section kind)
|
||||
section.mixed_tabs = new TabCtrl(section.page, wxID_ANY, wxDefaultPosition, wxDefaultSize, s_tab_style);
|
||||
section.mixed_tabs->SetFont(Label::Body_14);
|
||||
section.mixed_tabs->SetBackgroundColour(GetBackgroundColour());
|
||||
// The mixed tabs carry full swatch compositions: give them a touch more room than the
|
||||
// filament tabs so neighbouring compositions stay distinguishable (must precede AppendItem).
|
||||
section.mixed_tabs->SetItemSpace(FromDIP(3));
|
||||
page_sizer->Add(section.mixed_tabs, 0, wxEXPAND | wxTOP, FromDIP(2));
|
||||
section.mixed_tabs->Hide();
|
||||
}
|
||||
|
||||
@@ -311,8 +311,11 @@ void Button::render(wxDC& dc)
|
||||
}
|
||||
}
|
||||
auto szContent = textSize;
|
||||
// Whether the measured content reserved the text/icon gap. macOS measures an empty label
|
||||
// as 0-high, so the gap is skipped there; the dot must not advance past it in that case.
|
||||
const bool gap_reserved = szContent.y > 0;
|
||||
if (icon.bmp().IsOk()) {
|
||||
if (szContent.y > 0) {
|
||||
if (gap_reserved) {
|
||||
//BBS norrow size between text and icon
|
||||
if (vertical)
|
||||
szContent.y += spacing;
|
||||
@@ -357,10 +360,10 @@ void Button::render(wxDC& dc)
|
||||
dc.DrawBitmap(icon.bmp(), pt);
|
||||
//BBS norrow size between text and icon
|
||||
if (vertical) {
|
||||
pt.y += szIcon.y + spacing;
|
||||
pt.y += szIcon.y + (gap_reserved ? spacing : 0);
|
||||
pt.x = rcContent.x;
|
||||
} else {
|
||||
pt.x += szIcon.x + spacing;
|
||||
pt.x += szIcon.x + (gap_reserved ? spacing : 0);
|
||||
pt.y = rcContent.y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ int TabCtrl::AppendItem(const wxString& item, int image, int selImage, void* cli
|
||||
btns.push_back(btn);
|
||||
if (btns.size() > 1)
|
||||
sizer->GetItem(sizer->GetItemCount() - 1)->SetMinSize({0, 0});
|
||||
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, item_space);
|
||||
sizer->Add(btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
sizer->AddStretchSpacer(1);
|
||||
relayout();
|
||||
return btns.size() - 1;
|
||||
@@ -256,12 +256,12 @@ void TabCtrl::relayout()
|
||||
int item = sel + 1;
|
||||
int first = 0;
|
||||
for (int i = 0; i < item; ++i)
|
||||
offset += btns[i]->GetMinSize().x + item_space * 2;
|
||||
offset += btns[i]->GetMinSize().x;
|
||||
if (item < btns.size())
|
||||
offset += btns[item]->GetMinSize().x + item_space * 2;
|
||||
offset += btns[item]->GetMinSize().x;
|
||||
int width = GetSize().x;
|
||||
for (int i = 0; i < btns.size(); ++i) {
|
||||
auto size = btns[i]->GetMinSize().x + item_space * 2;
|
||||
auto size = btns[i]->GetMinSize().x;
|
||||
if (i < sel && offset > width) {
|
||||
sizer->Show(i * 2 + 1, false);
|
||||
sizer->Show(i * 2 + 2, false);
|
||||
@@ -284,26 +284,17 @@ void TabCtrl::relayout()
|
||||
if (item >= btns.size())
|
||||
--item;
|
||||
// Keep spacing 2 ~ 10 TAB_BUTTON_SPACE
|
||||
int b = GetSize().x - offset - 10 - (item + 1 - first) * item_space * 8;
|
||||
int b = GetSize().x - offset - 10 - (item + 1 - first) * 16;
|
||||
sizer->GetItem(item * 2 + 2)->SetMinSize({b > 0 ? b : 0, 0});
|
||||
Layout();
|
||||
}
|
||||
|
||||
void TabCtrl::SetItemSpace(int space)
|
||||
{
|
||||
if (space < 0 || space == item_space)
|
||||
return;
|
||||
item_space = space;
|
||||
relayout();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
int TabCtrl::GetFullSize() const
|
||||
{
|
||||
// Mirrors relayout(): a 10px leading spacer plus every button's min width and spacing.
|
||||
// Mirrors relayout(): a 10px leading spacer plus every button's min width.
|
||||
int width = 10;
|
||||
for (const Button* btn : btns)
|
||||
width += btn->GetMinSize().x + item_space * 2;
|
||||
width += btn->GetMinSize().x;
|
||||
return width;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ class TabCtrl : public StaticBox
|
||||
|
||||
int sel = -1;
|
||||
wxFont bold;
|
||||
int item_space = 2; // space around each button, both sides (SetItemSpace)
|
||||
|
||||
public:
|
||||
TabCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
|
||||
@@ -64,10 +63,6 @@ public:
|
||||
int GetNextVisible(int item) const;
|
||||
bool IsVisible(unsigned int item) const;
|
||||
|
||||
// Extra space around each tab button (in px on both sides). Defaults to the control-wide
|
||||
// standard; call before appending items so every button picks it up.
|
||||
void SetItemSpace(int space);
|
||||
|
||||
int GetFullSize() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/Layer.hpp"
|
||||
#include "libslic3r/Print.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "libslic3r/SVG.hpp"
|
||||
#include "libslic3r/libslic3r.h"
|
||||
|
||||
@@ -676,6 +677,73 @@ TEST_CASE("Ironing follows the solid infill rotation template", "[Fill]")
|
||||
REQUIRE(compared > int(ironing.size()) / 2);
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
PrintRegionConfig ironing_config(IroningType type,
|
||||
int top_surface_filament_id = 1,
|
||||
int top_shell_layers = 3,
|
||||
int bottom_shell_layers = 1)
|
||||
{
|
||||
PrintRegionConfig cfg;
|
||||
cfg.ironing_type.value = type;
|
||||
cfg.top_surface_filament_id.value = top_surface_filament_id;
|
||||
cfg.top_shell_layers.value = top_shell_layers;
|
||||
cfg.bottom_shell_layers.value = bottom_shell_layers;
|
||||
cfg.outer_wall_filament_id.value = 1;
|
||||
cfg.wall_loops.value = 2;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_CASE("Ironing an all-solid region uses the top surface filament on every layer", "[Fill]")
|
||||
{
|
||||
const PrintRegionConfig cfg = ironing_config(IroningType::AllSolid, /*top_surface_filament_id=*/2);
|
||||
const bool is_topmost_layer = GENERATE(false, true);
|
||||
CAPTURE(is_topmost_layer);
|
||||
REQUIRE(Layer::choose_ironing_extruder(cfg, /*spiral_mode=*/false, is_topmost_layer) == 2);
|
||||
}
|
||||
|
||||
TEST_CASE("Ironing top surfaces uses the top surface filament when the region has top shells", "[Fill]")
|
||||
{
|
||||
const PrintRegionConfig cfg = ironing_config(IroningType::TopSurfaces,
|
||||
/*top_surface_filament_id=*/3,
|
||||
/*top_shell_layers=*/2);
|
||||
REQUIRE(Layer::choose_ironing_extruder(cfg, /*spiral_mode=*/false, /*is_topmost_layer=*/false) == 3);
|
||||
}
|
||||
|
||||
TEST_CASE("Ironing top surfaces without top shells needs spiral mode and more than one bottom shell", "[Fill]")
|
||||
{
|
||||
const PrintRegionConfig one_bottom_shell = ironing_config(IroningType::TopSurfaces,
|
||||
/*top_surface_filament_id=*/1,
|
||||
/*top_shell_layers=*/0,
|
||||
/*bottom_shell_layers=*/1);
|
||||
const PrintRegionConfig two_bottom_shells = ironing_config(IroningType::TopSurfaces,
|
||||
/*top_surface_filament_id=*/1,
|
||||
/*top_shell_layers=*/0,
|
||||
/*bottom_shell_layers=*/2);
|
||||
|
||||
REQUIRE(Layer::choose_ironing_extruder(two_bottom_shells, /*spiral_mode=*/true, /*is_topmost_layer=*/false) == 1);
|
||||
REQUIRE(Layer::choose_ironing_extruder(one_bottom_shell, /*spiral_mode=*/true, /*is_topmost_layer=*/false) == -1);
|
||||
REQUIRE(Layer::choose_ironing_extruder(two_bottom_shells, /*spiral_mode=*/false, /*is_topmost_layer=*/false) == -1);
|
||||
}
|
||||
|
||||
TEST_CASE("Ironing the topmost surface only applies to the topmost layer", "[Fill]")
|
||||
{
|
||||
const PrintRegionConfig cfg = ironing_config(IroningType::TopmostOnly, /*top_surface_filament_id=*/4);
|
||||
REQUIRE(Layer::choose_ironing_extruder(cfg, /*spiral_mode=*/false, /*is_topmost_layer=*/true) == 4);
|
||||
REQUIRE(Layer::choose_ironing_extruder(cfg, /*spiral_mode=*/false, /*is_topmost_layer=*/false) == -1);
|
||||
}
|
||||
|
||||
TEST_CASE("A region with ironing turned off is never ironed", "[Fill]")
|
||||
{
|
||||
const PrintRegionConfig cfg = ironing_config(IroningType::NoIroning);
|
||||
const bool spiral_mode = GENERATE(false, true);
|
||||
CAPTURE(spiral_mode);
|
||||
REQUIRE(Layer::choose_ironing_extruder(cfg, spiral_mode, /*is_topmost_layer=*/true) == -1);
|
||||
}
|
||||
|
||||
TEST_CASE("Solid infill direction offsets every layer when no template is set", "[Fill]")
|
||||
{
|
||||
auto angles_for = [](int direction) {
|
||||
|
||||
@@ -484,6 +484,34 @@ TEST_CASE("update_values_to_printer_extruders_for_multiple_filaments resolves pe
|
||||
REQUIRE(config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->values == std::vector<double>({12., 21.}));
|
||||
REQUIRE(config.option<ConfigOptionInts>("filament_self_index")->values == std::vector<int>({1, 2}));
|
||||
}
|
||||
|
||||
SECTION("a variant option shorter than the filament slots keeps its first value instead of zero") {
|
||||
DynamicPrintConfig config;
|
||||
config.option<ConfigOptionEnumsGeneric>("extruder_type", true)->values = {etDirectDrive, etDirectDrive};
|
||||
config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type", true)->values = {nvtStandard, nvtHighFlow};
|
||||
config.option<ConfigOptionStrings>("extruder_variant_list", true)->values = {"Direct Drive Standard,Direct Drive High Flow",
|
||||
"Direct Drive Standard,Direct Drive High Flow"};
|
||||
make_filament_arrays(config);
|
||||
config.option<ConfigOptionInts>("filament_map", true)->values = {1, 2};
|
||||
// no loaded preset carries the key, so only its single registered default is present
|
||||
config.option<ConfigOptionFloatsNullable>("filament_cooling_before_tower", true)->values = {10.};
|
||||
// only the first filament's two variant columns were loaded
|
||||
config.option<ConfigOptionFloatsNullable>("filament_ramming_volumetric_speed", true)->values = {-1., -2.};
|
||||
|
||||
std::vector<std::vector<NozzleVolumeType>> nozzle_volume_types;
|
||||
int extruder_count = 2;
|
||||
int count = config.get_extruder_nozzle_volume_count(extruder_count, nozzle_volume_types);
|
||||
|
||||
config.update_values_to_printer_extruders_for_multiple_filaments(config, extruder_count, count, filament_keys,
|
||||
"filament_self_index", "filament_extruder_variant");
|
||||
|
||||
// filament 2 resolves to column 3 (its extruder's High Flow column), past the end of both vectors
|
||||
REQUIRE_THAT(config.option<ConfigOptionFloatsNullable>("filament_cooling_before_tower")->values,
|
||||
Catch::Matchers::Approx(std::vector<double>({10., 10.})));
|
||||
REQUIRE_THAT(config.option<ConfigOptionFloatsNullable>("filament_ramming_volumetric_speed")->values,
|
||||
Catch::Matchers::Approx(std::vector<double>({-1., -1.})));
|
||||
REQUIRE(config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->values == std::vector<double>({12., 21.}));
|
||||
}
|
||||
}
|
||||
|
||||
// update_values_from_multi_to_multi_2 walks the DESTINATION PRINTER's variant list while writing
|
||||
|
||||
Reference in New Issue
Block a user