mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
ENH:calibration
1.adjust interaction of calibration add select my device add select multi-amstray modify ams selector 2.add some x1c calibration command Change-Id: I403446cc0cd3ae5e1dec5d2dc97920ff334522da
This commit is contained in:
parent
032bf107b8
commit
d53bd3394a
25 changed files with 3001 additions and 1122 deletions
|
@ -2705,7 +2705,7 @@ GCode::LayerResult GCode::process_layer(
|
||||||
|
|
||||||
if (print.calib_mode() == CalibMode::Calib_Temp_Tower) {
|
if (print.calib_mode() == CalibMode::Calib_Temp_Tower) {
|
||||||
auto offset = static_cast<unsigned int>(print_z / 10.001) * 5;
|
auto offset = static_cast<unsigned int>(print_z / 10.001) * 5;
|
||||||
gcode += writer().set_temperature(print.calib_params().start - offset);
|
gcode += writer().set_temperature(print.calib_params().end - offset);
|
||||||
}
|
}
|
||||||
else if (print.calib_mode() == CalibMode::Calib_Vol_speed_Tower) {
|
else if (print.calib_mode() == CalibMode::Calib_Vol_speed_Tower) {
|
||||||
auto _speed = print.calib_params().start + print_z * print.calib_params().step;
|
auto _speed = print.calib_params().start + print_z * print.calib_params().step;
|
||||||
|
@ -3694,7 +3694,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate extrusion length per distance unit
|
// calculate extrusion length per distance unit
|
||||||
auto _mm3_per_mm = path.mm3_per_mm * (m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio : 1);
|
auto _mm3_per_mm = path.mm3_per_mm * double(m_curr_print->calib_mode() == CalibMode::Calib_Flow_Rate ? this->config().print_flow_ratio.value : 1);
|
||||||
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
|
double e_per_mm = m_writer.extruder()->e_per_mm3() * _mm3_per_mm;
|
||||||
|
|
||||||
double min_speed = double(m_config.slow_down_min_speed.get_at(m_writer.extruder()->id()));
|
double min_speed = double(m_config.slow_down_min_speed.get_at(m_writer.extruder()->id()));
|
||||||
|
|
|
@ -1939,8 +1939,9 @@ Preset& PresetCollection::load_preset(const std::string &path, const std::string
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: add project embedded preset logic
|
//BBS: add project embedded preset logic
|
||||||
void PresetCollection::save_current_preset(const std::string &new_name, bool detach, bool save_to_project)
|
void PresetCollection::save_current_preset(const std::string &new_name, bool detach, bool save_to_project, Preset* _curr_preset)
|
||||||
{
|
{
|
||||||
|
Preset curr_preset = _curr_preset ? *_curr_preset : m_edited_preset;
|
||||||
//BBS: add lock logic for sync preset in background
|
//BBS: add lock logic for sync preset in background
|
||||||
std::string final_inherits;
|
std::string final_inherits;
|
||||||
lock();
|
lock();
|
||||||
|
@ -1959,7 +1960,7 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Overwriting an existing preset.
|
// Overwriting an existing preset.
|
||||||
preset.config = std::move(m_edited_preset.config);
|
preset.config = std::move(curr_preset.config);
|
||||||
// The newly saved preset will be activated -> make it visible.
|
// The newly saved preset will be activated -> make it visible.
|
||||||
preset.is_visible = true;
|
preset.is_visible = true;
|
||||||
//TODO: remove the detach logic
|
//TODO: remove the detach logic
|
||||||
|
@ -1976,7 +1977,7 @@ void PresetCollection::save_current_preset(const std::string &new_name, bool det
|
||||||
unlock();
|
unlock();
|
||||||
} else {
|
} else {
|
||||||
// Creating a new preset.
|
// Creating a new preset.
|
||||||
Preset &preset = *m_presets.insert(it, m_edited_preset);
|
Preset &preset = *m_presets.insert(it, curr_preset);
|
||||||
std::string &inherits = preset.inherits();
|
std::string &inherits = preset.inherits();
|
||||||
std::string old_name = preset.name;
|
std::string old_name = preset.name;
|
||||||
preset.name = new_name;
|
preset.name = new_name;
|
||||||
|
|
|
@ -474,7 +474,7 @@ public:
|
||||||
// a new preset is stored into the list of presets.
|
// a new preset is stored into the list of presets.
|
||||||
// All presets are marked as not modified and the new preset is activated.
|
// All presets are marked as not modified and the new preset is activated.
|
||||||
//BBS: add project embedded preset logic
|
//BBS: add project embedded preset logic
|
||||||
void save_current_preset(const std::string &new_name, bool detach = false, bool save_to_project = false);
|
void save_current_preset(const std::string &new_name, bool detach = false, bool save_to_project = false, Preset* _curr_preset = nullptr);
|
||||||
|
|
||||||
// Delete the current preset, activate the first visible preset.
|
// Delete the current preset, activate the first visible preset.
|
||||||
// returns true if the preset was deleted successfully.
|
// returns true if the preset was deleted successfully.
|
||||||
|
|
|
@ -255,6 +255,8 @@ PresetsConfigSubstitutions PresetBundle::load_presets(AppConfig &config, Forward
|
||||||
|
|
||||||
this->load_selections(config, preferred_selection);
|
this->load_selections(config, preferred_selection);
|
||||||
|
|
||||||
|
set_calibrate_printer("");
|
||||||
|
|
||||||
//BBS: add config related logs
|
//BBS: add config related logs
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" finished, returned substitutions %1%")%substitutions.size();
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" finished, returned substitutions %1%")%substitutions.size();
|
||||||
return substitutions;
|
return substitutions;
|
||||||
|
@ -539,6 +541,9 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(std::string user, For
|
||||||
if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative);
|
if (!errors_cummulative.empty()) throw Slic3r::RuntimeError(errors_cummulative);
|
||||||
this->update_multi_material_filament_presets();
|
this->update_multi_material_filament_presets();
|
||||||
this->update_compatible(PresetSelectCompatibleType::Never);
|
this->update_compatible(PresetSelectCompatibleType::Never);
|
||||||
|
|
||||||
|
set_calibrate_printer("");
|
||||||
|
|
||||||
return PresetsConfigSubstitutions();
|
return PresetsConfigSubstitutions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,6 +611,8 @@ PresetsConfigSubstitutions PresetBundle::load_user_presets(AppConfig &
|
||||||
this->update_compatible(PresetSelectCompatibleType::Never);
|
this->update_compatible(PresetSelectCompatibleType::Never);
|
||||||
//this->load_selections(config, PresetPreferences());
|
//this->load_selections(config, PresetPreferences());
|
||||||
|
|
||||||
|
set_calibrate_printer("");
|
||||||
|
|
||||||
if (! errors_cummulative.empty())
|
if (! errors_cummulative.empty())
|
||||||
throw Slic3r::RuntimeError(errors_cummulative);
|
throw Slic3r::RuntimeError(errors_cummulative);
|
||||||
|
|
||||||
|
@ -1441,7 +1448,8 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns)
|
||||||
{
|
{
|
||||||
std::vector<std::string> filament_presets;
|
std::vector<std::string> filament_presets;
|
||||||
std::vector<std::string> filament_colors;
|
std::vector<std::string> filament_colors;
|
||||||
for (auto &ams : filament_ams_list) {
|
for (auto &entry : filament_ams_list) {
|
||||||
|
auto & ams = entry.second;
|
||||||
auto filament_id = ams.opt_string("filament_id", 0u);
|
auto filament_id = ams.opt_string("filament_id", 0u);
|
||||||
auto filament_color = ams.opt_string("filament_colour", 0u);
|
auto filament_color = ams.opt_string("filament_colour", 0u);
|
||||||
auto filament_changed = !ams.has("filament_changed") || ams.opt_bool("filament_changed");
|
auto filament_changed = !ams.has("filament_changed") || ams.opt_bool("filament_changed");
|
||||||
|
@ -1478,6 +1486,29 @@ unsigned int PresetBundle::sync_ams_list(unsigned int &unknowns)
|
||||||
return filament_presets.size();
|
return filament_presets.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PresetBundle::set_calibrate_printer(std::string name)
|
||||||
|
{
|
||||||
|
if (name.empty()) {
|
||||||
|
calibrate_filaments.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!name.empty())
|
||||||
|
calibrate_printer = printers.find_preset(name);
|
||||||
|
const Preset & printer_preset = calibrate_printer ? *calibrate_printer : printers.get_edited_preset();
|
||||||
|
const PresetWithVendorProfile active_printer = printers.get_preset_with_vendor_profile(printer_preset);
|
||||||
|
DynamicPrintConfig config;
|
||||||
|
config.set_key_value("printer_preset", new ConfigOptionString(active_printer.preset.name));
|
||||||
|
const ConfigOption *opt = active_printer.preset.config.option("nozzle_diameter");
|
||||||
|
if (opt) config.set_key_value("num_extruders", new ConfigOptionInt((int) static_cast<const ConfigOptionFloats *>(opt)->values.size()));
|
||||||
|
calibrate_filaments.clear();
|
||||||
|
for (size_t i = filaments.num_default_presets(); i < filaments.size(); ++i) {
|
||||||
|
const Preset & preset = filaments.m_presets[i];
|
||||||
|
const PresetWithVendorProfile this_preset_with_vendor_profile = filaments.get_preset_with_vendor_profile(preset);
|
||||||
|
bool is_compatible = is_compatible_with_printer(this_preset_with_vendor_profile, active_printer, &config);
|
||||||
|
if (is_compatible) calibrate_filaments.insert(&preset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//BBS: check whether this is the only edited filament
|
//BBS: check whether this is the only edited filament
|
||||||
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
|
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,8 @@ public:
|
||||||
//BBS: check whether this is the only edited filament
|
//BBS: check whether this is the only edited filament
|
||||||
bool is_the_only_edited_filament(unsigned int filament_index);
|
bool is_the_only_edited_filament(unsigned int filament_index);
|
||||||
|
|
||||||
|
void set_calibrate_printer(std::string name);
|
||||||
|
|
||||||
PresetCollection prints;
|
PresetCollection prints;
|
||||||
PresetCollection sla_prints;
|
PresetCollection sla_prints;
|
||||||
PresetCollection filaments;
|
PresetCollection filaments;
|
||||||
|
@ -98,7 +100,10 @@ public:
|
||||||
// extruders.size() should be the same as printers.get_edited_preset().config.nozzle_diameter.size()
|
// extruders.size() should be the same as printers.get_edited_preset().config.nozzle_diameter.size()
|
||||||
std::vector<std::string> filament_presets;
|
std::vector<std::string> filament_presets;
|
||||||
// BBS: ams
|
// BBS: ams
|
||||||
std::vector<DynamicPrintConfig> filament_ams_list;
|
std::map<int, DynamicPrintConfig> filament_ams_list;
|
||||||
|
// Calibrate
|
||||||
|
Preset const * calibrate_printer = nullptr;
|
||||||
|
std::set<Preset const *> calibrate_filaments;
|
||||||
|
|
||||||
// The project configuration values are kept separated from the print/filament/printer preset,
|
// The project configuration values are kept separated from the print/filament/printer preset,
|
||||||
// they are being serialized / deserialized from / to the .amf, .3mf, .config, .gcode,
|
// they are being serialized / deserialized from / to the .amf, .3mf, .config, .gcode,
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
#define REFRESH_INTERVAL 1000
|
||||||
CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: wxPanel(parent, id, pos, size, style)
|
: wxPanel(parent, id, pos, size, style)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(*wxWHITE);
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
//init_bitmaps();
|
|
||||||
init_tabpanel();
|
init_tabpanel();
|
||||||
|
|
||||||
wxBoxSizer* sizer_main = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||||
|
@ -15,6 +15,9 @@ CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoin
|
||||||
|
|
||||||
SetSizerAndFit(sizer_main);
|
SetSizerAndFit(sizer_main);
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
|
init_timer();
|
||||||
|
Bind(wxEVT_TIMER, &CalibrationPanel::on_timer, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationPanel::init_tabpanel() {
|
void CalibrationPanel::init_tabpanel() {
|
||||||
|
@ -25,8 +28,8 @@ void CalibrationPanel::init_tabpanel() {
|
||||||
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||||
m_tabpanel->SetBackgroundColour(*wxWHITE);
|
m_tabpanel->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
//m_pa_panel = new CalibrationWizard(m_tabpanel);
|
m_pa_panel = new PressureAdvanceWizard(m_tabpanel);
|
||||||
//m_tabpanel->AddPage(m_pa_panel, _L("Pressure Adavance"), "", true);
|
m_tabpanel->AddPage(m_pa_panel, _L("Pressure Adavance"), "", true);
|
||||||
|
|
||||||
m_flow_panel = new FlowRateWizard(m_tabpanel);
|
m_flow_panel = new FlowRateWizard(m_tabpanel);
|
||||||
m_tabpanel->AddPage(m_flow_panel, _L("Flow Rate"), "", false);
|
m_tabpanel->AddPage(m_flow_panel, _L("Flow Rate"), "", false);
|
||||||
|
@ -35,39 +38,38 @@ void CalibrationPanel::init_tabpanel() {
|
||||||
m_tabpanel->AddPage(m_volumetric_panel, _L("Max Volumetric Speed"), "", false);
|
m_tabpanel->AddPage(m_volumetric_panel, _L("Max Volumetric Speed"), "", false);
|
||||||
|
|
||||||
m_temp_panel = new TemperatureWizard(m_tabpanel);
|
m_temp_panel = new TemperatureWizard(m_tabpanel);
|
||||||
m_tabpanel->AddPage(m_temp_panel, _L("Temperature"), "", true);
|
m_tabpanel->AddPage(m_temp_panel, _L("Temperature"), "", false);
|
||||||
|
|
||||||
//m_vfa_panel = new CalibrationWizard(m_tabpanel);
|
|
||||||
//m_tabpanel->AddPage(m_vfa_panel, _L("VFA"), "", false);
|
|
||||||
|
|
||||||
//m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
|
|
||||||
// CalibrationWizard* page = static_cast<CalibrationWizard*>(m_tabpanel->GetCurrentPage());
|
|
||||||
// if (page->get_frist_page()) {
|
|
||||||
// page->update_comboboxes();
|
|
||||||
// }
|
|
||||||
// }, m_tabpanel->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationPanel::update_obj(MachineObject* obj) {
|
void CalibrationPanel::init_timer()
|
||||||
if (obj) {
|
{
|
||||||
if (m_pa_panel)
|
m_refresh_timer = new wxTimer();
|
||||||
m_pa_panel->update_obj(obj);
|
m_refresh_timer->SetOwner(this);
|
||||||
|
m_refresh_timer->Start(REFRESH_INTERVAL);
|
||||||
|
wxPostEvent(this, wxTimerEvent());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationPanel::on_timer(wxTimerEvent& event) {
|
||||||
|
// todo only update at CalibrationPanel
|
||||||
|
update_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationPanel::update_all() {
|
||||||
|
if (m_pa_panel) {
|
||||||
|
m_pa_panel->update_printer_selections();
|
||||||
|
m_pa_panel->update_print_progress();
|
||||||
|
}
|
||||||
if (m_flow_panel) {
|
if (m_flow_panel) {
|
||||||
m_flow_panel->update_obj(obj);
|
m_flow_panel->update_printer_selections();
|
||||||
m_flow_panel->update_ams(obj);
|
m_flow_panel->update_print_progress();
|
||||||
}
|
}
|
||||||
if (m_volumetric_panel) {
|
if (m_volumetric_panel) {
|
||||||
m_volumetric_panel->update_obj(obj);
|
m_volumetric_panel->update_printer_selections();
|
||||||
m_volumetric_panel->update_ams(obj);
|
m_volumetric_panel->update_print_progress();
|
||||||
}
|
}
|
||||||
if (m_temp_panel) {
|
if (m_temp_panel) {
|
||||||
m_temp_panel->update_obj(obj);
|
m_temp_panel->update_printer_selections();
|
||||||
m_temp_panel->update_ams(obj);
|
m_temp_panel->update_print_progress();
|
||||||
m_temp_panel->update_progress();
|
|
||||||
}
|
|
||||||
if (m_vfa_panel) {
|
|
||||||
m_vfa_panel->update_obj(obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,14 +12,12 @@ public:
|
||||||
CalibrationPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
CalibrationPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~CalibrationPanel() {};
|
~CalibrationPanel() {};
|
||||||
Tabbook* get_tabpanel() { return m_tabpanel; };
|
Tabbook* get_tabpanel() { return m_tabpanel; };
|
||||||
void update_obj(MachineObject* obj);
|
void update_all();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init_bitmaps();
|
|
||||||
void init_tabpanel();
|
void init_tabpanel();
|
||||||
|
void init_timer();
|
||||||
//void show_wizard();
|
void on_timer(wxTimerEvent& event);
|
||||||
//CalibrationWizard* get_current_wizard();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Tabbook* m_tabpanel{ nullptr };
|
Tabbook* m_tabpanel{ nullptr };
|
||||||
|
@ -30,6 +28,8 @@ private:
|
||||||
CalibrationWizard* m_volumetric_panel{ nullptr };
|
CalibrationWizard* m_volumetric_panel{ nullptr };
|
||||||
TemperatureWizard* m_temp_panel{ nullptr };
|
TemperatureWizard* m_temp_panel{ nullptr };
|
||||||
CalibrationWizard* m_vfa_panel{ nullptr };
|
CalibrationWizard* m_vfa_panel{ nullptr };
|
||||||
|
|
||||||
|
wxTimer* m_refresh_timer = nullptr;
|
||||||
};
|
};
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,57 @@
|
||||||
#ifndef slic3r_GUI_CalibrationWizard_hpp_
|
#ifndef slic3r_GUI_CalibrationWizard_hpp_
|
||||||
#define slic3r_GUI_CalibrationWizard_hpp_
|
#define slic3r_GUI_CalibrationWizard_hpp_
|
||||||
|
|
||||||
#include "GUI_Utils.hpp"
|
|
||||||
#include "DeviceManager.hpp"
|
#include "DeviceManager.hpp"
|
||||||
#include "CalibrationWizardPage.hpp"
|
#include "CalibrationWizardPage.hpp"
|
||||||
#include "Widgets/ComboBox.hpp"
|
#include "Widgets/ComboBox.hpp"
|
||||||
#include "Widgets/TextInput.hpp"
|
#include "Widgets/TextInput.hpp"
|
||||||
#include "Widgets/AMSControl.hpp"
|
#include "Widgets/AMSControl.hpp"
|
||||||
|
#include "AMSMaterialsSetting.hpp"
|
||||||
|
#include "Widgets/ProgressBar.hpp"
|
||||||
#include "SavePresetDialog.hpp"
|
#include "SavePresetDialog.hpp"
|
||||||
|
#include "PresetComboBoxes.hpp"
|
||||||
#include "../slic3r/Utils/CalibUtils.hpp"
|
#include "../slic3r/Utils/CalibUtils.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
wxDECLARE_EVENT(EVT_CALIBRATION_TRAY_SELECTION_CHANGED, SimpleEvent);
|
||||||
|
|
||||||
|
enum FilamentSelectMode {
|
||||||
|
FSMCheckBoxMode,
|
||||||
|
FSMRadioMode
|
||||||
|
};
|
||||||
|
class FilamentComboBox : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FilamentComboBox(wxWindow* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||||
|
~FilamentComboBox() {};
|
||||||
|
|
||||||
|
void set_select_mode(FilamentSelectMode mode);
|
||||||
|
FilamentSelectMode get_select_mode() { return m_mode; }
|
||||||
|
void load_tray_from_ams(int id, DynamicPrintConfig& tray);
|
||||||
|
void update_from_preset();
|
||||||
|
int get_tray_id() { return m_tray_id; }
|
||||||
|
CalibrateFilamentComboBox* GetComboBox() { return m_comboBox; }
|
||||||
|
CheckBox* GetCheckBox() { return m_checkBox; }
|
||||||
|
void SetCheckBox(CheckBox* cb) { m_checkBox = cb; }
|
||||||
|
wxRadioButton* GetRadioBox() { return m_radioBox; }
|
||||||
|
void SetRadioBox(wxRadioButton* btn) { m_radioBox = btn; }
|
||||||
|
virtual bool Show(bool show = true);
|
||||||
|
virtual bool Enable(bool enable);
|
||||||
|
virtual void SetValue(bool value);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_tray_id;
|
||||||
|
|
||||||
|
CheckBox* m_checkBox{nullptr};
|
||||||
|
//RadioBox* m_radioBox;
|
||||||
|
wxRadioButton* m_radioBox{ nullptr };
|
||||||
|
CalibrateFilamentComboBox* m_comboBox{ nullptr };
|
||||||
|
FilamentSelectMode m_mode{ FSMRadioMode };
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<FilamentComboBox*> FilamentComboBoxList;
|
||||||
|
|
||||||
class CalibrationWizard : public wxPanel {
|
class CalibrationWizard : public wxPanel {
|
||||||
public:
|
public:
|
||||||
CalibrationWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
CalibrationWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
@ -19,70 +59,125 @@ public:
|
||||||
CalibrationWizardPage* get_curr_page() { return m_curr_page; }
|
CalibrationWizardPage* get_curr_page() { return m_curr_page; }
|
||||||
CalibrationWizardPage* get_frist_page() { return m_first_page; }
|
CalibrationWizardPage* get_frist_page() { return m_first_page; }
|
||||||
void show_page(CalibrationWizardPage* page);
|
void show_page(CalibrationWizardPage* page);
|
||||||
void update_obj(MachineObject* rhs_obj) { obj = rhs_obj; }
|
void show_send_progress_bar(bool show);
|
||||||
|
void update_printer_selections();
|
||||||
void update_ams(MachineObject* obj);
|
void update_ams(MachineObject* obj);
|
||||||
void update_progress();
|
void update_print_progress();
|
||||||
|
void update_filaments_from_preset();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void create_pages() = 0;
|
virtual void create_pages() = 0;
|
||||||
virtual bool start_calibration(std::string tray_id) = 0;
|
virtual bool start_calibration(std::vector<int> tray_ids) = 0;
|
||||||
virtual void save_calibration_result() {};
|
virtual bool save_calibration_result() = 0;
|
||||||
virtual void update_calibration_value() = 0;
|
virtual bool recommend_input_value();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxPanel* m_background_panel;
|
MachineObject* curr_obj{ nullptr };
|
||||||
|
std::vector<MachineObject*> obj_list{ nullptr };
|
||||||
|
|
||||||
|
wxScrolledWindow* m_scrolledWindow;
|
||||||
|
wxBoxSizer* m_all_pages_sizer;
|
||||||
|
|
||||||
|
CalibrationWizardPage* m_curr_page{ nullptr };
|
||||||
|
CalibrationWizardPage* m_first_page{ nullptr };
|
||||||
|
|
||||||
|
// preset panel
|
||||||
wxPanel* m_presets_panel;
|
wxPanel* m_presets_panel;
|
||||||
AMSControl* m_ams_control;
|
wxPanel* m_select_ams_mode_panel;
|
||||||
|
//RadioBox* m_ams_radiobox;
|
||||||
|
//RadioBox* m_ext_spool_radiobox;
|
||||||
|
wxRadioButton* m_ams_radiobox;
|
||||||
|
wxRadioButton* m_ext_spool_radiobox;
|
||||||
|
bool m_filament_from_ext_spool{ false };
|
||||||
|
wxPanel* m_muilti_ams_panel;
|
||||||
|
std::vector<AMSItem*> m_ams_item_list;
|
||||||
|
wxPanel* m_filament_list_panel;
|
||||||
|
ScalableButton* m_ams_sync_button;
|
||||||
|
FilamentComboBoxList m_filament_comboBox_list;
|
||||||
|
wxPanel* m_virtual_panel;
|
||||||
|
FilamentComboBox* m_virtual_tray_comboBox;
|
||||||
ComboBox* m_comboBox_printer;
|
ComboBox* m_comboBox_printer;
|
||||||
ComboBox* m_comboBox_filament;
|
ComboBox* m_comboBox_nozzle_dia;
|
||||||
ComboBox* m_comboBox_bed_type;
|
ComboBox* m_comboBox_bed_type;
|
||||||
ComboBox* m_comboBox_process;
|
ComboBox* m_comboBox_process;
|
||||||
|
Preset* m_printer_preset{nullptr};
|
||||||
|
Preset* m_filament_preset{ nullptr };
|
||||||
|
Preset* m_print_preset{ nullptr };
|
||||||
wxStaticText* m_from_text;
|
wxStaticText* m_from_text;
|
||||||
wxStaticText* m_to_text;
|
wxStaticText* m_to_text;
|
||||||
wxStaticText* m_step_text;
|
wxStaticText* m_step_text;
|
||||||
TextInput* m_from_value;
|
TextInput* m_from_value;
|
||||||
TextInput* m_to_value;
|
TextInput* m_to_value;
|
||||||
TextInput* m_step;
|
TextInput* m_step;
|
||||||
BBLStatusBarSend* m_progress_bar;
|
TextInput* m_nozzle_temp;
|
||||||
|
TextInput* m_bed_temp;
|
||||||
|
TextInput* m_max_volumetric_speed;
|
||||||
|
wxStaticText* m_filaments_incompatible_tips;
|
||||||
|
wxStaticText* m_bed_type_incompatible_tips;
|
||||||
|
wxPanel* m_send_progress_panel;
|
||||||
|
std::shared_ptr<BBLStatusBarSend> m_send_progress_bar; // for send
|
||||||
|
|
||||||
MachineObject* obj{ nullptr };
|
// print panel
|
||||||
|
wxPanel* m_print_panel;
|
||||||
|
wxStaticText* m_staticText_progress_percent;
|
||||||
|
wxStaticText* m_staticText_progress_left_time;
|
||||||
|
wxStaticText* m_staticText_layers;
|
||||||
|
ScalableButton* m_button_pause_resume;
|
||||||
|
ScalableButton* m_button_abort;
|
||||||
|
ProgressBar* m_print_gauge_progress; // for print
|
||||||
|
PageButton* m_btn_next;
|
||||||
|
PageButton* m_btn_recali;
|
||||||
|
|
||||||
|
// save panel
|
||||||
|
wxPanel* m_save_panel;
|
||||||
|
|
||||||
CalibrationWizardPage* m_curr_page{ nullptr };
|
|
||||||
CalibrationWizardPage* m_first_page{ nullptr };
|
|
||||||
|
|
||||||
void add_presets_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
void add_presets_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||||
void add_progress_bar_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
void add_print_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||||
void show_progress_bar(bool show);
|
void add_send_progress_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
||||||
wxString get_presets_incompatible() { return wxString(); }
|
|
||||||
|
|
||||||
void on_select_printer(wxCommandEvent& evt);
|
void reset_printing_values();
|
||||||
void on_select_filament(wxCommandEvent& evt);
|
bool save_presets(const std::string& config_key, ConfigOption* config_value);
|
||||||
|
int get_bed_temp(DynamicPrintConfig* config);
|
||||||
|
FilamentSelectMode get_ams_select_mode() { if (!m_filament_comboBox_list.empty()) return m_filament_comboBox_list[0]->get_select_mode(); return FilamentSelectMode::FSMRadioMode; }
|
||||||
|
void set_ams_select_mode(FilamentSelectMode mode) { for (auto fcb : m_filament_comboBox_list) fcb->set_select_mode(mode); };
|
||||||
|
std::vector<int> get_selected_tray();
|
||||||
|
FilamentComboBoxList get_selected_filament_comboBox();
|
||||||
|
|
||||||
|
virtual void on_select_printer(wxCommandEvent& evt);
|
||||||
|
void on_select_nozzle(wxCommandEvent& evt);
|
||||||
|
void on_select_tray(SimpleEvent& evt);
|
||||||
void on_select_bed_type(wxCommandEvent& evt);
|
void on_select_bed_type(wxCommandEvent& evt);
|
||||||
void on_select_process(wxCommandEvent& evt);
|
|
||||||
void on_click_btn_prev(IntEvent& event);
|
void on_click_btn_prev(IntEvent& event);
|
||||||
void on_click_btn_next(IntEvent& event);
|
void on_click_btn_next(IntEvent& event);
|
||||||
|
void on_subtask_abort(wxCommandEvent& event);
|
||||||
|
void on_subtask_pause_resume(wxCommandEvent& event);
|
||||||
|
void on_choose_ams(wxCommandEvent& event);
|
||||||
|
void on_choose_ext_spool(wxCommandEvent& event);
|
||||||
|
void on_update_ams_filament(bool dialog = true);
|
||||||
|
void on_switch_ams(std::string ams_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void create_presets_panel();
|
void create_presets_panel();
|
||||||
void create_progress_bar();
|
void create_print_panel();
|
||||||
|
void create_save_panel();
|
||||||
|
void create_send_progress_bar();
|
||||||
|
|
||||||
void init_printer_selections();
|
void init_presets_selections();
|
||||||
void init_filaments_selections();
|
void init_nozzle_selections();
|
||||||
void init_bed_type_selections();
|
void init_bed_type_selections();
|
||||||
void init_process_selections();
|
void init_process_selections();
|
||||||
void init_presets_selections();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PressureAdvanceWizard : public CalibrationWizard{};
|
class PressureAdvanceWizard : public CalibrationWizard{
|
||||||
|
|
||||||
class FlowRateWizard : public CalibrationWizard {
|
|
||||||
public:
|
public:
|
||||||
FlowRateWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
PressureAdvanceWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~FlowRateWizard() {};
|
~PressureAdvanceWizard() {};
|
||||||
protected:
|
protected:
|
||||||
virtual void create_pages() override;
|
virtual void create_pages() override;
|
||||||
virtual bool start_calibration(std::string tray_id) override;
|
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||||
virtual void update_calibration_value() override;
|
virtual bool save_calibration_result() override;
|
||||||
|
virtual bool recommend_input_value() override;
|
||||||
private:
|
private:
|
||||||
// page 1
|
// page 1
|
||||||
CalibrationWizardPage* m_page1;
|
CalibrationWizardPage* m_page1;
|
||||||
|
@ -92,21 +187,44 @@ private:
|
||||||
|
|
||||||
// page 3
|
// page 3
|
||||||
CalibrationWizardPage* m_page3;
|
CalibrationWizardPage* m_page3;
|
||||||
|
TextInput* m_k_val;
|
||||||
|
TextInput* m_n_val;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FlowRateWizard : public CalibrationWizard {
|
||||||
|
public:
|
||||||
|
FlowRateWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
~FlowRateWizard() {};
|
||||||
|
protected:
|
||||||
|
void create_low_end_pages();
|
||||||
|
void create_high_end_pages();
|
||||||
|
virtual void create_pages() override;
|
||||||
|
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||||
|
virtual bool save_calibration_result() override;
|
||||||
|
virtual bool recommend_input_value() override;
|
||||||
|
|
||||||
|
virtual void on_select_printer(wxCommandEvent& evt) override;
|
||||||
|
private:
|
||||||
|
// page 1
|
||||||
|
CalibrationWizardPage* m_page1{ nullptr };
|
||||||
|
|
||||||
|
// page 2
|
||||||
|
CalibrationWizardPage* m_page2{ nullptr };
|
||||||
|
|
||||||
|
// page 3
|
||||||
|
CalibrationWizardPage* m_page3{ nullptr };
|
||||||
|
CalibrationWizardPage* m_high_end_page3{ nullptr };
|
||||||
ComboBox* m_optimal_block_coarse;
|
ComboBox* m_optimal_block_coarse;
|
||||||
|
|
||||||
// page 4
|
// page 4
|
||||||
CalibrationWizardPage* m_page4;
|
CalibrationWizardPage* m_page4{ nullptr };
|
||||||
AMSControl* m_readonly_ams_control;
|
//BBLStatusBarSend* m_progress_bar2;
|
||||||
TextInput* m_readonly_printer;
|
|
||||||
TextInput* m_readonly_filament;
|
|
||||||
TextInput* m_readonly_bed_type;
|
|
||||||
TextInput* m_readonly_process;
|
|
||||||
|
|
||||||
// page 5
|
// page 5
|
||||||
CalibrationWizardPage* m_page5;
|
CalibrationWizardPage* m_page5{ nullptr };
|
||||||
ComboBox* m_optimal_block_fine;
|
ComboBox* m_optimal_block_fine;
|
||||||
|
|
||||||
void create_readonly_presets_panel();
|
void on_fine_tune(wxCommandEvent&);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MaxVolumetricSpeedWizard : public CalibrationWizard {
|
class MaxVolumetricSpeedWizard : public CalibrationWizard {
|
||||||
|
@ -115,8 +233,9 @@ public:
|
||||||
~MaxVolumetricSpeedWizard() {};
|
~MaxVolumetricSpeedWizard() {};
|
||||||
protected:
|
protected:
|
||||||
virtual void create_pages() override;
|
virtual void create_pages() override;
|
||||||
virtual bool start_calibration(std::string tray_id) override;
|
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||||
virtual void update_calibration_value() override;
|
virtual bool save_calibration_result() override;
|
||||||
|
virtual bool recommend_input_value() override;
|
||||||
private:
|
private:
|
||||||
// page 1
|
// page 1
|
||||||
CalibrationWizardPage* m_page1;
|
CalibrationWizardPage* m_page1;
|
||||||
|
@ -135,9 +254,9 @@ public:
|
||||||
~TemperatureWizard() {};
|
~TemperatureWizard() {};
|
||||||
protected:
|
protected:
|
||||||
virtual void create_pages() override;
|
virtual void create_pages() override;
|
||||||
virtual bool start_calibration(std::string tray_id) override;
|
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
||||||
virtual void save_calibration_result();
|
virtual bool save_calibration_result() override;
|
||||||
virtual void update_calibration_value() override;
|
virtual bool recommend_input_value() override;
|
||||||
private:
|
private:
|
||||||
// page 1
|
// page 1
|
||||||
CalibrationWizardPage* m_page1;
|
CalibrationWizardPage* m_page1;
|
||||||
|
@ -145,6 +264,9 @@ private:
|
||||||
// page 2
|
// page 2
|
||||||
CalibrationWizardPage* m_page2;
|
CalibrationWizardPage* m_page2;
|
||||||
TextInput* m_optimal_temp;
|
TextInput* m_optimal_temp;
|
||||||
|
|
||||||
|
// page 3
|
||||||
|
CalibrationWizardPage* m_page3;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VFAWizard : public CalibrationWizard {};
|
class VFAWizard : public CalibrationWizard {};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "CalibrationWizardPage.hpp"
|
#include "CalibrationWizardPage.hpp"
|
||||||
#include "CalibrationWizard.hpp"
|
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
|
#include "Widgets/Label.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@ PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
||||||
: m_type(type),
|
: m_type(type),
|
||||||
Button(parent, text)
|
Button(parent, text)
|
||||||
{
|
{
|
||||||
StateColor btn_bg_green(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled),
|
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
||||||
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||||
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||||
|
|
||||||
StateColor btn_bg_white(std::pair<wxColour, int>(AMS_CONTROL_DISABLE_COLOUR, StateColor::Disabled),
|
StateColor btn_bg_white(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
||||||
std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
|
std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Pressed),
|
||||||
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
||||||
|
@ -59,9 +59,8 @@ PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
||||||
SetCornerRadius(FromDIP(12));
|
SetCornerRadius(FromDIP(12));
|
||||||
}
|
}
|
||||||
|
|
||||||
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, bool has_split_line, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: m_has_middle_line(has_split_line),
|
: wxPanel(parent, id, pos, size, style)
|
||||||
wxPanel(parent, id, pos, size, style)
|
|
||||||
{
|
{
|
||||||
SetBackgroundColour(*wxWHITE);
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
|
@ -90,40 +89,21 @@ CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, bool has_split_li
|
||||||
|
|
||||||
page_sizer->Add(m_top_sizer, 0, wxEXPAND, 0);
|
page_sizer->Add(m_top_sizer, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
wxBoxSizer* horiz_sizer;
|
m_content_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
horiz_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
m_left_sizer = new wxBoxSizer(wxVERTICAL);
|
page_sizer->Add(m_content_sizer, 0, wxEXPAND, 0);
|
||||||
horiz_sizer->Add(m_left_sizer, 1, wxEXPAND, 0);
|
|
||||||
|
|
||||||
auto middle_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(1, -1), wxTAB_TRAVERSAL);
|
page_sizer->AddStretchSpacer();
|
||||||
middle_line->SetBackgroundColour(wxColour(0, 0, 0));
|
|
||||||
|
|
||||||
horiz_sizer->Add(middle_line, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(20));
|
m_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
m_btn_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||||
if (!has_split_line) {
|
|
||||||
middle_line->Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto right_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
|
|
||||||
m_right_content_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
|
|
||||||
right_sizer->Add(m_right_content_sizer, 0, wxEXPAND, 0);
|
|
||||||
|
|
||||||
m_right_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
m_right_btn_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
|
||||||
m_btn_prev = new PageButton(this, "Back", Back);
|
m_btn_prev = new PageButton(this, "Back", Back);
|
||||||
m_right_btn_sizer->Add(m_btn_prev, 0);
|
m_btn_sizer->Add(m_btn_prev, 0);
|
||||||
m_right_btn_sizer->AddSpacer(FromDIP(10));
|
m_btn_sizer->AddSpacer(FromDIP(10));
|
||||||
m_btn_next = new PageButton(this, "Next", Next);
|
m_btn_next = new PageButton(this, "Next", Next);
|
||||||
m_right_btn_sizer->Add(m_btn_next, 0);
|
m_btn_sizer->Add(m_btn_next, 0);
|
||||||
|
|
||||||
right_sizer->Add(m_right_btn_sizer, 0, wxEXPAND, 0);
|
page_sizer->Add(m_btn_sizer, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
horiz_sizer->Add(right_sizer, 1, wxEXPAND, 0);
|
|
||||||
|
|
||||||
page_sizer->Add(horiz_sizer, 1, wxEXPAND, 0);
|
|
||||||
|
|
||||||
this->SetSizer(page_sizer);
|
this->SetSizer(page_sizer);
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
|
|
@ -34,7 +34,7 @@ private:
|
||||||
class CalibrationWizardPage : public wxPanel
|
class CalibrationWizardPage : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CalibrationWizardPage(wxWindow* parent, bool has_split_line, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
CalibrationWizardPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~CalibrationWizardPage() {};
|
~CalibrationWizardPage() {};
|
||||||
|
|
||||||
CalibrationWizardPage* get_prev_page() { return m_prev_page; }
|
CalibrationWizardPage* get_prev_page() { return m_prev_page; }
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBoxSizer* get_top_vsizer() { return m_top_sizer; }
|
wxBoxSizer* get_top_vsizer() { return m_top_sizer; }
|
||||||
wxBoxSizer* get_left_vsizer() { return m_left_sizer; }
|
wxBoxSizer* get_content_vsizer() { return m_content_sizer; }
|
||||||
wxBoxSizer* get_right_content_vsizer() { return m_right_content_sizer; }
|
wxBoxSizer* get_btn_hsizer() { return m_btn_sizer; }
|
||||||
PageButton* get_prev_btn() { return m_btn_prev; }
|
PageButton* get_prev_btn() { return m_btn_prev; }
|
||||||
PageButton* get_next_btn() { return m_btn_next; }
|
PageButton* get_next_btn() { return m_btn_next; }
|
||||||
|
|
||||||
|
@ -58,14 +58,11 @@ public:
|
||||||
void set_page_index(wxString index) { m_index->SetLabel(index); }
|
void set_page_index(wxString index) { m_index->SetLabel(index); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_has_middle_line;
|
|
||||||
|
|
||||||
wxStaticText* m_title;
|
wxStaticText* m_title;
|
||||||
wxStaticText* m_index;
|
wxStaticText* m_index;
|
||||||
wxBoxSizer* m_top_sizer;
|
wxBoxSizer* m_top_sizer;
|
||||||
wxBoxSizer* m_left_sizer;
|
wxBoxSizer* m_content_sizer;
|
||||||
wxBoxSizer* m_right_content_sizer;
|
wxBoxSizer* m_btn_sizer;
|
||||||
wxBoxSizer* m_right_btn_sizer;
|
|
||||||
PageButton* m_btn_prev;
|
PageButton* m_btn_prev;
|
||||||
PageButton* m_btn_next;
|
PageButton* m_btn_next;
|
||||||
|
|
||||||
|
|
|
@ -1941,6 +1941,126 @@ int MachineObject::command_start_calibration(bool vibration, bool bed_leveling,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_start_pa_calibration(const CalibDatas &pa_data)
|
||||||
|
{
|
||||||
|
pa_calib_results.clear();
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "extrusion_cali";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
for (int i = 0; i < pa_data.calib_datas.size(); ++i) {
|
||||||
|
j["print"]["filaments"][i]["bed_temp"] = pa_data.calib_datas[i].bed_temp;
|
||||||
|
j["print"]["filaments"][i]["tray_id"] = pa_data.calib_datas[i].tray_id;
|
||||||
|
j["print"]["filaments"][i]["filament_id"] = pa_data.calib_datas[i].filament_id;
|
||||||
|
j["print"]["filaments"][i]["setting_id"] = pa_data.calib_datas[i].setting_id;
|
||||||
|
j["print"]["filaments"][i]["nozzle_temp"] = pa_data.calib_datas[i].nozzle_temp;
|
||||||
|
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(pa_data.calib_datas[i].max_volumetric_speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values)
|
||||||
|
{
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "extrusion_cali_set";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
for (int i = 0; i < pa_calib_values.size(); ++i) {
|
||||||
|
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
||||||
|
j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id;
|
||||||
|
j["print"]["filaments"][i]["setting_id"] = pa_calib_values[i].setting_id;
|
||||||
|
j["print"]["filaments"][i]["name"] = pa_calib_values[i].name;
|
||||||
|
j["print"]["filaments"][i]["k_value"] = std::to_string(pa_calib_values[i].k_value);
|
||||||
|
j["print"]["filaments"][i]["n_coef"] = std::to_string(pa_calib_values[i].n_coef);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_delete_pa_calibration(const PACalibResult& pa_calib)
|
||||||
|
{
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "extrusion_cali_del";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
j["print"]["tray_id"] = pa_calib.tray_id;
|
||||||
|
j["print"]["filament_id"] = pa_calib.filament_id;
|
||||||
|
j["print"]["setting_id"] = pa_calib.setting_id;
|
||||||
|
j["print"]["name"] = pa_calib.name;
|
||||||
|
j["print"]["k_value"] = std::to_string(pa_calib.k_value);
|
||||||
|
j["print"]["n_coef"] = std::to_string(pa_calib.n_coef);
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_get_pa_calibration_infos(const std::string& filament_id)
|
||||||
|
{
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "extrusion_cali_get";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
j["print"]["sequence_id"] = filament_id;
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_get_pa_calibration_result()
|
||||||
|
{
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "extrusion_cali_get_result";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_start_flow_ratio_calibration(const CalibDatas& calib_data)
|
||||||
|
{
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "flowrate_cali";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
for (int i = 0; i < calib_data.calib_datas.size(); ++i) {
|
||||||
|
j["print"]["filaments"][i]["bed_temp"] = calib_data.calib_datas[i].bed_temp;
|
||||||
|
j["print"]["filaments"][i]["tray_id"] = calib_data.calib_datas[i].tray_id;
|
||||||
|
j["print"]["filaments"][i]["filament_id"] = calib_data.calib_datas[i].filament_id;
|
||||||
|
j["print"]["filaments"][i]["setting_id"] = calib_data.calib_datas[i].setting_id;
|
||||||
|
j["print"]["filaments"][i]["nozzle_temp"] = calib_data.calib_datas[i].nozzle_temp;
|
||||||
|
j["print"]["filaments"][i]["max_volumetric_speed"] = std::to_string(calib_data.calib_datas[i].max_volumetric_speed);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int MachineObject::command_get_flow_ratio_calibration_result()
|
||||||
|
{
|
||||||
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
|
json j;
|
||||||
|
j["print"]["command"] = "flowrate_get_result";
|
||||||
|
j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++);
|
||||||
|
|
||||||
|
return this->publish_json(j.dump());
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int MachineObject::command_unload_filament()
|
int MachineObject::command_unload_filament()
|
||||||
{
|
{
|
||||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")
|
||||||
|
@ -3669,6 +3789,74 @@ int MachineObject::parse_json(std::string payload)
|
||||||
extrusion_cali_set_tray_id = curr_tray_id;
|
extrusion_cali_set_tray_id = curr_tray_id;
|
||||||
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
|
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
||||||
|
if (jj["filaments"].is_array()) {
|
||||||
|
try {
|
||||||
|
pa_calib_tab.clear();
|
||||||
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
|
PACalibResult pa_calib_result;
|
||||||
|
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||||
|
pa_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||||
|
pa_calib_result.name = (*it)["name"].get<std::string>();
|
||||||
|
|
||||||
|
if ((*it)["k_value"].is_number_float())
|
||||||
|
pa_calib_result.k_value = (*it)["k_value"].get<float>();
|
||||||
|
else if ((*it)["k_value"].is_string())
|
||||||
|
pa_calib_result.k_value = stof((*it)["k_value"].get<std::string>().c_str());
|
||||||
|
|
||||||
|
if ((*it)["n_coef"].is_number_float())
|
||||||
|
pa_calib_result.n_coef = (*it)["n_coef"].get<float>();
|
||||||
|
else if ((*it)["n_coef"].is_string())
|
||||||
|
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
||||||
|
|
||||||
|
pa_calib_tab.push_back(pa_calib_result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
||||||
|
if (jj["filaments"].is_array()) {
|
||||||
|
try {
|
||||||
|
pa_calib_results.clear();
|
||||||
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
|
PACalibResult pa_calib_result;
|
||||||
|
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||||
|
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||||
|
pa_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||||
|
if ((*it)["k_value"].is_number_float())
|
||||||
|
pa_calib_result.k_value = (*it)["k_value"].get<float>();
|
||||||
|
else if ((*it)["k_value"].is_string())
|
||||||
|
pa_calib_result.k_value = stof((*it)["k_value"].get<std::string>().c_str());
|
||||||
|
|
||||||
|
if ((*it)["n_coef"].is_number_float())
|
||||||
|
pa_calib_result.n_coef = (*it)["n_coef"].get<float>();
|
||||||
|
else if ((*it)["n_coef"].is_string())
|
||||||
|
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
||||||
|
|
||||||
|
pa_calib_results.push_back(pa_calib_result);
|
||||||
|
}
|
||||||
|
} catch (...) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (jj["command"].get<std::string>() == "flowrate_get_result") {
|
||||||
|
if (jj["filaments"].is_array()) {
|
||||||
|
try {
|
||||||
|
flow_ratio_results.clear();
|
||||||
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
|
FlowRatioCalibResult flow_ratio_calib_result;
|
||||||
|
flow_ratio_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||||
|
flow_ratio_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||||
|
flow_ratio_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||||
|
flow_ratio_calib_result.flow_ratio = stof((*it)["flow_ratio"].get<std::string>().c_str());
|
||||||
|
|
||||||
|
flow_ratio_results.push_back(flow_ratio_calib_result);
|
||||||
|
}
|
||||||
|
} catch (...) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,6 +308,41 @@ public:
|
||||||
static wxString get_hms_msg_level_str(HMSMessageLevel level);
|
static wxString get_hms_msg_level_str(HMSMessageLevel level);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CalibDatas
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct CalibData
|
||||||
|
{
|
||||||
|
int tray_id;
|
||||||
|
int bed_temp;
|
||||||
|
int nozzle_temp;
|
||||||
|
std::string filament_id;
|
||||||
|
std::string setting_id;
|
||||||
|
float max_volumetric_speed;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<CalibData> calib_datas;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PACalibResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int tray_id;
|
||||||
|
std::string filament_id;
|
||||||
|
std::string setting_id;
|
||||||
|
std::string name;
|
||||||
|
float k_value;
|
||||||
|
float n_coef;
|
||||||
|
};
|
||||||
|
|
||||||
|
class FlowRatioCalibResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int tray_id;
|
||||||
|
std::string filament_id;
|
||||||
|
std::string setting_id;
|
||||||
|
float flow_ratio;
|
||||||
|
};
|
||||||
|
|
||||||
#define UpgradeNoError 0
|
#define UpgradeNoError 0
|
||||||
#define UpgradeDownloadFailed -1
|
#define UpgradeDownloadFailed -1
|
||||||
|
@ -608,6 +643,10 @@ public:
|
||||||
int total_layers = 0;
|
int total_layers = 0;
|
||||||
bool is_support_layer_num { false };
|
bool is_support_layer_num { false };
|
||||||
|
|
||||||
|
std::vector<PACalibResult> pa_calib_tab;
|
||||||
|
std::vector<PACalibResult> pa_calib_results;
|
||||||
|
std::vector<FlowRatioCalibResult> flow_ratio_results;
|
||||||
|
|
||||||
std::vector<int> stage_list_info;
|
std::vector<int> stage_list_info;
|
||||||
int stage_curr = 0;
|
int stage_curr = 0;
|
||||||
int m_push_count = 0;
|
int m_push_count = 0;
|
||||||
|
@ -766,6 +805,17 @@ public:
|
||||||
bool is_support_command_calibration();
|
bool is_support_command_calibration();
|
||||||
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali);
|
int command_start_calibration(bool vibration, bool bed_leveling, bool xcam_cali);
|
||||||
|
|
||||||
|
// PA calibration
|
||||||
|
int command_start_pa_calibration(const CalibDatas& pa_data);
|
||||||
|
int command_set_pa_calibration(const std::vector<PACalibResult>& pa_calib_values);
|
||||||
|
int command_delete_pa_calibration(const PACalibResult& pa_calib);
|
||||||
|
int command_get_pa_calibration_infos(const std::string& filament_id = "");
|
||||||
|
int command_get_pa_calibration_result();
|
||||||
|
|
||||||
|
// flow ratio calibration
|
||||||
|
int command_start_flow_ratio_calibration(const CalibDatas& calib_data);
|
||||||
|
int command_get_flow_ratio_calibration_result();
|
||||||
|
|
||||||
int command_unload_filament();
|
int command_unload_filament();
|
||||||
|
|
||||||
// camera control
|
// camera control
|
||||||
|
|
|
@ -1967,7 +1967,7 @@ void GUI_App::init_networking_callbacks()
|
||||||
|
|
||||||
auto sel = this->m_device_manager->get_selected_machine();
|
auto sel = this->m_device_manager->get_selected_machine();
|
||||||
if ((sel == obj || sel == nullptr) && obj->is_ams_need_update) {
|
if ((sel == obj || sel == nullptr) && obj->is_ams_need_update) {
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1991,7 +1991,7 @@ void GUI_App::init_networking_callbacks()
|
||||||
if (obj) {
|
if (obj) {
|
||||||
obj->parse_json(msg);
|
obj->parse_json(msg);
|
||||||
if (this->m_device_manager->get_selected_machine() == obj && obj->is_ams_need_update) {
|
if (this->m_device_manager->get_selected_machine() == obj && obj->is_ams_need_update) {
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "slic3r/GUI/Plater.hpp"
|
#include "slic3r/GUI/Plater.hpp"
|
||||||
#include "slic3r/GUI/GUI.hpp"
|
#include "slic3r/GUI/GUI.hpp"
|
||||||
#include "slic3r/GUI/GUI_App.hpp"
|
#include "slic3r/GUI/GUI_App.hpp"
|
||||||
|
#include "slic3r/GUI/MainFrame.hpp"
|
||||||
#include "bambu_networking.hpp"
|
#include "bambu_networking.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
@ -461,6 +462,12 @@ void PrintJob::process()
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";
|
BOOST_LOG_TRIVIAL(error) << "print_job: send ok.";
|
||||||
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
|
wxCommandEvent* evt = new wxCommandEvent(m_print_job_completed_id);
|
||||||
|
if (m_print_job_completed_id == wxGetApp().plater()->get_send_calibration_finished_event()) {
|
||||||
|
int sel = wxGetApp().mainframe->get_calibration_curr_tab();
|
||||||
|
if (sel >= 0) {
|
||||||
|
evt->SetInt(sel);
|
||||||
|
}
|
||||||
|
}
|
||||||
evt->SetString(m_dev_id);
|
evt->SetString(m_dev_id);
|
||||||
wxQueueEvent(m_plater, evt);
|
wxQueueEvent(m_plater, evt);
|
||||||
m_job_finished = true;
|
m_job_finished = true;
|
||||||
|
|
|
@ -2998,6 +2998,12 @@ void MainFrame::request_select_tab(TabPosition pos)
|
||||||
wxQueueEvent(this, evt);
|
wxQueueEvent(this, evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MainFrame::get_calibration_curr_tab() {
|
||||||
|
if (m_calibration)
|
||||||
|
return m_calibration->get_tabpanel()->GetSelection();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Set a camera direction, zoom to all objects.
|
// Set a camera direction, zoom to all objects.
|
||||||
void MainFrame::select_view(const std::string& direction)
|
void MainFrame::select_view(const std::string& direction)
|
||||||
{
|
{
|
||||||
|
|
|
@ -306,6 +306,7 @@ public:
|
||||||
void select_tab(wxPanel* panel);
|
void select_tab(wxPanel* panel);
|
||||||
void select_tab(size_t tab = size_t(-1));
|
void select_tab(size_t tab = size_t(-1));
|
||||||
void request_select_tab(TabPosition pos);
|
void request_select_tab(TabPosition pos);
|
||||||
|
int get_calibration_curr_tab();
|
||||||
void select_view(const std::string& direction);
|
void select_view(const std::string& direction);
|
||||||
// Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig
|
// Propagate changed configuration from the Tab to the Plater and save changes to the AppConfig
|
||||||
void on_config_changed(DynamicPrintConfig* cfg) const ;
|
void on_config_changed(DynamicPrintConfig* cfg) const ;
|
||||||
|
|
|
@ -153,7 +153,7 @@ MonitorPanel::~MonitorPanel()
|
||||||
if (!dev) return;
|
if (!dev) return;
|
||||||
MachineObject *obj_ = dev->get_selected_machine();
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
if (obj_)
|
if (obj_)
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_->amsList);
|
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorPanel::init_tabpanel()
|
void MonitorPanel::init_tabpanel()
|
||||||
|
@ -315,7 +315,7 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)
|
||||||
|
|
||||||
MachineObject *obj_ = dev->get_selected_machine();
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
if (obj_)
|
if (obj_)
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_->amsList);
|
GUI::wxGetApp().sidebar().load_ams_list(obj_->dev_id, obj_);
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
|
@ -459,9 +459,6 @@ void MonitorPanel::update_all()
|
||||||
m_hms_panel->update(obj);
|
m_hms_panel->update(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cali_panel = static_cast<CalibrationPanel*>(wxGetApp().mainframe->m_calibration);
|
|
||||||
if(cali_panel)
|
|
||||||
cali_panel->update_obj(obj);
|
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
#if !BBL_RELEASE_TO_PUBLIC
|
||||||
if (m_upgrade_panel->IsShown()) {
|
if (m_upgrade_panel->IsShown()) {
|
||||||
m_upgrade_panel->update(obj);
|
m_upgrade_panel->update(obj);
|
||||||
|
@ -490,7 +487,7 @@ bool MonitorPanel::Show(bool show)
|
||||||
dev->load_last_machine();
|
dev->load_last_machine();
|
||||||
obj = dev->get_selected_machine();
|
obj = dev->get_selected_machine();
|
||||||
if (obj)
|
if (obj)
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||||
} else {
|
} else {
|
||||||
obj->reset_update_time();
|
obj->reset_update_time();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1368,21 +1368,47 @@ void Sidebar::on_bed_type_change(BedType bed_type)
|
||||||
m_bed_type_list->SetSelection(sel_idx);
|
m_bed_type_list->SetSelection(sel_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::load_ams_list(std::string const &device, std::map<std::string, Ams *> const &list)
|
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
|
||||||
{
|
{
|
||||||
std::vector<DynamicPrintConfig> filament_ams_list;
|
std::map<int, DynamicPrintConfig> filament_ams_list;
|
||||||
|
|
||||||
|
if (!obj) {
|
||||||
|
p->ams_list_device = device;
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": %1% items") % filament_ams_list.size();
|
||||||
|
wxGetApp().preset_bundle->filament_ams_list = filament_ams_list;
|
||||||
|
for (auto c : p->combos_filament)
|
||||||
|
c->update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto vt_tray = obj->vt_tray;
|
||||||
|
bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY);
|
||||||
|
if (is_support_virtual_tray) {
|
||||||
|
DynamicPrintConfig vt_tray_config;
|
||||||
|
vt_tray_config.set_key_value("filament_id", new ConfigOptionStrings{ vt_tray.setting_id });
|
||||||
|
vt_tray_config.set_key_value("filament_type", new ConfigOptionStrings{ vt_tray.type });
|
||||||
|
vt_tray_config.set_key_value("tray_name", new ConfigOptionStrings{ std::string("Ext")});
|
||||||
|
vt_tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ "#" + vt_tray.color.substr(0, 8) });
|
||||||
|
vt_tray_config.set_key_value("filament_exist", new ConfigOptionBools{ vt_tray.is_exists });
|
||||||
|
|
||||||
|
filament_ams_list.emplace(VIRTUAL_TRAY_ID, std::move(vt_tray_config));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto list = obj->amsList;
|
||||||
for (auto ams : list) {
|
for (auto ams : list) {
|
||||||
char n = ams.first.front() - '0' + 'A';
|
char n = ams.first.front() - '0' + 'A';
|
||||||
for (auto tray : ams.second->trayList) {
|
for (auto tray : ams.second->trayList) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__
|
||||||
<< boost::format(": ams %1% tray %2% id %3% color %4%") % ams.first % tray.first % tray.second->setting_id % tray.second->color;
|
<< boost::format(": ams %1% tray %2% id %3% color %4%") % ams.first % tray.first % tray.second->setting_id % tray.second->color;
|
||||||
char t = tray.first.front() - '0' + '1';
|
char t = tray.first.front() - '0' + '1';
|
||||||
DynamicPrintConfig ams;
|
DynamicPrintConfig tray_config;
|
||||||
ams.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id});
|
tray_config.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id});
|
||||||
ams.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type});
|
tray_config.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type});
|
||||||
ams.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)});
|
tray_config.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)});
|
||||||
ams.set_key_value("filament_colour", new ConfigOptionStrings{"#" + tray.second->color.substr(0, 8)});
|
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ "#" + tray.second->color.substr(0, 8) });
|
||||||
filament_ams_list.emplace_back(std::move(ams));
|
tray_config.set_key_value("filament_exist", new ConfigOptionBools{ tray.second->is_exists });
|
||||||
|
|
||||||
|
filament_ams_list.emplace(((n - 'A') * 4 + t - '1'), std::move(tray_config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p->ams_list_device = device;
|
p->ams_list_device = device;
|
||||||
|
@ -1425,9 +1451,11 @@ void Sidebar::sync_ams_list()
|
||||||
auto res = dlg.ShowModal();
|
auto res = dlg.ShowModal();
|
||||||
if (res == wxID_CANCEL) return;
|
if (res == wxID_CANCEL) return;
|
||||||
list2.resize(list.size());
|
list2.resize(list.size());
|
||||||
for (int i = 0; i < list.size(); ++i) {
|
auto iter = list.begin();
|
||||||
auto filament_id = list[i].opt_string("filament_id", 0u);
|
for (int i = 0; i < list.size(); ++i, ++iter) {
|
||||||
list[i].set_key_value("filament_changed", new ConfigOptionBool{res == wxID_YES || list2[i] != filament_id});
|
auto & ams = iter->second;
|
||||||
|
auto filament_id = ams.opt_string("filament_id", 0u);
|
||||||
|
ams.set_key_value("filament_changed", new ConfigOptionBool{res == wxID_YES || list2[i] != filament_id});
|
||||||
list2[i] = filament_id;
|
list2[i] = filament_id;
|
||||||
}
|
}
|
||||||
unsigned int unknowns = 0;
|
unsigned int unknowns = 0;
|
||||||
|
@ -10294,18 +10322,12 @@ int Plater::export_config_3mf(int plate_idx, Export3mfProgressFn proFn)
|
||||||
//BBS
|
//BBS
|
||||||
void Plater::send_calibration_job_finished(wxCommandEvent & evt)
|
void Plater::send_calibration_job_finished(wxCommandEvent & evt)
|
||||||
{
|
{
|
||||||
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
|
||||||
if (!dev) return;
|
|
||||||
dev->set_selected_machine(evt.GetString().ToStdString());
|
|
||||||
|
|
||||||
p->hide_select_machine_dlg();
|
|
||||||
p->main_frame->request_select_tab(MainFrame::TabPosition::tpCalibration);
|
p->main_frame->request_select_tab(MainFrame::TabPosition::tpCalibration);
|
||||||
//jump to monitor and select device status panel
|
auto calibration_panel = p->main_frame->m_calibration;
|
||||||
auto curr_calibration = p->main_frame->m_calibration;
|
if (calibration_panel) {
|
||||||
if (curr_calibration) {
|
auto curr_wizard = static_cast<CalibrationWizard*>(calibration_panel->get_tabpanel()->GetPage(evt.GetInt()));
|
||||||
// todo select current tab
|
curr_wizard->show_send_progress_bar(false);
|
||||||
auto calibration_wizard = static_cast<CalibrationWizard*>(curr_calibration->get_tabpanel()->GetPage(curr_calibration->get_tabpanel()->GetSelection()));
|
curr_wizard->show_page(curr_wizard->get_curr_page()->get_next_page());
|
||||||
calibration_wizard->show_page(calibration_wizard->get_curr_page()->get_next_page());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ public:
|
||||||
void on_filaments_change(size_t num_filaments);
|
void on_filaments_change(size_t num_filaments);
|
||||||
// BBS
|
// BBS
|
||||||
void on_bed_type_change(BedType bed_type);
|
void on_bed_type_change(BedType bed_type);
|
||||||
void load_ams_list(std::string const & device, std::map<std::string, Ams *> const &list);
|
void load_ams_list(std::string const & device, MachineObject* obj);
|
||||||
void sync_ams_list();
|
void sync_ams_list();
|
||||||
|
|
||||||
ObjectList* obj_list();
|
ObjectList* obj_list();
|
||||||
|
|
|
@ -231,11 +231,12 @@ int PresetComboBox::update_ams_color()
|
||||||
if (color.empty()) return -1;
|
if (color.empty()) return -1;
|
||||||
} else {
|
} else {
|
||||||
auto &ams_list = wxGetApp().preset_bundle->filament_ams_list;
|
auto &ams_list = wxGetApp().preset_bundle->filament_ams_list;
|
||||||
if (idx >= ams_list.size()) {
|
auto iter = ams_list.find(idx);
|
||||||
|
if (iter == ams_list.end()) {
|
||||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": ams %1% out of range %2%") % idx % ams_list.size();
|
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": ams %1% out of range %2%") % idx % ams_list.size();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
color = ams_list[idx].opt_string("filament_colour", 0u);
|
color = iter->second.opt_string("filament_colour", 0u);
|
||||||
}
|
}
|
||||||
DynamicPrintConfig *cfg = &wxGetApp().preset_bundle->project_config;
|
DynamicPrintConfig *cfg = &wxGetApp().preset_bundle->project_config;
|
||||||
auto colors = static_cast<ConfigOptionStrings*>(cfg->option("filament_colour")->clone());
|
auto colors = static_cast<ConfigOptionStrings*>(cfg->option("filament_colour")->clone());
|
||||||
|
@ -374,13 +375,14 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
|
||||||
set_label_marker(Append(separator(L("AMS filaments")), wxNullBitmap));
|
set_label_marker(Append(separator(L("AMS filaments")), wxNullBitmap));
|
||||||
m_first_ams_filament = GetCount();
|
m_first_ams_filament = GetCount();
|
||||||
auto &filaments = m_collection->get_presets();
|
auto &filaments = m_collection->get_presets();
|
||||||
for (auto &f : m_preset_bundle->filament_ams_list) {
|
for (auto &entry : m_preset_bundle->filament_ams_list) {
|
||||||
std::string filament_id = f.opt_string("filament_id", 0u);
|
auto & tray = entry.second;
|
||||||
|
std::string filament_id = tray.opt_string("filament_id", 0u);
|
||||||
if (filament_id.empty()) continue;
|
if (filament_id.empty()) continue;
|
||||||
auto iter = std::find_if(filaments.begin(), filaments.end(),
|
auto iter = std::find_if(filaments.begin(), filaments.end(),
|
||||||
[&filament_id](auto &f) { return f.is_compatible && f.is_system && f.filament_id == filament_id; });
|
[&filament_id](auto &f) { return f.is_compatible && f.is_system && f.filament_id == filament_id; });
|
||||||
if (iter == filaments.end()) {
|
if (iter == filaments.end()) {
|
||||||
auto filament_type = "Generic " + f.opt_string("filament_type", 0u);
|
auto filament_type = "Generic " + tray.opt_string("filament_type", 0u);
|
||||||
iter = std::find_if(filaments.begin(), filaments.end(),
|
iter = std::find_if(filaments.begin(), filaments.end(),
|
||||||
[&filament_type](auto &f) { return f.is_compatible && f.is_system && boost::algorithm::starts_with(f.name, filament_type); });
|
[&filament_type](auto &f) { return f.is_compatible && f.is_system && boost::algorithm::starts_with(f.name, filament_type); });
|
||||||
}
|
}
|
||||||
|
@ -389,10 +391,10 @@ void PresetComboBox::add_ams_filaments(std::string selected, bool alias_name)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const_cast<Preset&>(*iter).is_visible = true;
|
const_cast<Preset&>(*iter).is_visible = true;
|
||||||
auto color = f.opt_string("filament_colour", 0u);
|
auto color = tray.opt_string("filament_colour", 0u);
|
||||||
auto name = f.opt_string("tray_name", 0u);
|
auto name = tray.opt_string("tray_name", 0u);
|
||||||
wxBitmap bmp(*get_extruder_color_icon(color, name, 24, 16));
|
wxBitmap bmp(*get_extruder_color_icon(color, name, 24, 16));
|
||||||
int item_id = Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + (&f - &m_preset_bundle->filament_ams_list.front()));
|
int item_id = Append(get_preset_name(*iter), bmp.ConvertToImage(), &m_first_ams_filament + entry.first);
|
||||||
//validate_selection(id->value == selected); // can not select
|
//validate_selection(id->value == selected); // can not select
|
||||||
}
|
}
|
||||||
m_last_ams_filament = GetCount();
|
m_last_ams_filament = GetCount();
|
||||||
|
@ -623,7 +625,7 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers()
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
|
|
||||||
PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset_type) :
|
PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset_type) :
|
||||||
PresetComboBox(parent, preset_type, wxSize(15 * wxGetApp().em_unit(), 30 * wxGetApp().em_unit() / 10))
|
PresetComboBox(parent, preset_type, wxSize(25 * wxGetApp().em_unit(), 30 * wxGetApp().em_unit() / 10))
|
||||||
{
|
{
|
||||||
GetDropDown().SetUseContentWidth(true);
|
GetDropDown().SetUseContentWidth(true);
|
||||||
|
|
||||||
|
@ -1012,7 +1014,7 @@ void PlaterPresetComboBox::update()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_type == Preset::TYPE_FILAMENT)
|
if (m_type == Preset::TYPE_FILAMENT)
|
||||||
add_ams_filaments(into_u8(selected_user_preset), true);
|
add_ams_filaments(into_u8(selected_user_preset.empty() ? selected_system_preset : selected_user_preset), true);
|
||||||
|
|
||||||
//BBS: add project embedded preset logic
|
//BBS: add project embedded preset logic
|
||||||
if (!project_embedded_presets.empty())
|
if (!project_embedded_presets.empty())
|
||||||
|
@ -1373,4 +1375,142 @@ void TabPresetComboBox::update_dirty()
|
||||||
#endif /* __APPLE __ */
|
#endif /* __APPLE __ */
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
} // namespace GUI
|
||||||
|
GUI::CalibrateFilamentComboBox::CalibrateFilamentComboBox(wxWindow *parent)
|
||||||
|
: PlaterPresetComboBox(parent, Preset::TYPE_FILAMENT)
|
||||||
|
{
|
||||||
|
clr_picker->SetBackgroundColour(*wxWHITE);
|
||||||
|
clr_picker->SetBitmap(*get_extruder_color_icon("#FFFFFFFF", "", 16, 16));
|
||||||
|
clr_picker->SetToolTip("");
|
||||||
|
clr_picker->Bind(wxEVT_BUTTON, [this](wxCommandEvent& e) {});
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI::CalibrateFilamentComboBox::~CalibrateFilamentComboBox()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::CalibrateFilamentComboBox::load_tray(DynamicPrintConfig &config)
|
||||||
|
{
|
||||||
|
m_tray_name = config.opt_string("tray_name", 0u);
|
||||||
|
m_filament_id = config.opt_string("filament_id", 0u);
|
||||||
|
m_filament_type = config.opt_string("filament_type", 0u);
|
||||||
|
m_filament_color = config.opt_string("filament_colour", 0u);
|
||||||
|
m_filament_exist = config.opt_bool("filament_exist", 0u);
|
||||||
|
wxColor clr(m_filament_color);
|
||||||
|
clr_picker->SetBitmap(*get_extruder_color_icon(m_filament_color, m_tray_name, 16, 16));
|
||||||
|
#ifdef __WXOSX__
|
||||||
|
clr_picker->SetLabel(clr_picker->GetLabel()); // Let setBezelStyle: be called
|
||||||
|
clr_picker->Refresh();
|
||||||
|
#endif
|
||||||
|
if (!m_filament_exist) {
|
||||||
|
SetValue(_L("Empty"));
|
||||||
|
clr_picker->SetBitmap(*get_extruder_color_icon("#F0F0F0FF", m_tray_name, 16, 16));
|
||||||
|
} else {
|
||||||
|
auto &filaments = m_collection->get_presets();
|
||||||
|
auto iter = std::find_if(filaments.begin(), filaments.end(), [this](auto &f) { return f.is_compatible && f.is_system && f.filament_id == m_filament_id; });
|
||||||
|
if (iter == filaments.end() && !m_filament_type.empty()) {
|
||||||
|
auto filament_type = "Generic " + m_filament_type;
|
||||||
|
iter = std::find_if(filaments.begin(), filaments.end(),
|
||||||
|
[&filament_type](auto &f) { return f.is_compatible && f.is_system && boost::algorithm::starts_with(f.name, filament_type); });
|
||||||
|
}
|
||||||
|
if (iter != filaments.end()) {
|
||||||
|
m_selected_preset = &*iter;
|
||||||
|
SetValue(get_preset_name(*iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
SetValue(_L("Incompatible"));
|
||||||
|
Enable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::CalibrateFilamentComboBox::update()
|
||||||
|
{
|
||||||
|
if (m_preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Otherwise fill in the list from scratch.
|
||||||
|
this->Freeze();
|
||||||
|
this->Clear();
|
||||||
|
invalidate_selection();
|
||||||
|
|
||||||
|
const Preset* selected_filament_preset = nullptr;
|
||||||
|
|
||||||
|
std::map<wxString, wxBitmap*> nonsys_presets;
|
||||||
|
std::map<wxString, wxBitmap*> project_embedded_presets;
|
||||||
|
std::map<wxString, wxBitmap*> system_presets;
|
||||||
|
|
||||||
|
wxString selected_preset = m_selected_preset ? get_preset_name(*m_selected_preset) : GetValue();
|
||||||
|
if (!m_selected_preset)
|
||||||
|
m_selected_preset = m_collection->find_preset(selected_preset.ToStdString());
|
||||||
|
wxString tooltip;
|
||||||
|
const std::deque<Preset>& presets = m_collection->get_presets();
|
||||||
|
|
||||||
|
for (size_t i = presets.front().is_visible ? 0 : m_collection->num_default_presets(); i < presets.size(); ++i)
|
||||||
|
{
|
||||||
|
const Preset& preset = presets[i];
|
||||||
|
auto name = get_preset_name(preset);
|
||||||
|
bool is_selected = m_selected_preset == &preset;
|
||||||
|
if (m_preset_bundle->calibrate_filaments.empty()) {
|
||||||
|
Thaw();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool is_compatible = m_preset_bundle->calibrate_filaments.find(&preset) != m_preset_bundle->calibrate_filaments.end();
|
||||||
|
;
|
||||||
|
if (!preset.is_visible || (!is_compatible && !is_selected))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (is_selected) {
|
||||||
|
tooltip = get_tooltip(preset);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxBitmap* bmp = get_bmp(preset);
|
||||||
|
assert(bmp);
|
||||||
|
|
||||||
|
if (preset.is_default || preset.is_system)
|
||||||
|
system_presets.emplace(name, bmp);
|
||||||
|
else if (preset.is_project_embedded)
|
||||||
|
project_embedded_presets.emplace(name, bmp);
|
||||||
|
else
|
||||||
|
nonsys_presets.emplace(name, bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!nonsys_presets.empty())
|
||||||
|
{
|
||||||
|
set_label_marker(Append(separator(L("User presets")), wxNullBitmap));
|
||||||
|
for (std::map<wxString, wxBitmap*>::iterator it = nonsys_presets.begin(); it != nonsys_presets.end(); ++it) {
|
||||||
|
Append(it->first, *it->second);
|
||||||
|
validate_selection(it->first == selected_preset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!system_presets.empty())
|
||||||
|
{
|
||||||
|
set_label_marker(Append(separator(L("System presets")), wxNullBitmap));
|
||||||
|
for (std::map<wxString, wxBitmap*>::iterator it = system_presets.begin(); it != system_presets.end(); ++it) {
|
||||||
|
Append(it->first, *it->second);
|
||||||
|
validate_selection(it->first == selected_preset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
update_selection();
|
||||||
|
Thaw();
|
||||||
|
|
||||||
|
if (!tooltip.IsEmpty()) {
|
||||||
|
#ifdef __WXMSW__
|
||||||
|
SetToolTip(NULL);
|
||||||
|
#endif
|
||||||
|
SetToolTip(tooltip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt)
|
||||||
|
{
|
||||||
|
std::string preset_name = m_collection->get_preset_name_by_alias(evt.GetString().ToUTF8().data());
|
||||||
|
m_selected_preset = m_collection->find_preset(preset_name);
|
||||||
|
SimpleEvent e(EVT_CALIBRATION_TRAY_SELECTION_CHANGED);
|
||||||
|
auto cali_tab = wxGetApp().mainframe->m_calibration->get_tabpanel();
|
||||||
|
auto calibration_wizard = static_cast<CalibrationWizard*>(cali_tab->GetPage(cali_tab->GetSelection()));
|
||||||
|
e.SetEventObject(calibration_wizard);
|
||||||
|
wxPostEvent(calibration_wizard, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Slic3r
|
||||||
|
|
|
@ -214,6 +214,32 @@ public:
|
||||||
Preset::Type type() const { return m_type; }
|
Preset::Type type() const { return m_type; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ---------------------------------
|
||||||
|
// *** CalibrateFilamentComboBox ***
|
||||||
|
// ---------------------------------
|
||||||
|
|
||||||
|
class CalibrateFilamentComboBox : public PlaterPresetComboBox
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrateFilamentComboBox(wxWindow *parent);
|
||||||
|
~CalibrateFilamentComboBox();
|
||||||
|
|
||||||
|
void load_tray(DynamicPrintConfig & config);
|
||||||
|
|
||||||
|
void update() override;
|
||||||
|
void OnSelect(wxCommandEvent &evt) override;
|
||||||
|
const Preset* get_selected_preset() { return m_selected_preset; }
|
||||||
|
bool is_tray_exist() { return m_filament_exist; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string m_tray_name;
|
||||||
|
std::string m_filament_id;
|
||||||
|
std::string m_filament_type;
|
||||||
|
std::string m_filament_color;
|
||||||
|
bool m_filament_exist{false};
|
||||||
|
const Preset* m_selected_preset = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
|
|
@ -2925,7 +2925,7 @@ void SelectMachineDialog::on_selection_changed(wxCommandEvent &event)
|
||||||
obj->command_request_push_all();
|
obj->command_request_push_all();
|
||||||
dev->set_selected_machine(m_printer_last_select, true);
|
dev->set_selected_machine(m_printer_last_select, true);
|
||||||
// Has changed machine unrecoverably
|
// Has changed machine unrecoverably
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj->amsList);
|
GUI::wxGetApp().sidebar().load_ams_list(obj->dev_id, obj);
|
||||||
update_select_layout(obj);
|
update_select_layout(obj);
|
||||||
} else {
|
} else {
|
||||||
BOOST_LOG_TRIVIAL(error) << "on_selection_changed dev_id not found";
|
BOOST_LOG_TRIVIAL(error) << "on_selection_changed dev_id not found";
|
||||||
|
|
|
@ -15,10 +15,17 @@
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
std::shared_ptr<PrintJob> print_job;
|
std::shared_ptr<PrintJob> print_job;
|
||||||
static const std::string temp_dir = "D:/temp/";
|
static const std::string temp_dir = fs::path(fs::temp_directory_path() / "calib").string();
|
||||||
static const std::string temp_gcode_path = temp_dir + "temp.gcode";
|
static const std::string temp_gcode_path = temp_dir + "/temp.gcode";
|
||||||
static const std::string path = temp_dir + "test.3mf";
|
static const std::string path = temp_dir + "/test.3mf";
|
||||||
static const std::string config_3mf_path = temp_dir + "test_config.3mf";
|
static const std::string config_3mf_path = temp_dir + "/test_config.3mf";
|
||||||
|
|
||||||
|
static std::string MachineBedTypeString[BED_TYPE_COUNT] = {
|
||||||
|
//"auto",
|
||||||
|
"pc",
|
||||||
|
"pei",
|
||||||
|
"pe",
|
||||||
|
};
|
||||||
|
|
||||||
static void cut_model(Model &model, std::array<Vec3d, 4> plane_points, ModelObjectCutAttributes attributes)
|
static void cut_model(Model &model, std::array<Vec3d, 4> plane_points, ModelObjectCutAttributes attributes)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +67,140 @@ static void read_model_from_file(const std::string& input_file, Model& model)
|
||||||
object->ensure_on_bed();
|
object->ensure_on_bed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::calib_flowrate(int pass, std::string dev_id, std::string select_ams, std::shared_ptr<ProgressIndicator> process_bar)
|
void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, std::string& error_message)
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CalibDatas pa_datas;
|
||||||
|
for (auto calib_info : calib_infos.calib_infos) {
|
||||||
|
CalibDatas::CalibData pa_calib;
|
||||||
|
pa_calib.tray_id = calib_info.tray_id;
|
||||||
|
pa_calib.setting_id = calib_info.setting_id;
|
||||||
|
pa_calib.bed_temp = calib_info.bed_temp;
|
||||||
|
pa_calib.nozzle_temp = calib_info.nozzle_temp;
|
||||||
|
pa_calib.max_volumetric_speed = calib_info.max_volumetric_speed;
|
||||||
|
|
||||||
|
pa_datas.calib_datas.push_back(pa_calib);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pa_datas.calib_datas.size() > 0)
|
||||||
|
obj_->command_start_pa_calibration(pa_datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibUtils::emit_get_PA_calib_results()
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
obj_->command_get_pa_calibration_result();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CalibUtils::get_PA_calib_results(std::vector<PACalibResult>& pa_calib_results)
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
pa_calib_results = obj_->pa_calib_results;
|
||||||
|
return pa_calib_results.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibUtils::emit_get_PA_calib_infos()
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
obj_->command_get_pa_calibration_infos();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CalibUtils::get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos)
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
pa_calib_infos = obj_->pa_calib_tab;
|
||||||
|
return pa_calib_infos.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibUtils::calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::string& error_message)
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CalibDatas calib_datas;
|
||||||
|
for (auto calib_info : calib_infos.calib_infos) {
|
||||||
|
CalibDatas::CalibData pa_calib;
|
||||||
|
pa_calib.tray_id = calib_info.tray_id;
|
||||||
|
pa_calib.setting_id = calib_info.setting_id;
|
||||||
|
pa_calib.bed_temp = calib_info.bed_temp;
|
||||||
|
pa_calib.nozzle_temp = calib_info.nozzle_temp;
|
||||||
|
pa_calib.max_volumetric_speed = calib_info.max_volumetric_speed;
|
||||||
|
|
||||||
|
calib_datas.calib_datas.push_back(pa_calib);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (calib_datas.calib_datas.size() > 0)
|
||||||
|
obj_->command_start_flow_ratio_calibration(calib_datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibUtils::emit_get_flow_ratio_calib_results()
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
obj_->command_get_flow_ratio_calibration_result();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CalibUtils::get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult>& flow_ratio_calib_results)
|
||||||
|
{
|
||||||
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
MachineObject *obj_ = dev->get_selected_machine();
|
||||||
|
if (obj_ == nullptr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
flow_ratio_calib_results = obj_->flow_ratio_results;
|
||||||
|
return flow_ratio_calib_results.size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibUtils::calib_flowrate(int pass, const CalibInfo& calib_info, std::string& error_message)
|
||||||
{
|
{
|
||||||
if (pass != 1 && pass != 2)
|
if (pass != 1 && pass != 2)
|
||||||
return;
|
return;
|
||||||
|
@ -74,9 +214,9 @@ void CalibUtils::calib_flowrate(int pass, std::string dev_id, std::string select
|
||||||
|
|
||||||
read_model_from_file(input_file, model);
|
read_model_from_file(input_file, model);
|
||||||
|
|
||||||
DynamicConfig print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
DynamicConfig print_config = calib_info.print_prest->config;
|
||||||
DynamicConfig printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config;
|
DynamicConfig filament_config = calib_info.filament_prest->config;
|
||||||
DynamicConfig filament_config = wxGetApp().preset_bundle->filaments.get_edited_preset().config;
|
DynamicConfig printer_config = calib_info.printer_prest->config;
|
||||||
|
|
||||||
/// --- scale ---
|
/// --- scale ---
|
||||||
// model is created for a 0.4 nozzle, scale z with nozzle size.
|
// model is created for a 0.4 nozzle, scale z with nozzle size.
|
||||||
|
@ -144,13 +284,17 @@ void CalibUtils::calib_flowrate(int pass, std::string dev_id, std::string select
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
Calib_Params params;
|
Calib_Params params;
|
||||||
params.mode = CalibMode::Calib_None;
|
params.mode = CalibMode::Calib_Flow_Rate;
|
||||||
process_and_store_3mf(&model, full_config, params);
|
process_and_store_3mf(&model, full_config, params, error_message);
|
||||||
|
if (!error_message.empty())
|
||||||
|
return
|
||||||
|
|
||||||
send_to_print(dev_id, select_ams, process_bar);
|
send_to_print(calib_info.dev_id, calib_info.select_ams, calib_info.process_bar, calib_info.bed_type, error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::calib_temptue(const Calib_Params& params, std::string dev_id, std::string select_ams, std::shared_ptr<ProgressIndicator> process_bar) {
|
void CalibUtils::calib_temptue(const CalibInfo& calib_info, std::string& error_message)
|
||||||
|
{
|
||||||
|
const Calib_Params ¶ms = calib_info.params;
|
||||||
if (params.mode != CalibMode::Calib_Temp_Tower)
|
if (params.mode != CalibMode::Calib_Temp_Tower)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -190,10 +334,9 @@ void CalibUtils::calib_temptue(const Calib_Params& params, std::string dev_id, s
|
||||||
}
|
}
|
||||||
|
|
||||||
// edit preset
|
// edit preset
|
||||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
DynamicPrintConfig print_config = calib_info.print_prest->config;
|
||||||
DynamicPrintConfig print_config = preset_bundle->prints.get_edited_preset().config;
|
DynamicPrintConfig filament_config = calib_info.filament_prest->config;
|
||||||
DynamicPrintConfig filament_config = preset_bundle->filaments.get_edited_preset().config;
|
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
|
||||||
DynamicPrintConfig printer_config = preset_bundle->printers.get_edited_preset().config;
|
|
||||||
|
|
||||||
auto start_temp = lround(params.start);
|
auto start_temp = lround(params.start);
|
||||||
filament_config.set_key_value("nozzle_temperature_initial_layer", new ConfigOptionInts(1, (int) start_temp));
|
filament_config.set_key_value("nozzle_temperature_initial_layer", new ConfigOptionInts(1, (int) start_temp));
|
||||||
|
@ -210,13 +353,16 @@ void CalibUtils::calib_temptue(const Calib_Params& params, std::string dev_id, s
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, params);
|
process_and_store_3mf(&model, full_config, params, error_message);
|
||||||
|
if (!error_message.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
send_to_print(dev_id, select_ams, process_bar);
|
send_to_print(calib_info.dev_id, calib_info.select_ams, calib_info.process_bar, calib_info.bed_type, error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::calib_max_vol_speed(const Calib_Params ¶ms, std::string dev_id, std::string select_ams, std::shared_ptr<ProgressIndicator> process_bar)
|
void CalibUtils::calib_max_vol_speed(const CalibInfo& calib_info, std::string& error_message)
|
||||||
{
|
{
|
||||||
|
const Calib_Params ¶ms = calib_info.params;
|
||||||
if (params.mode != CalibMode::Calib_Vol_speed_Tower)
|
if (params.mode != CalibMode::Calib_Vol_speed_Tower)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -224,14 +370,11 @@ void CalibUtils::calib_max_vol_speed(const Calib_Params ¶ms, std::string dev
|
||||||
std::string input_file = Slic3r::resources_dir() + "/calib/volumetric_speed/SpeedTestStructure.step";
|
std::string input_file = Slic3r::resources_dir() + "/calib/volumetric_speed/SpeedTestStructure.step";
|
||||||
read_model_from_file(input_file, model);
|
read_model_from_file(input_file, model);
|
||||||
|
|
||||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
DynamicPrintConfig print_config = calib_info.print_prest->config;
|
||||||
DynamicPrintConfig print_config = preset_bundle->prints.get_edited_preset().config;
|
DynamicPrintConfig filament_config = calib_info.filament_prest->config;
|
||||||
DynamicPrintConfig filament_config = preset_bundle->filaments.get_edited_preset().config;
|
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
|
||||||
DynamicPrintConfig printer_config = preset_bundle->printers.get_edited_preset().config;
|
|
||||||
|
|
||||||
|
|
||||||
auto obj = model.objects[0];
|
auto obj = model.objects[0];
|
||||||
|
|
||||||
auto bed_shape = printer_config.option<ConfigOptionPoints>("printable_area")->values;
|
auto bed_shape = printer_config.option<ConfigOptionPoints>("printable_area")->values;
|
||||||
BoundingBoxf bed_ext = get_extents(bed_shape);
|
BoundingBoxf bed_ext = get_extents(bed_shape);
|
||||||
auto scale_obj = (bed_ext.size().x() - 10) / obj->bounding_box().size().x();
|
auto scale_obj = (bed_ext.size().x() - 10) / obj->bounding_box().size().x();
|
||||||
|
@ -266,7 +409,7 @@ void CalibUtils::calib_max_vol_speed(const Calib_Params ¶ms, std::string dev
|
||||||
|
|
||||||
// cut upper
|
// cut upper
|
||||||
auto obj_bb = obj->bounding_box();
|
auto obj_bb = obj->bounding_box();
|
||||||
auto height = (params.end - params.start + 1) / params.step;
|
double height = (params.end - params.start + 1) / params.step;
|
||||||
if (height < obj_bb.size().z()) {
|
if (height < obj_bb.size().z()) {
|
||||||
std::array<Vec3d, 4> plane_pts;
|
std::array<Vec3d, 4> plane_pts;
|
||||||
plane_pts[0] = Vec3d(obj_bb.min(0), obj_bb.min(1), height);
|
plane_pts[0] = Vec3d(obj_bb.min(0), obj_bb.min(1), height);
|
||||||
|
@ -288,13 +431,16 @@ void CalibUtils::calib_max_vol_speed(const Calib_Params ¶ms, std::string dev
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, new_params);
|
process_and_store_3mf(&model, full_config, new_params, error_message);
|
||||||
|
if (!error_message.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
send_to_print(dev_id, select_ams, process_bar);
|
send_to_print(calib_info.dev_id, calib_info.select_ams, calib_info.process_bar, calib_info.bed_type, error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::calib_VFA(const Calib_Params& params)
|
void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_message)
|
||||||
{
|
{
|
||||||
|
const Calib_Params ¶ms = calib_info.params;
|
||||||
if (params.mode != CalibMode::Calib_VFA_Tower)
|
if (params.mode != CalibMode::Calib_VFA_Tower)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -302,10 +448,9 @@ void CalibUtils::calib_VFA(const Calib_Params& params)
|
||||||
std::string input_file = Slic3r::resources_dir() + "/calib/vfa/VFA.stl";
|
std::string input_file = Slic3r::resources_dir() + "/calib/vfa/VFA.stl";
|
||||||
read_model_from_file(input_file, model);
|
read_model_from_file(input_file, model);
|
||||||
|
|
||||||
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
|
DynamicPrintConfig print_config = calib_info.print_prest->config;
|
||||||
DynamicPrintConfig print_config = preset_bundle->prints.get_edited_preset().config;
|
DynamicPrintConfig filament_config = calib_info.filament_prest->config;
|
||||||
DynamicPrintConfig filament_config = preset_bundle->filaments.get_edited_preset().config;
|
DynamicPrintConfig printer_config = calib_info.printer_prest->config;
|
||||||
DynamicPrintConfig printer_config = preset_bundle->printers.get_edited_preset().config;
|
|
||||||
|
|
||||||
filament_config.set_key_value("slow_down_layer_time", new ConfigOptionInts{0});
|
filament_config.set_key_value("slow_down_layer_time", new ConfigOptionInts{0});
|
||||||
filament_config.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
|
filament_config.set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats{200});
|
||||||
|
@ -331,6 +476,10 @@ void CalibUtils::calib_VFA(const Calib_Params& params)
|
||||||
plane_pts[3] = Vec3d(obj_bb.min(0), obj_bb.max(1), height);
|
plane_pts[3] = Vec3d(obj_bb.min(0), obj_bb.max(1), height);
|
||||||
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
|
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
error_message = "The start, end or step is not valid value.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DynamicPrintConfig full_config;
|
DynamicPrintConfig full_config;
|
||||||
full_config.apply(FullPrintConfig::defaults());
|
full_config.apply(FullPrintConfig::defaults());
|
||||||
|
@ -338,15 +487,14 @@ void CalibUtils::calib_VFA(const Calib_Params& params)
|
||||||
full_config.apply(filament_config);
|
full_config.apply(filament_config);
|
||||||
full_config.apply(printer_config);
|
full_config.apply(printer_config);
|
||||||
|
|
||||||
process_and_store_3mf(&model, full_config, params);
|
process_and_store_3mf(&model, full_config, params, error_message);
|
||||||
|
if (!error_message.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
std::string dev_id = "00M00A252000001"; // to do: hard code test
|
send_to_print(calib_info.dev_id, calib_info.select_ams, calib_info.process_bar, calib_info.bed_type, error_message);
|
||||||
std::string select_ams = "[0]";
|
|
||||||
std::shared_ptr<ProgressIndicator> process_bar(new BBLStatusBar(wxGetApp().plater()));
|
|
||||||
send_to_print(dev_id, select_ams, process_bar);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &full_config, const Calib_Params ¶ms)
|
void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message)
|
||||||
{
|
{
|
||||||
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
|
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
|
||||||
double print_height = full_config.opt_float("printable_height");
|
double print_height = full_config.opt_float("printable_height");
|
||||||
|
@ -361,8 +509,7 @@ void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
|
||||||
if (model->objects.size() == 1) {
|
if (model->objects.size() == 1) {
|
||||||
ModelInstance *instance = model->objects[0]->instances[0];
|
ModelInstance *instance = model->objects[0]->instances[0];
|
||||||
instance->set_offset(instance->get_offset() + Vec3d(current_width / 2, current_depth / 2, 0));
|
instance->set_offset(instance->get_offset() + Vec3d(current_width / 2, current_depth / 2, 0));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (auto object : model->objects) {
|
for (auto object : model->objects) {
|
||||||
ModelInstance *instance = object->instances[0];
|
ModelInstance *instance = object->instances[0];
|
||||||
instance->set_offset(instance->get_offset() + Vec3d(100, 100, 0));
|
instance->set_offset(instance->get_offset() + Vec3d(100, 100, 0));
|
||||||
|
@ -379,6 +526,13 @@ void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
|
||||||
int print_index;
|
int print_index;
|
||||||
part_plate->get_print(&print, &gcode_result, &print_index);
|
part_plate->get_print(&print, &gcode_result, &print_index);
|
||||||
|
|
||||||
|
BuildVolume build_volume(bedfs, print_height);
|
||||||
|
unsigned int count = model->update_print_volume_state(build_volume);
|
||||||
|
if (count == 0) {
|
||||||
|
error_message = "Nothing to be sliced, either the print is empty or no object is fully inside the print volume before apply.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// apply the new print config
|
// apply the new print config
|
||||||
DynamicPrintConfig new_print_config = std::move(full_config);
|
DynamicPrintConfig new_print_config = std::move(full_config);
|
||||||
print->apply(*model, new_print_config);
|
print->apply(*model, new_print_config);
|
||||||
|
@ -386,6 +540,13 @@ void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
|
||||||
Print *fff_print = dynamic_cast<Print *>(print);
|
Print *fff_print = dynamic_cast<Print *>(print);
|
||||||
fff_print->set_calib_params(params);
|
fff_print->set_calib_params(params);
|
||||||
|
|
||||||
|
StringObjectException warning;
|
||||||
|
auto err = print->validate(&warning);
|
||||||
|
if (!err.string.empty()) {
|
||||||
|
error_message = "slice validate: " + err.string;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fff_print->process();
|
fff_print->process();
|
||||||
part_plate->update_slice_result_valid_state(true);
|
part_plate->update_slice_result_valid_state(true);
|
||||||
|
|
||||||
|
@ -416,15 +577,42 @@ void CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
|
||||||
success = Slic3r::store_bbs_3mf(store_params);
|
success = Slic3r::store_bbs_3mf(store_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::send_to_print(const std::string &dev_id, const std::string &select_ams, std::shared_ptr<ProgressIndicator> process_bar)
|
void CalibUtils::send_to_print(const std::string& dev_id, const std::string& select_ams, std::shared_ptr<ProgressIndicator> process_bar, BedType bed_type, std::string& error_message)
|
||||||
{
|
{
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev)
|
if (!dev) {
|
||||||
|
error_message = "Need select printer";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MachineObject* obj_ = dev->get_selected_machine();
|
MachineObject* obj_ = dev->get_selected_machine();
|
||||||
if (obj_ == nullptr)
|
if (obj_ == nullptr) {
|
||||||
|
error_message = "Need select printer";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj_->is_in_printing()) {
|
||||||
|
error_message = "Cannot send the print job when the printer is updating firmware";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (obj_->is_system_printing()) {
|
||||||
|
error_message = "The printer is executing instructions. Please restart printing after it ends";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (obj_->is_in_printing()) {
|
||||||
|
error_message = "The printer is busy on other print job";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD) && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) {
|
||||||
|
error_message = "An SD card needs to be inserted before printing.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (obj_->is_lan_mode_printer()) {
|
||||||
|
if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
|
||||||
|
error_message = "An SD card needs to be inserted before printing via LAN.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_job = std::make_shared<PrintJob>(std::move(process_bar), wxGetApp().plater(), dev_id);
|
print_job = std::make_shared<PrintJob>(std::move(process_bar), wxGetApp().plater(), dev_id);
|
||||||
print_job->m_dev_ip = obj_->dev_ip;
|
print_job->m_dev_ip = obj_->dev_ip;
|
||||||
|
@ -447,23 +635,27 @@ void CalibUtils::send_to_print(const std::string &dev_id, const std::string &sel
|
||||||
plate_data.is_valid = true;
|
plate_data.is_valid = true;
|
||||||
plate_data.plate_count = 1;
|
plate_data.plate_count = 1;
|
||||||
plate_data.cur_plate_index = 0;
|
plate_data.cur_plate_index = 0;
|
||||||
plate_data.bed_type = BedType::btPC;
|
plate_data.bed_type = bed_type;
|
||||||
|
|
||||||
print_job->job_data = job_data;
|
print_job->job_data = job_data;
|
||||||
print_job->plate_data = plate_data;
|
print_job->plate_data = plate_data;
|
||||||
|
|
||||||
if (!obj_->is_support_ams_mapping())
|
if (!obj_->is_support_ams_mapping()) {
|
||||||
|
error_message = "It is not support ams mapping.";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!obj_->has_ams())
|
if (!obj_->has_ams()) {
|
||||||
|
error_message = "There is no ams.";
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
print_job->task_ams_mapping = select_ams;
|
print_job->task_ams_mapping = select_ams;
|
||||||
print_job->task_ams_mapping_info = "";
|
print_job->task_ams_mapping_info = "";
|
||||||
print_job->task_use_ams = true;
|
print_job->task_use_ams = true;
|
||||||
|
|
||||||
print_job->has_sdcard = obj_->has_sdcard();
|
print_job->has_sdcard = obj_->has_sdcard();
|
||||||
print_job->set_print_config("pc", true, false, false, false, true);
|
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true);
|
||||||
|
|
||||||
print_job->start();
|
print_job->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,65 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "libslic3r/Calib.hpp"
|
#include "libslic3r/Calib.hpp"
|
||||||
|
#include "../GUI/DeviceManager.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class ProgressIndicator;
|
class ProgressIndicator;
|
||||||
|
class Preset;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
class X1CCalibInfos
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
struct X1CCalibInfo
|
||||||
|
{
|
||||||
|
int tray_id;
|
||||||
|
std::string setting_id;
|
||||||
|
int bed_temp;
|
||||||
|
int nozzle_temp;
|
||||||
|
float max_volumetric_speed;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<X1CCalibInfo> calib_infos;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Calib_Params params;
|
||||||
|
Preset* printer_prest;
|
||||||
|
Preset* filament_prest;
|
||||||
|
Preset* print_prest;
|
||||||
|
BedType bed_type;
|
||||||
|
std::string dev_id;
|
||||||
|
std::string select_ams;
|
||||||
|
std::shared_ptr<ProgressIndicator> process_bar;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class CalibUtils
|
class CalibUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CalibUtils(){};
|
CalibUtils(){};
|
||||||
static void calib_flowrate(int pass, std::string dev_id, std::string select_ams, std::shared_ptr<ProgressIndicator> process_bar);
|
static void calib_PA(const X1CCalibInfos& calib_infos, std::string& error_message);
|
||||||
static void calib_temptue(const Calib_Params ¶ms, std::string dev_id, std::string select_ams, std::shared_ptr<ProgressIndicator> process_bar);
|
static void emit_get_PA_calib_results();
|
||||||
static void calib_max_vol_speed(const Calib_Params ¶ms, std::string dev_id, std::string select_ams, std::shared_ptr<ProgressIndicator> process_bar);
|
static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results);
|
||||||
static void calib_VFA(const Calib_Params ¶ms);
|
static void emit_get_PA_calib_infos();
|
||||||
|
static bool get_PA_calib_tab(std::vector<PACalibResult> &pa_calib_infos);
|
||||||
|
|
||||||
|
static void calib_flowrate_X1C(const X1CCalibInfos& calib_infos, std::string& error_message);
|
||||||
|
static void emit_get_flow_ratio_calib_results();
|
||||||
|
static bool get_flow_ratio_calib_results(std::vector<FlowRatioCalibResult> &flow_ratio_calib_results);
|
||||||
|
static void calib_flowrate(int pass, const CalibInfo& calib_info, std::string& error_message);
|
||||||
|
|
||||||
|
static void calib_temptue(const CalibInfo& calib_info, std::string& error_message);
|
||||||
|
static void calib_max_vol_speed(const CalibInfo& calib_info, std::string& error_message);
|
||||||
|
static void calib_VFA(const CalibInfo& calib_info, std::string& error_message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void process_and_store_3mf(Model *model, const DynamicPrintConfig &full_config, const Calib_Params ¶ms);
|
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message);
|
||||||
static void send_to_print(const std::string &dev_id, const std::string &select_ams, std::shared_ptr<ProgressIndicator> process_bar);
|
static void send_to_print(const std::string& dev_id, const std::string& select_ams, std::shared_ptr<ProgressIndicator> process_bar, BedType bed_type, std::string& error_message);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue