mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-30 00:45:26 -05:00
Preserve additive bed areas across preview arrange and cutter paths
This commit is contained in:
1 parent
20ef416b37
commit
9bbb7ff2c4
10 files changed
+152
-22
No files matched your search
+1
-1
@@ -187,7 +187,7 @@ using namespace Slic3r;
|
||||
static Pointfs legacy_bed_exclude_area_points(const DynamicPrintConfig &config)
|
||||
{
|
||||
const ConfigOptionPoints *option = config.option<ConfigOptionPoints>("bed_exclude_area");
|
||||
return option != nullptr && !has_bed_exclude_volumes(config) ? option->values : Pointfs{};
|
||||
return option != nullptr ? option->values : Pointfs{};
|
||||
}
|
||||
|
||||
std::map<int, std::string> cli_errors = {
|
||||
|
||||
@@ -338,7 +338,7 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
|
||||
Vec2d end_point = points[1];
|
||||
|
||||
// the cutter area size(18, 28)
|
||||
Pointfs excluse_area = has_bed_exclude_volumes(print.config()) ? Pointfs{} : print.config().bed_exclude_area.values;
|
||||
Pointfs excluse_area = print.config().bed_exclude_area.values;
|
||||
if (excluse_area.size() != 4)
|
||||
return out_points;
|
||||
|
||||
@@ -2992,9 +2992,9 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
||||
const int extruder_id = m_processor.get_result().exclusion_volume_conflict_extruder_id;
|
||||
std::string warning = extruder_id >= 0 ?
|
||||
Slic3r::format(
|
||||
_(L("A G-code move intersects an exclusion volume for extruder %1%. This may cause a printer collision.")),
|
||||
_(L("A G-code move intersects a collision volume for extruder %1%. This may cause a printer collision.")),
|
||||
std::to_string(extruder_id + 1)) :
|
||||
_(L("A G-code move intersects an exclusion volume. This may cause a printer collision."));
|
||||
_(L("A G-code move intersects a collision volume. This may cause a printer collision."));
|
||||
if (m_processor.get_result().exclusion_volume_conflict_used_unknown_z) {
|
||||
warning += "\n" + Slic3r::format(
|
||||
_(L("The intersecting move is at G-code line %1%. Its Z position is unknown after homing, so Orca checked it against every height.")),
|
||||
|
||||
@@ -3328,7 +3328,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||
|
||||
//BBS: add bed_exclude_area
|
||||
const ConfigOptionPoints* bed_exclude_area = config.option<ConfigOptionPoints>("bed_exclude_area");
|
||||
if (bed_exclude_area != nullptr && !has_bed_exclude_volumes(config))
|
||||
if (bed_exclude_area != nullptr)
|
||||
m_result.bed_exclude_area = bed_exclude_area->values;
|
||||
|
||||
const ConfigOptionPoints* wrapping_exclude_area = config.option<ConfigOptionPoints>("wrapping_exclude_area");
|
||||
|
||||
@@ -949,8 +949,8 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
|
||||
const std::string collision_message = !exclusion_collision->collision_volume ?
|
||||
(boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) % instance.model_instance->get_object()->name).str() :
|
||||
is_auto_filament_map_mode(print.get_filament_map_mode()) && print.is_BBL_printer() ?
|
||||
(boost::format(L("%1% intersects exclusion volumes for every available extruder.")) % instance.model_instance->get_object()->name).str() :
|
||||
(boost::format(L("%1% intersects an exclusion volume for extruder %2%.")) % instance.model_instance->get_object()->name % (exclusion_collision->extruder_id + 1)).str();
|
||||
(boost::format(L("%1% intersects collision volumes for every available extruder.")) % instance.model_instance->get_object()->name).str() :
|
||||
(boost::format(L("%1% intersects a collision volume for extruder %2%.")) % instance.model_instance->get_object()->name % (exclusion_collision->extruder_id + 1)).str();
|
||||
if (single_object_exception.string.empty()) {
|
||||
single_object_exception.string = collision_message;
|
||||
// single_object_exception.object = instance.model_instance->get_object();
|
||||
@@ -1620,8 +1620,8 @@ static StringObjectException layered_print_cleareance_valid(const Print &print,
|
||||
const std::string message = !exclusion_collision->collision_volume ?
|
||||
(boost::format(L("%1% is too close to exclusion area. There may be collisions when printing.")) % inst->model_instance->get_object()->name).str() :
|
||||
is_auto_filament_map_mode(print.get_filament_map_mode()) && print.is_BBL_printer() ?
|
||||
(boost::format(L("%1% intersects exclusion volumes for every available extruder.")) % inst->model_instance->get_object()->name).str() :
|
||||
(boost::format(L("%1% intersects an exclusion volume for extruder %2%.")) % inst->model_instance->get_object()->name % (exclusion_collision->extruder_id + 1)).str();
|
||||
(boost::format(L("%1% intersects collision volumes for every available extruder.")) % inst->model_instance->get_object()->name).str() :
|
||||
(boost::format(L("%1% intersects a collision volume for extruder %2%.")) % inst->model_instance->get_object()->name % (exclusion_collision->extruder_id + 1)).str();
|
||||
return {message + "\n", inst->model_instance};
|
||||
}
|
||||
|
||||
|
||||
@@ -1057,8 +1057,8 @@ void PrintConfigDef::init_common_params()
|
||||
def->set_default_value(new ConfigOptionString());
|
||||
|
||||
def = this->add("bed_exclude_volume_mode", coEnum);
|
||||
def->label = L("Collision volume behaviour");
|
||||
def->tooltip = L("Choose whether all nozzles use the same exclusion volumes, derive toolhead-relative volumes from each nozzle's XY offset, or configure independent volumes for every extruder. In individual mode, select each extruder on the Extruder page to configure its volumes.");
|
||||
def->label = L("Collision volume behavior");
|
||||
def->tooltip = L("Choose whether all nozzles use the same collision volumes, derive toolhead-relative volumes from each nozzle's XY offset, or configure independent volumes for every extruder. In individual mode, select each extruder on the Extruder page to configure its volumes.");
|
||||
def->enum_keys_map = &ConfigOptionEnum<BedExcludeVolumeMode>::get_enum_values();
|
||||
def->enum_values = { "shared", "toolhead_offset", "per_extruder" };
|
||||
def->enum_labels = { L("Shared"), L("Toolhead-relative (nozzle offsets)"), L("Individual per extruder") };
|
||||
@@ -1067,7 +1067,7 @@ void PrintConfigDef::init_common_params()
|
||||
|
||||
def = this->add("extruder_bed_exclude_volumes", coStrings);
|
||||
def->label = L("Extruder collision volumes");
|
||||
def->tooltip = L("Collision volumes used only by this extruder in individual mode. Use the same polygon and optional Z-range format as the shared exclusion volumes. Leave empty for no exclusion volumes on this extruder. Automatic arrangement conservatively uses the bounding box of a non-convex volume.");
|
||||
def->tooltip = L("Collision volumes used only by this extruder in individual mode. Use the same polygon and optional Z-range format as the shared collision volumes. Leave empty for no collision volumes on this extruder. Automatic arrangement conservatively uses the bounding box of a non-convex volume.");
|
||||
def->mode = comAdvanced;
|
||||
def->gui_type = ConfigOptionDef::GUIType::one_string;
|
||||
def->set_default_value(new ConfigOptionStrings{ "" });
|
||||
@@ -12394,16 +12394,16 @@ std::map<std::string, std::string> validate(const FullPrintConfig &cfg, bool und
|
||||
if (cfg.bed_exclude_volume_mode.value != BedExcludeVolumeMode::PerExtruder &&
|
||||
!cfg.bed_exclude_volumes.value.empty() &&
|
||||
!is_valid_bed_exclude_volumes_string(cfg.bed_exclude_volumes.value, cfg.printable_height.value)) {
|
||||
error_message.emplace("bed_exclude_volumes", L("Invalid exclusion volume definition."));
|
||||
error_message.emplace("bed_exclude_volumes", L("Invalid collision volume definition."));
|
||||
}
|
||||
if (collision_volumes_enabled && cfg.bed_exclude_volume_mode.value == BedExcludeVolumeMode::ToolheadOffset &&
|
||||
cfg.extruder_offset.size() < cfg.nozzle_diameter.size()) {
|
||||
error_message.emplace("extruder_offset", L("A nozzle offset is required for every extruder when toolhead-relative exclusion volumes are enabled."));
|
||||
error_message.emplace("extruder_offset", L("A nozzle offset is required for every extruder when toolhead-relative collision volumes are enabled."));
|
||||
}
|
||||
if (collision_volumes_enabled && cfg.bed_exclude_volume_mode.value == BedExcludeVolumeMode::PerExtruder) {
|
||||
for (const std::string &entry : cfg.extruder_bed_exclude_volumes.values) {
|
||||
if (!is_valid_bed_exclude_volumes_string(entry, cfg.printable_height.value)) {
|
||||
error_message.emplace("extruder_bed_exclude_volumes", L("Invalid per-extruder exclusion volume definition."));
|
||||
error_message.emplace("extruder_bed_exclude_volumes", L("Invalid per-extruder collision volume definition."));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
|
||||
} else if (m_opt.opt_key == "bed_exclude_volumes" || m_opt.opt_key == "extruder_bed_exclude_volumes") {
|
||||
const std::string definition = into_u8(str);
|
||||
if (!is_valid_bed_exclude_volumes_string(definition, std::numeric_limits<double>::max())) {
|
||||
show_error(m_parent, _L("Invalid exclusion volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |."));
|
||||
show_error(m_parent, _L("Invalid collision volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |."));
|
||||
const std::string old_value = m_value.empty() ? std::string{} : boost::any_cast<std::string>(m_value);
|
||||
set_value(from_u8(old_value), true);
|
||||
break;
|
||||
|
||||
@@ -21678,7 +21678,7 @@ void Plater::set_bed_shape() const
|
||||
const ConfigOptionPoints *bed_exclude_area = p->config->option<ConfigOptionPoints>("bed_exclude_area");
|
||||
set_bed_shape(p->config->option<ConfigOptionPoints>("printable_area")->values,
|
||||
//BBS: add bed exclude areas
|
||||
has_bed_exclude_volumes(*p->config) ? Pointfs{} : bed_exclude_area->values,
|
||||
bed_exclude_area->values,
|
||||
p->config->option<ConfigOptionPoints>("wrapping_exclude_area")->values,
|
||||
p->config->option<ConfigOptionFloat>("printable_height")->value,
|
||||
p->config->option<ConfigOptionPointsGroups>("extruder_printable_area")->values,
|
||||
|
||||
@@ -1952,7 +1952,7 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
if (definition != nullptr && is_bed_exclusion_volume_syntax(*definition)) {
|
||||
const double printable_height = m_config->opt_float("printable_height");
|
||||
if (!is_valid_bed_exclude_volumes_string(*definition, printable_height)) {
|
||||
show_error(wxGetApp().plater(), _L("Invalid exclusion volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |."));
|
||||
show_error(wxGetApp().plater(), _L("Invalid collision volume format. Use XxY, XxY, ... or ZMIN..ZMAX;XxY, XxY, ... and separate multiple volumes with |."));
|
||||
reload_config();
|
||||
return;
|
||||
}
|
||||
@@ -5302,8 +5302,8 @@ void TabPrinter::build_fff()
|
||||
|
||||
option = optgroup->get_option("bed_exclude_volumes");
|
||||
option.opt.full_width = true;
|
||||
optgroup->append_single_option_line(option);
|
||||
optgroup->append_single_option_line("bed_exclude_volume_mode");
|
||||
optgroup->append_single_option_line(option, "printer_basic_information_printable_space#toolhead-collision-volumes");
|
||||
optgroup->append_single_option_line("bed_exclude_volume_mode", "printer_basic_information_printable_space#toolhead-collision-volumes");
|
||||
|
||||
optgroup->append_single_option_line("printable_height", "printer_basic_information_printable_space#printable-height");
|
||||
optgroup->append_single_option_line("support_multi_bed_types", "printer_basic_information_printable_space#support-multi-bed-types");
|
||||
@@ -6123,7 +6123,7 @@ if (is_marlin_flavor)
|
||||
|
||||
Option exclusion_option = optgroup->get_option("extruder_bed_exclude_volumes", extruder_idx);
|
||||
exclusion_option.opt.full_width = true;
|
||||
optgroup->append_single_option_line(exclusion_option, "printer_basic_information_printable_space#excluded-bed-area");
|
||||
optgroup->append_single_option_line(exclusion_option, "printer_basic_information_printable_space#toolhead-collision-volumes");
|
||||
|
||||
optgroup->m_on_change = [this](const t_config_option_key& opt_key, boost::any value)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user