update xy compensation

This commit is contained in:
Wang YB
2023-11-23 13:52:00 +08:00
parent ef74fffcba
commit 0e56a49501
9 changed files with 19 additions and 21 deletions

View File

@@ -479,7 +479,7 @@ static std::vector<std::string> s_Preset_print_options {
"ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",
"perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",
"top_infill_extrusion_width", "support_material_extrusion_width", "infill_overlap", "infill_anchor", "infill_anchor_max", "bridge_flow_ratio",
//w11
//w12
"elefant_foot_compensation", "xy_size_compensation", "xy_contour_compensation", "xy_hole_compensation", "threads", "resolution", "gcode_resolution", "wipe_tower", "wipe_tower_x", "wipe_tower_y",
"wipe_tower_width", "wipe_tower_cone_angle", "wipe_tower_rotation_angle", "wipe_tower_brim_width", "wipe_tower_bridging", "single_extruder_multi_material_priming", "mmu_segmented_region_max_width",
"mmu_segmented_region_interlocking_depth", "wipe_tower_extruder", "wipe_tower_no_sparse_layers", "wipe_tower_extra_spacing", "compatible_printers", "compatible_printers_condition", "inherits",

View File

@@ -379,7 +379,7 @@ private:
void slice_volumes();
// Has any support (not counting the raft).
//w11
//w12
ExPolygons _shrink_contour_holes(double contour_delta, double hole_delta, const ExPolygons &polys) const;
void detect_surfaces_type();
void process_external_surfaces();

View File

@@ -848,7 +848,7 @@ static PrintObjectRegions* generate_print_object_regions(
const PrintRegionConfig &default_region_config,
const Transform3d &trafo,
size_t num_extruders,
//w11
//w12
const float xy_contour_compensation,
const std::vector<unsigned int> &painting_extruders)
{
@@ -880,7 +880,7 @@ static PrintObjectRegions* generate_print_object_regions(
layer_ranges_regions.push_back({ range.layer_height_range, range.config });
}
//w11
//w12
const bool is_mm_painted = num_extruders > 1 && 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_contour_compensation));
@@ -1405,7 +1405,7 @@ Print::ApplyStatus Print::apply(const Model &model, DynamicPrintConfig new_full_
m_default_region_config,
model_object_status.print_instances.front().trafo,
num_extruders,
//w11
//w12
print_object.is_mm_painted() ? 0.f : float(print_object.config().xy_contour_compensation.value),
painting_extruders);
}

View File

@@ -3386,7 +3386,6 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionInt(0));
//w11
def = this->add("xy_size_compensation", coFloat);
def->label = L("XY Size Compensation");
def->category = L("Advanced");
@@ -3396,7 +3395,7 @@ void PrintConfigDef::init_fff_params()
def->sidetext = L("mm");
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0));
//w11
//w12
def = this->add("xy_hole_compensation", coFloat);
def->label = L("X-Y hole compensation");
def->category = L("Advanced");

View File

