XY size compensation is ignored when the object is also painted using the multi-material painting gizmo. A user is also notified about it.
This commit is contained in:
parent
742a373c1f
commit
9e5fc2e713
2 changed files with 18 additions and 5 deletions
|
@ -812,7 +812,8 @@ static PrintObjectRegions* generate_print_object_regions(
|
||||||
layer_ranges_regions.push_back({ range.layer_height_range, range.config });
|
layer_ranges_regions.push_back({ range.layer_height_range, range.config });
|
||||||
}
|
}
|
||||||
|
|
||||||
update_volume_bboxes(layer_ranges_regions, out->cached_volume_ids, model_volumes, out->trafo_bboxes, std::max(0.f, xy_size_compensation));
|
const bool is_mm_painted = std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
|
||||||
|
update_volume_bboxes(layer_ranges_regions, out->cached_volume_ids, model_volumes, out->trafo_bboxes, is_mm_painted ? 0.f : std::max(0.f, xy_size_compensation));
|
||||||
|
|
||||||
std::vector<PrintRegion*> region_set;
|
std::vector<PrintRegion*> region_set;
|
||||||
auto get_create_region = [®ion_set, &all_regions](PrintRegionConfig &&config) -> PrintRegion* {
|
auto get_create_region = [®ion_set, &all_regions](PrintRegionConfig &&config) -> PrintRegion* {
|
||||||
|
@ -1313,7 +1314,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
|
||||||
m_default_region_config,
|
m_default_region_config,
|
||||||
model_object_status.print_instances.front().trafo,
|
model_object_status.print_instances.front().trafo,
|
||||||
num_extruders,
|
num_extruders,
|
||||||
float(print_object.config().xy_size_compensation.value),
|
print_object.is_mm_painted() ? 0.f : float(print_object.config().xy_size_compensation.value),
|
||||||
painting_extruders);
|
painting_extruders);
|
||||||
}
|
}
|
||||||
for (auto it = it_print_object; it != it_print_object_end; ++it)
|
for (auto it = it_print_object; it != it_print_object_end; ++it)
|
||||||
|
|
|
@ -167,7 +167,8 @@ static std::vector<VolumeSlices> slice_volumes_inner(
|
||||||
|
|
||||||
params_base.mode_below = params_base.mode;
|
params_base.mode_below = params_base.mode;
|
||||||
|
|
||||||
const auto extra_offset = std::max(0.f, float(print_object_config.xy_size_compensation.value));
|
const bool is_mm_painted = std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
|
||||||
|
const auto extra_offset = is_mm_painted ? 0.f : std::max(0.f, float(print_object_config.xy_size_compensation.value));
|
||||||
|
|
||||||
for (const ModelVolume *model_volume : model_volumes)
|
for (const ModelVolume *model_volume : model_volumes)
|
||||||
if (model_volume_needs_slicing(*model_volume)) {
|
if (model_volume_needs_slicing(*model_volume)) {
|
||||||
|
@ -725,6 +726,17 @@ void PrintObject::slice_volumes()
|
||||||
// Is any ModelVolume MMU painted?
|
// Is any ModelVolume MMU painted?
|
||||||
if (const auto& volumes = this->model_object()->volumes;
|
if (const auto& volumes = this->model_object()->volumes;
|
||||||
std::find_if(volumes.begin(), volumes.end(), [](const ModelVolume* v) { return !v->mmu_segmentation_facets.empty(); }) != volumes.end()) {
|
std::find_if(volumes.begin(), volumes.end(), [](const ModelVolume* v) { return !v->mmu_segmentation_facets.empty(); }) != volumes.end()) {
|
||||||
|
|
||||||
|
// If XY Size compensation is also enabled, notify the user that XY Size compensation
|
||||||
|
// would not be used because the object is multi-material painted.
|
||||||
|
if (m_config.xy_size_compensation.value != 0.f) {
|
||||||
|
this->active_step_add_warning(
|
||||||
|
PrintStateBase::WarningLevel::CRITICAL,
|
||||||
|
L("An object has enabled XY Size compensation which will not be used because it is also multi-material painted.\nXY Size "
|
||||||
|
"compensation cannot be combined with multi-material painting.") +
|
||||||
|
"\n" + (L("Object name")) + ": " + this->model_object()->name);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Slicing volumes - MMU segmentation";
|
BOOST_LOG_TRIVIAL(debug) << "Slicing volumes - MMU segmentation";
|
||||||
apply_mm_segmentation(*this, [print]() { print->throw_if_canceled(); });
|
apply_mm_segmentation(*this, [print]() { print->throw_if_canceled(); });
|
||||||
}
|
}
|
||||||
|
@ -733,8 +745,8 @@ void PrintObject::slice_volumes()
|
||||||
BOOST_LOG_TRIVIAL(debug) << "Slicing volumes - make_slices in parallel - begin";
|
BOOST_LOG_TRIVIAL(debug) << "Slicing volumes - make_slices in parallel - begin";
|
||||||
{
|
{
|
||||||
// Compensation value, scaled. Only applying the negative scaling here, as the positive scaling has already been applied during slicing.
|
// Compensation value, scaled. Only applying the negative scaling here, as the positive scaling has already been applied during slicing.
|
||||||
const auto xy_compensation_scaled = scaled<float>(std::min(m_config.xy_size_compensation.value, 0.));
|
const auto xy_compensation_scaled = this->is_mm_painted() ? scaled<float>(0.f) : scaled<float>(std::min(m_config.xy_size_compensation.value, 0.));
|
||||||
const float elephant_foot_compensation_scaled = (m_config.raft_layers == 0) ?
|
const float elephant_foot_compensation_scaled = (m_config.raft_layers == 0) ?
|
||||||
// Only enable Elephant foot compensation if printing directly on the print bed.
|
// Only enable Elephant foot compensation if printing directly on the print bed.
|
||||||
float(scale_(m_config.elefant_foot_compensation.value)) :
|
float(scale_(m_config.elefant_foot_compensation.value)) :
|
||||||
0.f;
|
0.f;
|
||||||
|
|
Loading…
Reference in a new issue