mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-12-06 03:38:01 -05:00
Fix pipe-separated exclusion areas
Treat pipe-separated bed_exclude_area strings as extended exclusion syntax even when no Z range is present. ConfigOptionPoints now preserves and parses plain multi-region strings like XxY,...|XxY,... instead of flattening them into a single polygon. Remove the stale bed_exclude_area_3d config option and related preset/UI plumbing now that Z-limited and multi-region exclusions are represented through the existing bed_exclude_area field.
This commit is contained in:
1 parent
19a454746a
commit
ee593c2d5a
9 files changed
+15
-33
No files matched your search
@@ -1610,22 +1610,20 @@ public:
|
||||
m_serialized_override.clear();
|
||||
}
|
||||
|
||||
const bool has_z_volume_syntax = str.find("..") != std::string::npos && str.find(';') != std::string::npos;
|
||||
if (has_z_volume_syntax && ! append)
|
||||
const bool has_extended_bed_exclusion_syntax = str.find('|') != std::string::npos || (str.find("..") != std::string::npos && str.find(';') != std::string::npos);
|
||||
if (has_extended_bed_exclusion_syntax && ! append)
|
||||
m_serialized_override = str;
|
||||
|
||||
std::string points_str = str;
|
||||
if (has_z_volume_syntax) {
|
||||
if (has_extended_bed_exclusion_syntax) {
|
||||
std::ostringstream points;
|
||||
std::istringstream regions(str);
|
||||
std::string region;
|
||||
while (std::getline(regions, region, '|')) {
|
||||
const size_t sep = region.find(';');
|
||||
if (sep == std::string::npos)
|
||||
continue;
|
||||
if (points.tellp() > 0)
|
||||
points << ",";
|
||||
points << region.substr(sep + 1);
|
||||
points << (sep == std::string::npos ? region : region.substr(sep + 1));
|
||||
}
|
||||
points_str = points.str();
|
||||
}
|
||||
|
||||
@@ -1440,7 +1440,7 @@ static std::vector<std::string> s_Preset_machine_limits_options {
|
||||
static std::vector<std::string> s_Preset_printer_options {
|
||||
"printer_technology",
|
||||
"printable_area", "extruder_printable_area", "support_parallel_printheads", "parallel_printheads_count", "parallel_printheads_bed_exclude_areas",
|
||||
"bed_exclude_area", "bed_exclude_area_3d", "bed_custom_texture", "bed_custom_model", "gcode_flavor",
|
||||
"bed_exclude_area", "bed_custom_texture", "bed_custom_model", "gcode_flavor",
|
||||
"gcode_skip_config_block", "fan_kickstart", "part_cooling_fan_min_pwm", "fan_speedup_time", "fan_speedup_overhangs",
|
||||
"single_extruder_multi_material", "manual_filament_change", "file_start_gcode", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "printing_by_object_gcode", "layer_change_gcode", "time_lapse_gcode", "wrapping_detection_gcode", "change_filament_gcode", "change_extrusion_role_gcode",
|
||||
"printer_model", "printer_variant", "printer_extruder_id", "printer_extruder_variant", "extruder_variant_list", "default_nozzle_volume_type",
|
||||
@@ -3622,7 +3622,7 @@ inline t_config_option_keys deep_diff(const ConfigBase &config_this, const Confi
|
||||
if (this_opt != nullptr && other_opt != nullptr && *this_opt != *other_opt)
|
||||
{
|
||||
//BBS: add bed_exclude_area
|
||||
if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "bed_exclude_area_3d" || opt_key == "compatible_prints" || opt_key == "compatible_printers" || opt_key == "thumbnails" || opt_key == "wrapping_exclude_area" || opt_key == "slicing_pipeline_plugin") {
|
||||
if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "compatible_prints" || opt_key == "compatible_printers" || opt_key == "thumbnails" || opt_key == "wrapping_exclude_area" || opt_key == "slicing_pipeline_plugin") {
|
||||
// Scalar variable, or a vector variable, which is independent from number of extruders,
|
||||
// thus the vector is presented to the user as a single input.
|
||||
diff.emplace_back(opt_key);
|
||||
|
||||
@@ -155,7 +155,6 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
||||
"printable_area",
|
||||
//BBS: add bed_exclude_area
|
||||
"bed_exclude_area",
|
||||
"bed_exclude_area_3d",
|
||||
"thumbnail_size",
|
||||
"before_layer_change_gcode",
|
||||
"enable_pressure_advance",
|
||||
|
||||
@@ -885,14 +885,6 @@ void PrintConfigDef::init_common_params()
|
||||
def->gui_type = ConfigOptionDef::GUIType::one_string;
|
||||
def->set_default_value(new ConfigOptionPoints{ Vec2d(0, 0) });
|
||||
|
||||
def = this->add("bed_exclude_area_3d", coString);
|
||||
def->label = L("Bed exclusion volume");
|
||||
def->tooltip = L("Z-limited unprintable volumes. Use: \"ZMIN..ZMAX;XxY,XxY,...\". Separate multiple regions with \"|\". "
|
||||
"Missing Z bounds default to the bed surface or printable height.");
|
||||
def->mode = comAdvanced;
|
||||
def->gui_type = ConfigOptionDef::GUIType::one_string;
|
||||
def->set_default_value(new ConfigOptionString());
|
||||
|
||||
def = this->add("bed_custom_texture", coString);
|
||||
def->label = L("Bed custom texture");
|
||||
def->mode = comAdvanced;
|
||||
@@ -12742,7 +12734,7 @@ namespace {
|
||||
|
||||
static bool is_bed_exclusion_volume_syntax(const std::string &value)
|
||||
{
|
||||
return value.find("..") != std::string::npos && value.find(';') != std::string::npos;
|
||||
return value.find('|') != std::string::npos || (value.find("..") != std::string::npos && value.find(';') != std::string::npos);
|
||||
}
|
||||
|
||||
static bool parse_double_token(const std::string &text, double &out)
|
||||
@@ -12907,14 +12899,13 @@ static std::vector<BedExcludeRegion> get_bed_excluded_regions_impl(
|
||||
std::vector<BedExcludeRegion> get_bed_excluded_regions(const DynamicPrintConfig& cfg)
|
||||
{
|
||||
const ConfigOptionPoints *legacy = cfg.opt<ConfigOptionPoints>("bed_exclude_area");
|
||||
const ConfigOptionString *regions = cfg.opt<ConfigOptionString>("bed_exclude_area_3d");
|
||||
const ConfigOptionFloat *height = cfg.opt<ConfigOptionFloat>("printable_height");
|
||||
const std::string bed_exclude_area = legacy != nullptr ? legacy->serialize() : std::string{};
|
||||
const bool volume_syntax = is_bed_exclusion_volume_syntax(bed_exclude_area);
|
||||
|
||||
return get_bed_excluded_regions_impl(
|
||||
volume_syntax || legacy == nullptr ? Pointfs{} : legacy->values,
|
||||
volume_syntax ? bed_exclude_area : (regions != nullptr ? regions->value : std::string{}),
|
||||
volume_syntax ? bed_exclude_area : std::string{},
|
||||
height != nullptr ? height->value : 0.0);
|
||||
}
|
||||
|
||||
@@ -12925,7 +12916,7 @@ std::vector<BedExcludeRegion> get_bed_excluded_regions(const PrintConfig& cfg)
|
||||
|
||||
return get_bed_excluded_regions_impl(
|
||||
volume_syntax ? Pointfs{} : cfg.bed_exclude_area.values,
|
||||
volume_syntax ? bed_exclude_area : cfg.bed_exclude_area_3d.value,
|
||||
volume_syntax ? bed_exclude_area : std::string{},
|
||||
cfg.printable_height.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -1758,7 +1758,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
||||
((ConfigOptionStrings, parallel_printheads_bed_exclude_areas))
|
||||
//BBS: add bed_exclude_area
|
||||
((ConfigOptionPoints, bed_exclude_area))
|
||||
((ConfigOptionString, bed_exclude_area_3d))
|
||||
((ConfigOptionPoints, head_wrap_detect_zone))
|
||||
// BBS
|
||||
((ConfigOptionString, bed_custom_texture))
|
||||
|
||||
@@ -2637,7 +2637,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
||||
p->load_vendors();
|
||||
//BBS: add bed exclude areas
|
||||
p->custom_config.reset(DynamicPrintConfig::new_from_defaults_keys({
|
||||
"gcode_flavor", "printable_area", "bed_exclude_area", "bed_exclude_area_3d", "bed_custom_texture", "bed_custom_model", "nozzle_diameter", "filament_diameter", "thumbnails"
|
||||
"gcode_flavor", "printable_area", "bed_exclude_area", "bed_custom_texture", "bed_custom_model", "nozzle_diameter", "filament_diameter", "thumbnails"
|
||||
//, "nozzle_temperature", "bed_temperature"
|
||||
}));
|
||||
|
||||
|
||||
@@ -734,7 +734,8 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||
case coPoints: {
|
||||
std::vector<Vec2d> out_values;
|
||||
str.Replace(" ", wxEmptyString, true);
|
||||
const bool bed_exclusion_volume_syntax = m_opt_id == "bed_exclude_area" && str.Find("..") != wxNOT_FOUND && str.Find(";") != wxNOT_FOUND;
|
||||
const bool bed_exclusion_volume_syntax = m_opt_id == "bed_exclude_area" &&
|
||||
(str.Find("|") != wxNOT_FOUND || (str.Find("..") != wxNOT_FOUND && str.Find(";") != wxNOT_FOUND));
|
||||
const wxString raw_str = str;
|
||||
if (bed_exclusion_volume_syntax) {
|
||||
wxString points;
|
||||
@@ -742,11 +743,9 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||
while (regions.HasMoreTokens()) {
|
||||
wxString region = regions.GetNextToken();
|
||||
const int sep = region.Find(";");
|
||||
if (sep == wxNOT_FOUND)
|
||||
continue;
|
||||
if (! points.empty())
|
||||
points += ",";
|
||||
points += region.Mid(sep + 1);
|
||||
points += sep == wxNOT_FOUND ? region : region.Mid(sep + 1);
|
||||
}
|
||||
str = points;
|
||||
}
|
||||
|
||||
@@ -240,8 +240,6 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
||||
case coPoints:{
|
||||
if (opt_key == "bed_exclude_area" && boost::any_cast<std::string>(&value) != nullptr) {
|
||||
config.option<ConfigOptionPoints>(opt_key)->deserialize(boost::any_cast<std::string>(value));
|
||||
if (config.has("bed_exclude_area_3d"))
|
||||
config.set_key_value("bed_exclude_area_3d", new ConfigOptionString());
|
||||
break;
|
||||
}
|
||||
if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "thumbnails" || opt_key == "wrapping_exclude_area" ) {
|
||||
@@ -249,8 +247,6 @@ void change_opt_value(DynamicPrintConfig& config, const t_config_option_key& opt
|
||||
if (opt_key == "bed_exclude_area") {
|
||||
ConfigOptionPoints normalized(boost::any_cast<std::vector<Vec2d>>(value));
|
||||
config.option<ConfigOptionPoints>(opt_key)->deserialize(normalized.serialize());
|
||||
if (config.has("bed_exclude_area_3d"))
|
||||
config.set_key_value("bed_exclude_area_3d", new ConfigOptionString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7331,7 +7331,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
, main_frame(main_frame)
|
||||
//BBS: add bed_exclude_area
|
||||
, config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({
|
||||
"printable_area", "bed_exclude_area", "bed_exclude_area_3d", "wrapping_exclude_area", "extruder_printable_area", "bed_custom_texture", "bed_custom_model", "print_sequence",
|
||||
"printable_area", "bed_exclude_area", "wrapping_exclude_area", "extruder_printable_area", "bed_custom_texture", "bed_custom_model", "print_sequence",
|
||||
"extruder_clearance_radius",
|
||||
"extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
||||
"nozzle_height", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle",
|
||||
@@ -20090,7 +20090,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
||||
p->partplate_list.invalid_all_slice_result();
|
||||
}
|
||||
//BBS: add bed_exclude_area
|
||||
else if (opt_key == "printable_area" || opt_key == "bed_exclude_area" || opt_key == "bed_exclude_area_3d"
|
||||
else if (opt_key == "printable_area" || opt_key == "bed_exclude_area"
|
||||
|| opt_key == "bed_custom_texture" || opt_key == "bed_custom_model"
|
||||
|| opt_key == "extruder_clearance_height_to_lid"
|
||||
|| opt_key == "extruder_clearance_height_to_rod") {
|
||||
|
||||
Reference in new issue
Block a user