NEW: add spiral vase mode in plate config Jira: STUDIO-4127
Change-Id: I3bbcc1a165123ff81129e159ada1e00f23e38c68
This commit is contained in:
parent
c8cf950155
commit
b6995d8fb3
|
@ -271,6 +271,7 @@ static constexpr const char* LOCK_ATTR = "locked";
|
||||||
static constexpr const char* BED_TYPE_ATTR = "bed_type";
|
static constexpr const char* BED_TYPE_ATTR = "bed_type";
|
||||||
static constexpr const char* PRINT_SEQUENCE_ATTR = "print_sequence";
|
static constexpr const char* PRINT_SEQUENCE_ATTR = "print_sequence";
|
||||||
static constexpr const char* FIRST_LAYER_PRINT_SEQUENCE_ATTR = "first_layer_print_sequence";
|
static constexpr const char* FIRST_LAYER_PRINT_SEQUENCE_ATTR = "first_layer_print_sequence";
|
||||||
|
static constexpr const char* SPIRAL_VASE_MODE = "spiral_mode";
|
||||||
static constexpr const char* GCODE_FILE_ATTR = "gcode_file";
|
static constexpr const char* GCODE_FILE_ATTR = "gcode_file";
|
||||||
static constexpr const char* THUMBNAIL_FILE_ATTR = "thumbnail_file";
|
static constexpr const char* THUMBNAIL_FILE_ATTR = "thumbnail_file";
|
||||||
static constexpr const char* TOP_FILE_ATTR = "top_file";
|
static constexpr const char* TOP_FILE_ATTR = "top_file";
|
||||||
|
@ -3876,6 +3877,11 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
||||||
};
|
};
|
||||||
m_curr_plater->config.set_key_value("first_layer_print_sequence", new ConfigOptionInts(get_vector_from_string(value)));
|
m_curr_plater->config.set_key_value("first_layer_print_sequence", new ConfigOptionInts(get_vector_from_string(value)));
|
||||||
}
|
}
|
||||||
|
else if (key == SPIRAL_VASE_MODE) {
|
||||||
|
bool spiral_mode = false;
|
||||||
|
std::istringstream(value) >> std::boolalpha >> spiral_mode;
|
||||||
|
m_curr_plater->config.set_key_value("spiral_mode", new ConfigOptionBool(spiral_mode));
|
||||||
|
}
|
||||||
else if (key == GCODE_FILE_ATTR)
|
else if (key == GCODE_FILE_ATTR)
|
||||||
{
|
{
|
||||||
m_curr_plater->gcode_file = value;
|
m_curr_plater->gcode_file = value;
|
||||||
|
@ -7089,6 +7095,10 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
|
||||||
stream << "\"/>\n";
|
stream << "\"/>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConfigOption* spiral_mode_opt = plate_data->config.option("spiral_mode");
|
||||||
|
if (spiral_mode_opt)
|
||||||
|
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << SPIRAL_VASE_MODE << "\" " << VALUE_ATTR << "=\"" << spiral_mode_opt->getBool() << "\"/>\n";
|
||||||
|
|
||||||
if (save_gcode)
|
if (save_gcode)
|
||||||
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << GCODE_FILE_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha << xml_escape(plate_data->gcode_file) << "\"/>\n";
|
stream << " <" << METADATA_TAG << " " << KEY_ATTR << "=\"" << GCODE_FILE_ATTR << "\" " << VALUE_ATTR << "=\"" << std::boolalpha << xml_escape(plate_data->gcode_file) << "\"/>\n";
|
||||||
if (!plate_data->gcode_file.empty()) {
|
if (!plate_data->gcode_file.empty()) {
|
||||||
|
|
|
@ -252,6 +252,35 @@ PrintSequence PartPlate::get_real_print_seq() const
|
||||||
return curr_plate_seq;
|
return curr_plate_seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PartPlate::has_spiral_mode_config() const
|
||||||
|
{
|
||||||
|
std::string key = "spiral_mode";
|
||||||
|
return m_config.has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PartPlate::get_spiral_vase_mode() const
|
||||||
|
{
|
||||||
|
std::string key = "spiral_mode";
|
||||||
|
if (m_config.has(key)) {
|
||||||
|
return m_config.opt_bool(key);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DynamicPrintConfig* global_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
|
if (global_config->has(key))
|
||||||
|
return global_config->opt_bool(key);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PartPlate::set_spiral_vase_mode(bool spiral_mode, bool as_global)
|
||||||
|
{
|
||||||
|
std::string key = "spiral_mode";
|
||||||
|
if (as_global)
|
||||||
|
m_config.erase(key);
|
||||||
|
else
|
||||||
|
m_config.set_key_value(key, new ConfigOptionBool(spiral_mode));
|
||||||
|
}
|
||||||
|
|
||||||
bool PartPlate::valid_instance(int obj_id, int instance_id)
|
bool PartPlate::valid_instance(int obj_id, int instance_id)
|
||||||
{
|
{
|
||||||
if ((obj_id >= 0) && (obj_id < m_model->objects.size()))
|
if ((obj_id >= 0) && (obj_id < m_model->objects.size()))
|
||||||
|
@ -937,14 +966,15 @@ void PartPlate::render_icons(bool bottom, bool only_body, int hover_id)
|
||||||
render_icon_texture(position_id, tex_coords_id, m_plate_name_edit_icon, m_partplate_list->m_plate_name_edit_texture, m_plate_name_edit_vbo_id);
|
render_icon_texture(position_id, tex_coords_id, m_plate_name_edit_icon, m_partplate_list->m_plate_name_edit_texture, m_plate_name_edit_vbo_id);
|
||||||
|
|
||||||
if (m_partplate_list->render_plate_settings) {
|
if (m_partplate_list->render_plate_settings) {
|
||||||
|
bool has_plate_settings = get_bed_type() != BedType::btDefault || get_print_seq() != PrintSequence::ByDefault || !get_first_layer_print_sequence().empty() || has_spiral_mode_config();
|
||||||
if (hover_id == 5) {
|
if (hover_id == 5) {
|
||||||
if (get_bed_type() == BedType::btDefault && get_print_seq() == PrintSequence::ByDefault && get_first_layer_print_sequence().empty())
|
if (!has_plate_settings)
|
||||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_hovered_texture, m_plate_settings_vbo_id);
|
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_hovered_texture, m_plate_settings_vbo_id);
|
||||||
else
|
else
|
||||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_hovered_texture,
|
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_hovered_texture,
|
||||||
m_plate_settings_vbo_id);
|
m_plate_settings_vbo_id);
|
||||||
} else {
|
} else {
|
||||||
if (get_bed_type() == BedType::btDefault && get_print_seq() == PrintSequence::ByDefault && get_first_layer_print_sequence().empty())
|
if (!has_plate_settings)
|
||||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_texture, m_plate_settings_vbo_id);
|
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_texture, m_plate_settings_vbo_id);
|
||||||
else
|
else
|
||||||
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_texture, m_plate_settings_vbo_id);
|
render_icon_texture(position_id, tex_coords_id, m_plate_settings_icon, m_partplate_list->m_plate_settings_changed_texture, m_plate_settings_vbo_id);
|
||||||
|
|
|
@ -237,6 +237,9 @@ public:
|
||||||
// @return PrintSequence::{ByLayer,ByObject}
|
// @return PrintSequence::{ByLayer,ByObject}
|
||||||
PrintSequence get_real_print_seq() const;
|
PrintSequence get_real_print_seq() const;
|
||||||
|
|
||||||
|
bool has_spiral_mode_config() const;
|
||||||
|
bool get_spiral_vase_mode() const;
|
||||||
|
void set_spiral_vase_mode(bool spiral_mode, bool as_global);
|
||||||
|
|
||||||
//static const int plate_x_offset = 20; //mm
|
//static const int plate_x_offset = 20; //mm
|
||||||
//static const double plate_x_gap = 0.2;
|
//static const double plate_x_gap = 0.2;
|
||||||
|
|
|
@ -71,9 +71,20 @@ PlateSettingsDialog::PlateSettingsDialog(wxWindow* parent, wxWindowID id, const
|
||||||
}
|
}
|
||||||
m_drag_canvas = new DragCanvas(this, extruder_colours, order);
|
m_drag_canvas = new DragCanvas(this, extruder_colours, order);
|
||||||
m_drag_canvas->Hide();
|
m_drag_canvas->Hide();
|
||||||
top_sizer->Add(0, 0, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
top_sizer->Add(0, 0, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(0));
|
||||||
top_sizer->Add(m_drag_canvas, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
top_sizer->Add(m_drag_canvas, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
||||||
|
|
||||||
|
m_spiral_mode_choice = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(240), -1), 0, NULL, wxCB_READONLY);
|
||||||
|
m_spiral_mode_choice->Append(_L("Same as Global"));
|
||||||
|
m_spiral_mode_choice->Append(_L("Enable"));
|
||||||
|
m_spiral_mode_choice->Append(_L("Disable"));
|
||||||
|
m_spiral_mode_choice->SetSelection(0);
|
||||||
|
wxStaticText* spiral_mode_txt = new wxStaticText(this, wxID_ANY, _L("Spiral Vase"));
|
||||||
|
spiral_mode_txt->SetFont(Label::Body_14);
|
||||||
|
top_sizer->Add(spiral_mode_txt, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT | wxALL, FromDIP(5));
|
||||||
|
top_sizer->Add(m_spiral_mode_choice, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, FromDIP(5));
|
||||||
|
|
||||||
|
|
||||||
m_sizer_main->Add(top_sizer, 0, wxEXPAND | wxALL, FromDIP(30));
|
m_sizer_main->Add(top_sizer, 0, wxEXPAND | wxALL, FromDIP(30));
|
||||||
|
|
||||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -166,6 +177,21 @@ void PlateSettingsDialog::sync_first_layer_print_seq(int selection, const std::v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlateSettingsDialog::sync_spiral_mode(bool spiral_mode, bool as_global)
|
||||||
|
{
|
||||||
|
if (m_spiral_mode_choice) {
|
||||||
|
if (as_global) {
|
||||||
|
m_spiral_mode_choice->SetSelection(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (spiral_mode)
|
||||||
|
m_spiral_mode_choice->SetSelection(1);
|
||||||
|
else
|
||||||
|
m_spiral_mode_choice->SetSelection(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxString PlateSettingsDialog::to_bed_type_name(BedType bed_type) {
|
wxString PlateSettingsDialog::to_bed_type_name(BedType bed_type) {
|
||||||
switch (bed_type) {
|
switch (bed_type) {
|
||||||
case btDefault:
|
case btDefault:
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
void sync_bed_type(BedType type);
|
void sync_bed_type(BedType type);
|
||||||
void sync_print_seq(int print_seq = 0);
|
void sync_print_seq(int print_seq = 0);
|
||||||
void sync_first_layer_print_seq(int selection, const std::vector<int>& seq = std::vector<int>());
|
void sync_first_layer_print_seq(int selection, const std::vector<int>& seq = std::vector<int>());
|
||||||
|
void sync_spiral_mode(bool spiral_mode, bool as_global);
|
||||||
wxString to_bed_type_name(BedType bed_type);
|
wxString to_bed_type_name(BedType bed_type);
|
||||||
wxString to_print_sequence_name(PrintSequence print_seq);
|
wxString to_print_sequence_name(PrintSequence print_seq);
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||||
|
@ -60,11 +61,23 @@ public:
|
||||||
|
|
||||||
std::vector<int> get_first_layer_print_seq();
|
std::vector<int> get_first_layer_print_seq();
|
||||||
|
|
||||||
|
int get_spiral_mode_choice() {
|
||||||
|
int choice = 0;
|
||||||
|
if (m_spiral_mode_choice != nullptr)
|
||||||
|
choice = m_spiral_mode_choice->GetSelection();
|
||||||
|
return choice;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool get_spiral_mode(){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DragCanvas* m_drag_canvas;
|
|
||||||
ComboBox* m_first_layer_print_seq_choice { nullptr };
|
|
||||||
ComboBox* m_print_seq_choice { nullptr };
|
|
||||||
ComboBox* m_bed_type_choice { nullptr };
|
ComboBox* m_bed_type_choice { nullptr };
|
||||||
|
ComboBox* m_print_seq_choice { nullptr };
|
||||||
|
ComboBox* m_first_layer_print_seq_choice { nullptr };
|
||||||
|
ComboBox* m_spiral_mode_choice { nullptr };
|
||||||
|
DragCanvas* m_drag_canvas;
|
||||||
Button* m_button_ok;
|
Button* m_button_ok;
|
||||||
Button* m_button_cancel;
|
Button* m_button_cancel;
|
||||||
};
|
};
|
||||||
|
|
|
@ -12327,6 +12327,8 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
|
||||||
else
|
else
|
||||||
dlg.sync_first_layer_print_seq(1, curr_plate->get_first_layer_print_sequence());
|
dlg.sync_first_layer_print_seq(1, curr_plate->get_first_layer_print_sequence());
|
||||||
|
|
||||||
|
dlg.sync_spiral_mode(curr_plate->get_spiral_vase_mode(), !curr_plate->has_spiral_mode_config());
|
||||||
|
|
||||||
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
|
dlg.Bind(EVT_SET_BED_TYPE_CONFIRM, [this, plate_index, &dlg](wxCommandEvent& e) {
|
||||||
PartPlate *curr_plate = p->partplate_list.get_curr_plate();
|
PartPlate *curr_plate = p->partplate_list.get_curr_plate();
|
||||||
BedType old_bed_type = curr_plate->get_bed_type();
|
BedType old_bed_type = curr_plate->get_bed_type();
|
||||||
|
@ -12348,6 +12350,16 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
|
||||||
curr_plate->set_print_seq(PrintSequence(ps_sel - 1));
|
curr_plate->set_print_seq(PrintSequence(ps_sel - 1));
|
||||||
else
|
else
|
||||||
curr_plate->set_print_seq(PrintSequence::ByDefault);
|
curr_plate->set_print_seq(PrintSequence::ByDefault);
|
||||||
|
|
||||||
|
int spiral_sel = dlg.get_spiral_mode_choice();
|
||||||
|
if (spiral_sel == 1) {
|
||||||
|
curr_plate->set_spiral_vase_mode(true, false);
|
||||||
|
}else if (spiral_sel == 2) {
|
||||||
|
curr_plate->set_spiral_vase_mode(false, false);
|
||||||
|
}else {
|
||||||
|
curr_plate->set_spiral_vase_mode(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
update_project_dirty_from_presets();
|
update_project_dirty_from_presets();
|
||||||
set_plater_dirty(true);
|
set_plater_dirty(true);
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select print sequence %1% for plate %2% at plate side")%ps_sel %plate_index;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("select print sequence %1% for plate %2% at plate side")%ps_sel %plate_index;
|
||||||
|
|
Loading…
Reference in New Issue