@@ -570,7 +570,7 @@ PRINT_CONFIG_CLASS_DEFINE(
// The rest
((ConfigOptionBool, thick_bridges))
((ConfigOptionFloat, xy_size_compensation))
//w11
//w12
((ConfigOptionFloat, xy_hole_compensation))
((ConfigOptionFloat, xy_contour_compensation))
((ConfigOptionBool, wipe_into_objects))

View File

@@ -679,7 +679,7 @@ bool PrintObject::invalidate_state_by_config_options(
} else if (
opt_key == "elefant_foot_compensation"
|| opt_key == "support_material_contact_distance"
//w11
//w12
|| opt_key == "xy_size_compensation"
|| opt_key == "xy_hole_compensation"
|| opt_key == "xy_contour_compensation") {

View File

@@ -151,7 +151,7 @@ static std::vector<VolumeSlices> slice_volumes_inner(
const size_t num_extruders = print_config.nozzle_diameter.size();
const bool is_mm_painted = num_extruders > 1 && std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
//w11
//w12
//const auto extra_offset = is_mm_painted ? 0.f : std::max(0.f, float(print_object_config.xy_size_compensation.value));
const auto extra_offset = 0.f;
@@ -730,7 +730,7 @@ void PrintObject::slice_volumes()
// 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.
//w11
//w12
//if (m_config.xy_size_compensation.value != 0.f) {
if (m_config.xy_hole_compensation.value != 0.f || m_config.xy_contour_compensation.value != 0.f) {
this->active_step_add_warning(
@@ -750,7 +750,7 @@ void PrintObject::slice_volumes()
// Compensation value, scaled. Only applying the negative scaling here, as the positive scaling has already been applied during slicing.
const size_t num_extruders = print->config().nozzle_diameter.size();
const auto xy_compensation_scaled = (num_extruders > 1 && this->is_mm_painted()) ? scaled<float>(0.f) : scaled<float>(std::min(m_config.xy_size_compensation.value, 0.));
//w11
//w12
const auto xy_hole_scaled = (num_extruders > 1 && this->is_mm_painted()) ? scaled<float>(0.f) : scaled<float>(m_config.xy_hole_compensation.value);
const auto xy_contour_scaled = (num_extruders > 1 && this->is_mm_painted()) ? scaled<float>(0.f) : scaled<float>(m_config.xy_contour_compensation.value);
const float elephant_foot_compensation_scaled = (m_config.raft_layers == 0) ?
@@ -761,7 +761,7 @@ void PrintObject::slice_volumes()
ExPolygons lslices_1st_layer;
tbb::parallel_for(
tbb::blocked_range<size_t>(0, m_layers.size()),
//w11
//w12
//[this, xy_compensation_scaled, elephant_foot_compensation_scaled, &lslices_1st_layer](const tbb::blocked_range<size_t>& range) {
[this, xy_hole_scaled, xy_contour_scaled, elephant_foot_compensation_scaled, &lslices_1st_layer](const tbb::blocked_range<size_t>& range) {
for (size_t layer_id = range.begin(); layer_id < range.end(); ++ layer_id) {
@@ -776,7 +776,7 @@ void PrintObject::slice_volumes()
if (elfoot > 0) {
// Apply the elephant foot compensation and store the 1st layer slices without the Elephant foot compensation applied.
lslices_1st_layer = to_expolygons(std::move(layerm->m_slices.surfaces));
//w11
//w12
//float delta = xy_compensation_scaled;
float delta = 0.15;
if (delta > elfoot) {
@@ -790,7 +790,7 @@ void PrintObject::slice_volumes()
(delta == 0.f) ? lslices_1st_layer : offset_ex(lslices_1st_layer, delta),
layerm->flow(frExternalPerimeter), unscale<double>(elfoot))),
stInternal);
//w11
//w12
if (m_config.xy_size_compensation.value < 0.f)
lslices_1st_layer = offset_ex(std::move(lslices_1st_layer), m_config.xy_size_compensation.value);
lslices_1st_layer = to_expolygons(std::move(layerm->m_slices.surfaces));
@@ -811,7 +811,7 @@ void PrintObject::slice_volumes()
layerm->m_slices.set(
offset_ex(to_expolygons(std::move(layerm->m_slices.surfaces)), xy_compensation_scaled),
stInternal);*/
//w11
//w12
else {
if (xy_contour_scaled != 0.0f || xy_hole_scaled != 0.0f) {
ExPolygons expolygons = to_expolygons(std::move(layerm->m_slices.surfaces));
@@ -827,6 +827,7 @@ void PrintObject::slice_volumes()
}
}
} else {
//w12
/* if (xy_compensation_scaled < 0.f || elfoot > 0.f) {
// Apply the negative XY compensation.
Polygons trimming;
@@ -840,7 +841,6 @@ void PrintObject::slice_volumes()
for (size_t region_id = 0; region_id < layer->m_regions.size(); ++ region_id)
layer->m_regions[region_id]->trim_surfaces(trimming);
}*/
//w11
float max_growth = std::max(xy_hole_scaled, xy_contour_scaled);
float min_growth = std::min(xy_hole_scaled, xy_contour_scaled);
ExPolygons merged_poly_for_holes_growing;
@@ -903,7 +903,7 @@ void PrintObject::slice_volumes()
m_print->throw_if_canceled();
BOOST_LOG_TRIVIAL(debug) << "Slicing volumes - make_slices in parallel - end";
}
//w11
//w12
ExPolygons PrintObject::_shrink_contour_holes(double contour_delta, double hole_delta, const ExPolygons &polys) const
{
ExPolygons new_ex_polys;

View File

@@ -181,7 +181,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
m_support_material_overhangs_queried = false;
}
//w11
//w12
if (abs(config->option<ConfigOptionFloat>("xy_hole_compensation")->value) > 2) {
const wxString msg_text = _(L("This setting is only used for model size tunning with small value in some cases.\n"
"For example, when model size has small error and hard to be assembled.\n"

View File

@@ -1655,11 +1655,10 @@ void TabPrint::build()
optgroup->append_single_option_line("slicing_mode");
optgroup->append_single_option_line("resolution");
optgroup->append_single_option_line("gcode_resolution");
//w11
//w12
//optgroup->append_single_option_line("xy_size_compensation");
optgroup->append_single_option_line("xy_hole_compensation");
optgroup->append_single_option_line("xy_contour_compensation");
//optgroup->append_single_option_line("xy_size_compensation");
optgroup->append_single_option_line("elefant_foot_compensation", "elephant-foot-compensation_114487");
optgroup = page->new_optgroup(L("Arachne perimeter generator"));