mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-19 06:41:14 -06:00
NEW: add align_to_y_axis option for auto-arrange
1. Add align_to_y_axis option for auto-arrange. This is useful for auto-arranging of i3 type printers. 2. Change default value of align_to_origin to true when switching from non-i3 printers to i3 printers. JIRA: STUDIO-2583 Change-Id: I7dabab846022a0da030a9fec060a60a4207537a0
This commit is contained in:
parent
e789489ed9
commit
7beed5d6dd
8 changed files with 142 additions and 6 deletions
|
@ -5352,6 +5352,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
|
|||
std::string bed_shrink_x_key = "bed_shrink_x", bed_shrink_y_key = "bed_shrink_y";
|
||||
std::string multi_material_key = "allow_multi_materials_on_same_plate";
|
||||
std::string avoid_extrusion_key = "avoid_extrusion_cali_region";
|
||||
std::string align_to_y_axis_key = "align_to_y_axis";
|
||||
std::string postfix;
|
||||
//BBS:
|
||||
bool seq_print = false;
|
||||
|
@ -5418,6 +5419,22 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
|
|||
settings_out.avoid_extrusion_cali_region = false;
|
||||
}
|
||||
|
||||
// Align to Y axis. Only enable this option when auto rotation not enabled
|
||||
{
|
||||
if (settings_out.enable_rotation) { // do not allow align to Y axis if rotation is enabled
|
||||
imgui->disabled_begin(true);
|
||||
settings_out.align_to_y_axis = false;
|
||||
}
|
||||
|
||||
if (imgui->bbl_checkbox(_L("Align to Y axis"), settings.align_to_y_axis)) {
|
||||
settings_out.align_to_y_axis = settings.align_to_y_axis;
|
||||
appcfg->set("arrange", align_to_y_axis_key, settings_out.align_to_y_axis ? "1" : "0");
|
||||
settings_changed = true;
|
||||
}
|
||||
|
||||
if (settings_out.enable_rotation == true) { imgui->disabled_end(); }
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(15.0f, 10.0f));
|
||||
if (imgui->button(_L("Arrange"))) {
|
||||
|
@ -5432,8 +5449,16 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
|
|||
settings_out.distance = std::max(dist_min, settings_out.distance);
|
||||
//BBS: add specific arrange settings
|
||||
if (seq_print) settings_out.is_seq_print = true;
|
||||
appcfg->set("arrange", dist_key.c_str(), float_to_string_decimal_point(settings_out.distance));
|
||||
appcfg->set("arrange", rot_key.c_str(), settings_out.enable_rotation? "1" : "0");
|
||||
|
||||
if (auto printer_structure_opt = wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure")) {
|
||||
settings_out.align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||
}
|
||||
else
|
||||
settings_out.align_to_y_axis = false;
|
||||
|
||||
appcfg->set("arrange", dist_key, float_to_string_decimal_point(settings_out.distance));
|
||||
appcfg->set("arrange", rot_key, settings_out.enable_rotation ? "1" : "0");
|
||||
appcfg->set("arrange", align_to_y_axis_key, settings_out.align_to_y_axis ? "1" : "0");
|
||||
settings_changed = true;
|
||||
}
|
||||
ImGui::PopStyleVar(1);
|
||||
|
|
|
@ -483,6 +483,7 @@ public:
|
|||
bool is_seq_print = false;
|
||||
float bed_shrink_x = 0.f;
|
||||
float bed_shrink_y = 0.f;
|
||||
bool align_to_y_axis = false;
|
||||
};
|
||||
|
||||
struct OrientSettings
|
||||
|
@ -626,7 +627,6 @@ private:
|
|||
return *ptr;
|
||||
}
|
||||
|
||||
ArrangeSettings &get_arrange_settings() { return get_arrange_settings(this); }
|
||||
|
||||
|
||||
//BBS:record key botton frequency
|
||||
|
@ -652,6 +652,7 @@ public:
|
|||
}
|
||||
|
||||
void load_arrange_settings();
|
||||
ArrangeSettings& get_arrange_settings() { return get_arrange_settings(this); }
|
||||
|
||||
class SequentialPrintClearance
|
||||
{
|
||||
|
|
|
@ -509,6 +509,7 @@ void ArrangeJob::process()
|
|||
update_arrange_params(params, *m_plater, m_selected);
|
||||
update_selected_items_inflation(m_selected, m_plater->config(), params);
|
||||
update_unselected_items_inflation(m_unselected, m_plater->config(), params);
|
||||
update_selected_items_axis_align(m_selected, m_plater->config(), params);
|
||||
|
||||
Points bedpts = get_shrink_bedpts(m_plater->config(),params);
|
||||
double scaled_exclusion_gap = scale_(1);
|
||||
|
@ -753,6 +754,7 @@ arrangement::ArrangeParams init_arrange_params(Plater *p)
|
|||
params.min_obj_distance = scaled(settings.distance);
|
||||
params.bed_shrink_x = settings.bed_shrink_x;
|
||||
params.bed_shrink_y = settings.bed_shrink_y;
|
||||
params.align_to_y_axis = settings.align_to_y_axis;
|
||||
|
||||
int state = p->get_prepare_state();
|
||||
if (state == Job::JobPrepareState::PREPARE_STATE_MENU) {
|
||||
|
|
|
@ -82,7 +82,6 @@ arrangement::ArrangeParams init_arrange_params(Plater *p);
|
|||
|
||||
void update_arrange_params(arrangement::ArrangeParams ¶ms, const Plater &p, const arrangement::ArrangePolygons &selected);
|
||||
|
||||
|
||||
}} // namespace Slic3r::GUI
|
||||
|
||||
#endif // ARRANGEJOB_HPP
|
||||
|
|
|
@ -1154,8 +1154,17 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
|||
printer_tab->update();
|
||||
}
|
||||
|
||||
bool isBBL = wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle);
|
||||
Preset& printer_preset = wxGetApp().preset_bundle->printers.get_edited_preset();
|
||||
|
||||
bool isBBL = printer_preset.is_bbl_vendor_preset(wxGetApp().preset_bundle);
|
||||
wxGetApp().mainframe->show_calibration_button(!isBBL);
|
||||
|
||||
if (auto printer_structure_opt = printer_preset.config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure")) {
|
||||
wxGetApp().plater()->get_current_canvas3D()->get_arrange_settings().align_to_y_axis = (printer_structure_opt->value == PrinterStructure::psI3);
|
||||
}
|
||||
else
|
||||
wxGetApp().plater()->get_current_canvas3D()->get_arrange_settings().align_to_y_axis = false;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue