FIX: auto arranging issues with locked plates
1. global auto arranging may put items overlap with wipe tower if some plates are locked jira: STUDIO-5329 2. items outside bed may overlap with plate boundary if it's rotated jira: STUDIO-5329 3. plate-wise auto arranging uses wrong min_obj_distance if the plate is by-layer printing but global setting is by-object printing jira: STUDIO-5330 Change-Id: I5dba2f1317e183c9aeec1cb2bd227fbddf4316e6 (cherry picked from commit db1eac41efff5f1e8d5ac0af74c6fc7ab59fc253)
This commit is contained in:
parent
adc95d91a5
commit
e083a155b1
|
@ -322,25 +322,29 @@ void ArrangeJob::prepare_wipe_tower()
|
|||
extruder_ids = ppl.get_extruders(true);
|
||||
}
|
||||
|
||||
int bedid_unlocked = 0;
|
||||
for (int bedid = 0; bedid < MAX_NUM_PLATES; bedid++) {
|
||||
int plate_index_valid = std::min(bedid, plate_count - 1);
|
||||
PartPlate* pl = ppl.get_plate(plate_index_valid);
|
||||
if(bedid<plate_count && pl->is_locked())
|
||||
continue;
|
||||
if (auto wti = get_wipe_tower(*m_plater, bedid)) {
|
||||
// wipe tower is already there
|
||||
wipe_tower_ap = get_wipetower_arrange_poly(&wti);
|
||||
wipe_tower_ap.bed_idx = bedid;
|
||||
wipe_tower_ap.bed_idx = bedid_unlocked;
|
||||
m_unselected.emplace_back(wipe_tower_ap);
|
||||
}
|
||||
else if (need_wipe_tower) {
|
||||
if (only_on_partplate) {
|
||||
int plate_index_valid = std::min(bedid, plate_count - 1);
|
||||
PartPlate* pl = ppl.get_plate(plate_index_valid);
|
||||
auto plate_extruders = pl->get_extruders(true);
|
||||
extruder_ids.clear();
|
||||
extruder_ids.insert(plate_extruders.begin(), plate_extruders.end());
|
||||
}
|
||||
wipe_tower_ap = estimate_wipe_tower_info(bedid, extruder_ids);
|
||||
wipe_tower_ap.bed_idx = bedid;
|
||||
wipe_tower_ap.bed_idx = bedid_unlocked;
|
||||
m_unselected.emplace_back(wipe_tower_ap);
|
||||
}
|
||||
bedid_unlocked++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,7 +372,6 @@ void ArrangeJob::prepare_partplate() {
|
|||
return;
|
||||
}
|
||||
|
||||
params.is_seq_print = plate->get_real_print_seq() == PrintSequence::ByObject;
|
||||
Model& model = m_plater->model();
|
||||
|
||||
// Go through the objects and check if inside the selection
|
||||
|
@ -548,9 +551,10 @@ void ArrangeJob::process()
|
|||
BOOST_LOG_TRIVIAL(warning)<< "Arrange full params: "<< params.to_json();
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items selected before arranging: %1%") % m_selected.size();
|
||||
for (auto selected : m_selected) {
|
||||
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx<<", filemant_type:" << selected.filament_temp_type;
|
||||
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx << ", filemant_type:" << selected.filament_temp_type
|
||||
<< ", trans: " << selected.translation.transpose();
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << "items unselected before arrange: ";
|
||||
BOOST_LOG_TRIVIAL(debug) << "arrange: items unselected before arrange: " << m_unselected.size();
|
||||
for (auto item : m_unselected)
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose()
|
||||
<<", bbox:"<<get_extents(item.poly).min.transpose()<<","<<get_extents(item.poly).max.transpose();
|
||||
|
@ -561,12 +565,12 @@ void ArrangeJob::process()
|
|||
// sort by item id
|
||||
std::sort(m_selected.begin(), m_selected.end(), [](auto a, auto b) {return a.itemid < b.itemid; });
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items unselected before arranging: %1%") % m_unselected.size();
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("arrange: items selected after arranging: %1%") % m_selected.size();
|
||||
for (auto selected : m_selected)
|
||||
BOOST_LOG_TRIVIAL(debug) << selected.name << ", extruder: " << selected.extrude_ids.back() << ", bed: " << selected.bed_idx
|
||||
<< ", bed_temp: " << selected.first_bed_temp << ", print_temp: " << selected.print_temp
|
||||
<< ", trans: " << unscale<double>(selected.translation(X)) << ","<< unscale<double>(selected.translation(Y));
|
||||
BOOST_LOG_TRIVIAL(debug) << "items unselected after arrange: ";
|
||||
BOOST_LOG_TRIVIAL(debug) << "arrange: items unselected after arrange: "<< m_unselected.size();
|
||||
for (auto item : m_unselected)
|
||||
BOOST_LOG_TRIVIAL(debug) << item.name << ", bed: " << item.bed_idx << ", trans: " << item.translation.transpose();
|
||||
}
|
||||
|
@ -759,7 +763,11 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
|
|||
if (state == Job::JobPrepareState::PREPARE_STATE_MENU) {
|
||||
PartPlateList &plate_list = p->get_partplate_list();
|
||||
PartPlate * plate = plate_list.get_curr_plate();
|
||||
params.is_seq_print = plate->get_real_print_seq() == PrintSequence::ByObject;
|
||||
bool plate_same_as_global = true;
|
||||
params.is_seq_print = plate->get_real_print_seq(&plate_same_as_global) == PrintSequence::ByObject;
|
||||
// if plate's print sequence is not the same as global, the settings.distance is no longer valid, we set it to auto
|
||||
if (!plate_same_as_global)
|
||||
params.min_obj_distance = 0;
|
||||
}
|
||||
|
||||
if (params.is_seq_print) {
|
||||
|
|
|
@ -242,13 +242,21 @@ PrintSequence PartPlate::get_print_seq() const
|
|||
return PrintSequence::ByDefault;
|
||||
}
|
||||
|
||||
PrintSequence PartPlate::get_real_print_seq() const
|
||||
PrintSequence PartPlate::get_real_print_seq(bool* plate_same_as_global) const
|
||||
{
|
||||
PrintSequence global_print_seq = PrintSequence::ByDefault;
|
||||
auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
if (curr_preset_config.has("print_sequence"))
|
||||
global_print_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>("print_sequence")->value;
|
||||
|
||||
PrintSequence curr_plate_seq = get_print_seq();
|
||||
if (curr_plate_seq == PrintSequence::ByDefault) {
|
||||
auto curr_preset_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||
if (curr_preset_config.has("print_sequence")) curr_plate_seq = curr_preset_config.option<ConfigOptionEnum<PrintSequence>>("print_sequence")->value;
|
||||
curr_plate_seq = global_print_seq;
|
||||
}
|
||||
|
||||
if(plate_same_as_global)
|
||||
*plate_same_as_global = (curr_plate_seq == global_print_seq);
|
||||
|
||||
return curr_plate_seq;
|
||||
}
|
||||
|
||||
|
@ -4591,11 +4599,9 @@ void PartPlateList::postprocess_arrange_polygon(arrangement::ArrangePolygon& arr
|
|||
{
|
||||
// outarea for large object
|
||||
arrange_polygon.bed_idx = m_plate_list.size();
|
||||
BoundingBox apbox = get_extents(arrange_polygon.poly);
|
||||
BoundingBox apbox = get_extents(arrange_polygon.transformed_poly()); // the item may have been rotated
|
||||
auto apbox_size = apbox.size();
|
||||
|
||||
//arrange_polygon.translation(X) = scaled<double>(0.5 * plate_stride_x());
|
||||
//arrange_polygon.translation(Y) = scaled<double>(0.5 * plate_stride_y());
|
||||
arrange_polygon.translation(X) = 0.5 * apbox_size[0];
|
||||
arrange_polygon.translation(Y) = scaled<double>(static_cast<double>(m_plate_depth)) - 0.5 * apbox_size[1];
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ public:
|
|||
// Get the real effective print sequence of current plate.
|
||||
// If curr_plate's print_seq is ByDefault, use the global sequence
|
||||
// @return PrintSequence::{ByLayer,ByObject}
|
||||
PrintSequence get_real_print_seq() const;
|
||||
PrintSequence get_real_print_seq(bool* plate_same_as_global=nullptr) const;
|
||||
|
||||
bool has_spiral_mode_config() const;
|
||||
bool get_spiral_vase_mode() const;
|
||||
|
@ -694,6 +694,7 @@ public:
|
|||
|
||||
std::vector<const GCodeProcessorResult*> get_nonempty_plates_slice_results();
|
||||
|
||||
//compute the origin for printable plate with index i
|
||||
Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); }
|
||||
Vec2d get_current_shape_position() { return compute_shape_position(m_current_plate, m_plate_cols); }
|
||||
Pointfs get_exclude_area() { return m_exclude_areas; }
|
||||
|
|
Loading…
Reference in New Issue