mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-13 12:07:41 +00:00
Feature/fix profile variants issus (#14084)
* add print variant validation * fix one profile error * fix more prifiles
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
"printer_model": "Creality CR-10 V3",
|
"printer_model": "Creality CR-10 V3",
|
||||||
"printer_structure": "i3",
|
"printer_structure": "i3",
|
||||||
"default_print_profile": "0.20mm Standard @Creality CR10V3 0.6",
|
"default_print_profile": "0.20mm Standard @Creality CR10V3 0.6",
|
||||||
|
"printer_variant": "0.6",
|
||||||
"nozzle_diameter": [
|
"nozzle_diameter": [
|
||||||
"0.6"
|
"0.6"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
"nozzle_diameter": [
|
"nozzle_diameter": [
|
||||||
"0.2"
|
"0.2"
|
||||||
],
|
],
|
||||||
|
"printer_variant": "0.2",
|
||||||
"retraction_length": [
|
"retraction_length": [
|
||||||
"0.5"
|
"0.5"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"from": "system",
|
"from": "system",
|
||||||
"setting_id": "GM002",
|
"setting_id": "GM002",
|
||||||
"instantiation": "true",
|
"instantiation": "true",
|
||||||
"printer_variant": "HS",
|
"printer_variant": "0.4HS",
|
||||||
"printer_model": "Flashforge Adventurer 4 Series",
|
"printer_model": "Flashforge Adventurer 4 Series",
|
||||||
"default_print_profile": "0.20mm High-Speed @Flashforge AD4 HS Nozzle",
|
"default_print_profile": "0.20mm High-Speed @Flashforge AD4 HS Nozzle",
|
||||||
"nozzle_diameter": [
|
"nozzle_diameter": [
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"type": "machine_model",
|
"type": "machine_model",
|
||||||
"name": "Flashforge Adventurer 4 Series",
|
"name": "Flashforge Adventurer 4 Series",
|
||||||
"model_id": "Flashforge Adventurer 4 Series",
|
"model_id": "Flashforge Adventurer 4 Series",
|
||||||
"nozzle_diameter": "0.3;0.4;0.6;HS",
|
"nozzle_diameter": "0.3;0.4;0.6;0.4HS",
|
||||||
"machine_tech": "FFF",
|
"machine_tech": "FFF",
|
||||||
"family": "Flashforge",
|
"family": "Flashforge",
|
||||||
"host_type": "Flashforge",
|
"host_type": "Flashforge",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
"printer_settings_id": "Flashforge Guider4 0.4 HF nozzle",
|
"printer_settings_id": "Flashforge Guider4 0.4 HF nozzle",
|
||||||
"printer_structure": "undefine",
|
"printer_structure": "undefine",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.4",
|
"printer_variant": "0.4HF",
|
||||||
"printhost_authorization_type": "key",
|
"printhost_authorization_type": "key",
|
||||||
"printhost_ssl_ignore_revoke": "0",
|
"printhost_ssl_ignore_revoke": "0",
|
||||||
"printing_by_object_gcode": "",
|
"printing_by_object_gcode": "",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
"printer_settings_id": "Flashforge Guider4 0.6 HF nozzle",
|
"printer_settings_id": "Flashforge Guider4 0.6 HF nozzle",
|
||||||
"printer_structure": "undefine",
|
"printer_structure": "undefine",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.6",
|
"printer_variant": "0.6HF",
|
||||||
"printhost_authorization_type": "key",
|
"printhost_authorization_type": "key",
|
||||||
"printhost_ssl_ignore_revoke": "0",
|
"printhost_ssl_ignore_revoke": "0",
|
||||||
"printing_by_object_gcode": "",
|
"printing_by_object_gcode": "",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
"printer_settings_id": "Flashforge Guider4 0.8 HF nozzle",
|
"printer_settings_id": "Flashforge Guider4 0.8 HF nozzle",
|
||||||
"printer_structure": "undefine",
|
"printer_structure": "undefine",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.6",
|
"printer_variant": "0.8HF",
|
||||||
"printhost_authorization_type": "key",
|
"printhost_authorization_type": "key",
|
||||||
"printhost_ssl_ignore_revoke": "0",
|
"printhost_ssl_ignore_revoke": "0",
|
||||||
"printing_by_object_gcode": "",
|
"printing_by_object_gcode": "",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
"printer_settings_id": "Flashforge Guider4 Pro 0.4 HF nozzle",
|
"printer_settings_id": "Flashforge Guider4 Pro 0.4 HF nozzle",
|
||||||
"printer_structure": "undefine",
|
"printer_structure": "undefine",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.4",
|
"printer_variant": "0.4HF",
|
||||||
"printhost_authorization_type": "key",
|
"printhost_authorization_type": "key",
|
||||||
"printhost_ssl_ignore_revoke": "0",
|
"printhost_ssl_ignore_revoke": "0",
|
||||||
"printing_by_object_gcode": "",
|
"printing_by_object_gcode": "",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
"printer_settings_id": "Flashforge Guider4 Pro 0.6 HF nozzle",
|
"printer_settings_id": "Flashforge Guider4 Pro 0.6 HF nozzle",
|
||||||
"printer_structure": "undefine",
|
"printer_structure": "undefine",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.6",
|
"printer_variant": "0.6HF",
|
||||||
"printhost_authorization_type": "key",
|
"printhost_authorization_type": "key",
|
||||||
"printhost_ssl_ignore_revoke": "0",
|
"printhost_ssl_ignore_revoke": "0",
|
||||||
"printing_by_object_gcode": "",
|
"printing_by_object_gcode": "",
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
"printer_settings_id": "Flashforge Guider4 Pro 0.8 HF nozzle",
|
"printer_settings_id": "Flashforge Guider4 Pro 0.8 HF nozzle",
|
||||||
"printer_structure": "undefine",
|
"printer_structure": "undefine",
|
||||||
"printer_technology": "FFF",
|
"printer_technology": "FFF",
|
||||||
"printer_variant": "0.6",
|
"printer_variant": "0.8HF",
|
||||||
"printhost_authorization_type": "key",
|
"printhost_authorization_type": "key",
|
||||||
"printhost_ssl_ignore_revoke": "0",
|
"printhost_ssl_ignore_revoke": "0",
|
||||||
"printing_by_object_gcode": "",
|
"printing_by_object_gcode": "",
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
"enable_support": "0",
|
"enable_support": "0",
|
||||||
"filename_format": "{input_filename_base}.gcode",
|
"filename_format": "{input_filename_base}.gcode",
|
||||||
"fill_multiline": "1",
|
"fill_multiline": "1",
|
||||||
"first_x_layer_fan_speed": "0",
|
|
||||||
"gap_infill_speed": [
|
"gap_infill_speed": [
|
||||||
"50"
|
"50"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"printer_model": "RatRig V-Core 4 HYBRID 500",
|
"printer_model": "RatRig V-Core 4 HYBRID 500",
|
||||||
"printer_variant": "0.5",
|
"printer_variant": "0.5",
|
||||||
"nozzle_diameter": [
|
"nozzle_diameter": [
|
||||||
"0.4"
|
"0.5"
|
||||||
],
|
],
|
||||||
"printable_area": [
|
"printable_area": [
|
||||||
"0x0",
|
"0x0",
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"printer_model": "RatRig V-Core 4 HYBRID 500",
|
"printer_model": "RatRig V-Core 4 HYBRID 500",
|
||||||
"printer_variant": "0.8",
|
"printer_variant": "0.8",
|
||||||
"nozzle_diameter": [
|
"nozzle_diameter": [
|
||||||
"0.6"
|
"0.8"
|
||||||
],
|
],
|
||||||
"printable_area": [
|
"printable_area": [
|
||||||
"0x0",
|
"0x0",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "libslic3r.h"
|
#include "libslic3r.h"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
#include "LocalesUtils.hpp"
|
||||||
#include "Model.hpp"
|
#include "Model.hpp"
|
||||||
#include "libslic3r_version.h"
|
#include "libslic3r_version.h"
|
||||||
|
|
||||||
@@ -2231,6 +2232,7 @@ std::pair<PresetsConfigSubstitutions, std::string> PresetBundle::load_system_pre
|
|||||||
[&](const tbb::blocked_range<size_t>& range) {
|
[&](const tbb::blocked_range<size_t>& range) {
|
||||||
for (size_t i = range.begin(); i < range.end(); ++i) {
|
for (size_t i = range.begin(); i < range.end(); ++i) {
|
||||||
auto bundle = std::make_unique<PresetBundle>();
|
auto bundle = std::make_unique<PresetBundle>();
|
||||||
|
bundle->set_is_validation_mode(validation_mode);
|
||||||
try {
|
try {
|
||||||
auto result = bundle->load_vendor_configs_from_json(
|
auto result = bundle->load_vendor_configs_from_json(
|
||||||
dir.string(), other_vendors[i], PresetBundle::LoadSystem,
|
dir.string(), other_vendors[i], PresetBundle::LoadSystem,
|
||||||
@@ -4982,6 +4984,39 @@ std::pair<PresetsConfigSubstitutions, size_t> PresetBundle::load_vendor_configs_
|
|||||||
reason = std::string("can not find printer_variant in vendor profile");
|
reason = std::string("can not find printer_variant in vendor profile");
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
// An instantiation printer profile's nozzle_diameter must match the numeric (diameter)
|
||||||
|
// prefix of its printer_variant: "0.4" -> {0.4}, "0.8HF" -> {0.8} (a trailing
|
||||||
|
// non-numeric suffix such as "HF"/"HS" distinguishes a hardware sub-variant and is
|
||||||
|
// ignored here), and for multi-nozzle printers "0.4+0.6" -> {0.4, 0.6}.
|
||||||
|
// Note: a variant may legitimately repeat across presets of the same model (e.g. speed
|
||||||
|
// modes, IDEX copy/mirror, or different control boards), so only the diameter is
|
||||||
|
// validated, not variant uniqueness. Validation-only so the app keeps loading existing
|
||||||
|
// profiles unchanged.
|
||||||
|
if (validation_mode && instantiation == "true") {
|
||||||
|
const auto *nd = config.option<ConfigOptionFloats>("nozzle_diameter");
|
||||||
|
std::set<double> nozzles, variant_nozzles;
|
||||||
|
if (nd != nullptr)
|
||||||
|
nozzles.insert(nd->values.begin(), nd->values.end());
|
||||||
|
std::vector<std::string> variant_tokens;
|
||||||
|
boost::algorithm::split(variant_tokens, printer_variant, boost::algorithm::is_any_of("+"));
|
||||||
|
bool variant_ok = true; // printer_variant is already guaranteed non-empty above
|
||||||
|
for (const std::string &tok : variant_tokens) {
|
||||||
|
size_t consumed = 0;
|
||||||
|
double d = string_to_double_decimal_point(tok, &consumed);
|
||||||
|
// Require a leading numeric diameter; a trailing suffix (e.g. "HF") is allowed.
|
||||||
|
if (consumed == 0) { variant_ok = false; break; }
|
||||||
|
variant_nozzles.insert(d);
|
||||||
|
}
|
||||||
|
if (!variant_ok || variant_nozzles != nozzles) {
|
||||||
|
++m_errors;
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Error in a Vendor Config Bundle \"" << path << "\": The printer preset \"" <<
|
||||||
|
preset_name << "\" has printer_variant \"" << printer_variant <<
|
||||||
|
"\" that does not match its nozzle_diameter \"" << (nd ? nd->serialize() : std::string()) << "\". "
|
||||||
|
"printer_variant must begin with the nozzle diameter, optionally followed by a non-numeric suffix "
|
||||||
|
"(e.g. \"0.4\", \"0.8HF\"); for multi-nozzle printers, join the per-nozzle diameters with \"+\" in "
|
||||||
|
"nozzle order (e.g. \"0.4+0.6\").";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const Preset *preset_existing = presets_collection->find_preset(preset_name, false);
|
const Preset *preset_existing = presets_collection->find_preset(preset_name, false);
|
||||||
if (preset_existing != nullptr) {
|
if (preset_existing != nullptr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user