update slic3r

This commit is contained in:
QIDI TECH
2025-05-08 15:05:30 +08:00
parent 126534997a
commit 011619cf23
307 changed files with 55594 additions and 19386 deletions

View File

@@ -31,6 +31,11 @@
//w29
#include "libslic3r/GCodeWriter.hpp"
//y61
#if QDT_RELEASE_TO_PUBLIC
#include "../QIDI/QIDINetwork.hpp"
#endif
#define FILAMENT_SYSTEM_COLORS_NUM 16
class wxButton;
@@ -56,7 +61,9 @@ class SlicingStatusEvent;
enum SLAPrintObjectStep : unsigned int;
enum class ConversionType : int;
class Ams;
namespace csg {
enum class BooleanFailReason;
}
using ModelInstancePtrs = std::vector<ModelInstance*>;
@@ -67,7 +74,8 @@ namespace UndoRedo {
}
namespace GUI {
class SyncAmsInfoDialog;
class SyncBoxInfoDialog;
class MainFrame;
class ConfigOptionsGroup;
class ObjectSettings;
@@ -81,7 +89,9 @@ struct Camera;
class GLToolbar;
class PlaterPresetComboBox;
class PartPlateList;
class SyncNozzleAndAmsDialog;
class FinishSyncAmsDialog;
class FinishSyncBoxDialog;
using t_optgroups = std::vector <std::shared_ptr<ConfigOptionsGroup>>;
class Plater;
@@ -94,6 +104,11 @@ enum class ActionButtonType : int;
wxDECLARE_EVENT(EVT_SLICING_UPDATE, Slic3r::SlicingStatusEvent);
wxDECLARE_EVENT(EVT_PUBLISH, wxCommandEvent);
wxDECLARE_EVENT(EVT_OPEN_PLATESETTINGSDIALOG, wxCommandEvent);
// Explanation of int param
// Bit 0: 1 = automatic mode, 0 = manual mode.
// Bit 1: 1 = need auto slicing(from preview page), 0 = not need auto slicing.
wxDECLARE_EVENT(EVT_OPEN_FILAMENT_MAP_SETTINGS_DIALOG, wxCommandEvent);
wxDECLARE_EVENT(EVT_REPAIR_MODEL, wxCommandEvent);
wxDECLARE_EVENT(EVT_FILAMENT_COLOR_CHANGED, wxCommandEvent);
wxDECLARE_EVENT(EVT_INSTALL_PLUGIN_NETWORKING, wxCommandEvent);
@@ -106,13 +121,42 @@ wxDECLARE_EVENT(EVT_CREATE_FILAMENT, SimpleEvent);
wxDECLARE_EVENT(EVT_MODIFY_FILAMENT, SimpleEvent);
wxDECLARE_EVENT(EVT_ADD_FILAMENT, SimpleEvent);
wxDECLARE_EVENT(EVT_DEL_FILAMENT, SimpleEvent);
wxDECLARE_EVENT(EVT_NOTICE_CHILDE_SIZE_CHANGED, SimpleEvent);
wxDECLARE_EVENT(EVT_NOTICE_FULL_SCREEN_CHANGED, IntEvent);
using ColorEvent = Event<wxColour>;
wxDECLARE_EVENT(EVT_ADD_CUSTOM_FILAMENT, ColorEvent);
const wxString DEFAULT_PROJECT_NAME = "Untitled";
//y59
struct Box_msg {
std::vector<int> slot_state;
std::vector<int> slot_id;
std::vector<std::string> filament_id;
std::vector<std::string> filament_colors;
std::vector<std::string> filament_type;
std::string box_list_preset_name;
int box_count = 0;
int auto_reload_detect = 0;
};
class Sidebar : public wxPanel
{
{
ConfigOptionMode m_mode;
Button * btn_sync{nullptr};
ScalableButton * ams_btn{nullptr};
bool m_last_slice_state = false;
SyncNozzleAndAmsDialog* m_sna_dialog{nullptr};
FinishSyncBoxDialog* m_fna_dialog{nullptr};
std::vector<BedType> m_cur_combox_bed_types;
std::string m_cur_image_bed_type;
int m_last_combo_bedtype_count{0};
bool m_begin_sync_printer_status{false};
SyncAmsInfoDialog* m_sync_dlg{nullptr};
//y59
SyncBoxInfoDialog* m_sync_box_dlg{nullptr};
void update_sync_ams_btn_enable(wxUpdateUIEvent &e);
public:
Sidebar(Plater *parent);
Sidebar(Sidebar &&) = delete;
@@ -121,6 +165,9 @@ public:
Sidebar &operator=(const Sidebar &) = delete;
~Sidebar();
void on_enter_image_printer_bed(wxMouseEvent &evt);
void on_leave_image_printer_bed(wxMouseEvent &evt);
void on_change_color_mode(bool is_dark);
void create_printer_preset();
void init_filament_combo(PlaterPresetComboBox **combo, const int filament_idx);
void remove_unused_filament_combos(const size_t current_extruder_count);
@@ -132,6 +179,10 @@ public:
void update_presets_from_to(Slic3r::Preset::Type preset_type, std::string from, std::string to);
bool set_bed_type(const std::string& bed_type_name);
void save_bed_type_to_config(const std::string &bed_type_name);
BedType get_cur_select_bed_type();
std::string get_cur_select_bed_image();
void set_bed_type_accord_combox(BedType bed_type);
bool reset_bed_type_combox_choices();
bool use_default_bed_type(bool is_qdt_preset = true);
void change_top_border_for_mode_sizer(bool increase_border);
void msw_rescale();
@@ -139,27 +190,45 @@ public:
void search();
void jump_to_option(size_t selected);
void jump_to_option(const std::string& opt_key, Preset::Type type, const std::wstring& category);
void jump_to_option(const std::string& composite_key);
// QDS. Add on_filaments_change() method.
void on_filaments_change(size_t num_filaments);
// QDS. Add filament_added() method.
void on_filament_count_change(size_t num_filaments);
void on_filaments_delete(size_t filament_id);
void add_filament();
void delete_filament();
void delete_filament(size_t filament_id = size_t(-1), int replace_filament_id = -1); // 0 base, -1 means default
void change_filament(size_t from_id, size_t to_id); // 0 base
void edit_filament();
void add_custom_filament(wxColour new_col);
bool is_new_project_in_gcode3mf();
// QDS
void on_bed_type_change(BedType bed_type);
void load_ams_list(std::string const & device, MachineObject* obj);
std::map<int, DynamicPrintConfig> build_filament_ams_list(MachineObject* obj);
void sync_ams_list();
void sync_ams_list(bool is_from_big_sync_btn = false);
bool sync_extruder_list();
bool need_auto_sync_extruder_list_after_connect_priner(const MachineObject* obj);
void update_sync_status(const MachineObject* obj);
int get_sidebar_pos_right_x();
void on_size(SimpleEvent &e);
void on_full_screen(IntEvent &);
void get_big_btn_sync_pos_size(wxPoint &pt, wxSize &size);
void get_small_btn_sync_pos_size(wxPoint &pt, wxSize &size);
//w42
//w42 //y59
int box_count;
std::vector<std::string> box_filament_id;
std::vector<std::string> box_filment_colors;
std::vector<std::string> box_filament_colors;
std::vector<std::string> filament_type;
std::vector<int> box_slot_state;
std::vector<int> box_slot_id;
std::string box_list_preset_name;
std::string box_list_printer_ip;
void sync_box_list();
void load_box_list(std::vector<std::string> id, std::vector<std::string> color);
std::map<int, DynamicPrintConfig> build_filament_box_list(std::vector<std::string> id, std::vector<std::string> color, std::vector<int> slot_state);
void load_box_list();
std::map<int, DynamicPrintConfig> build_filament_box_list(std::vector<std::string> id, std::vector<std::string> color, std::vector<int> slot_state, std::vector<int> slot_id, std::vector<std::string> type);
void updata_filament_list();
PlaterPresetComboBox * printer_combox();
ObjectList* obj_list();
ObjectSettings* obj_settings();
ObjectLayers* obj_layers();
@@ -180,6 +249,9 @@ public:
bool show_export_removable(bool show) const;
bool get_eject_shown() const;
bool is_multifilament();
void deal_btn_sync();
void pop_sync_nozzle_and_ams_dialog();
void pop_finsish_sync_ams_dialog();
void update_mode();
bool is_collapsed();
void collapse(bool collapse);
@@ -187,7 +259,13 @@ public:
void update_ui_from_settings();
bool show_object_list(bool show) const;
void finish_param_edit();
void auto_calc_flushing_volumes(const int modify_id);
/**
* @brief Automatically calculates flushing volumes
* @param filament_idx Specifies the filament index to calculate. -1 indicates all filament indices.
* @param extruder_id Specifies the extruder id to calculate. -1 indicates all extruders indices.
*/
void auto_calc_flushing_volumes(const int filament_idx = -1, const int extruder_id = -1);
void jump_to_object(ObjectDataViewModelNode* item);
void can_search();
#ifdef _MSW_DARK_MODE
@@ -195,23 +273,31 @@ public:
#endif
std::vector<PlaterPresetComboBox*>& combos_filament();
void clear_combos_filament_badge();
void udpate_combos_filament_badge();
Search::OptionsSearcher& get_searcher();
std::string& get_search_line();
void set_is_gcode_file(bool flag);
void update_soft_first_start_state() { m_soft_first_start = false; }
void cancel_update_3d_state() { m_update_3d_state = false; }
bool get_update_3d_state() { return m_update_3d_state; }
void update_printer_thumbnail();
bool need_auto_sync_after_connect_printer() const { return m_need_auto_sync_after_connect_printer; }
void set_need_auto_sync_after_connect_printer(bool need_auto_sync) { m_need_auto_sync_after_connect_printer = need_auto_sync; }
private:
void auto_calc_flushing_volumes_internal(const int filament_id, const int extruder_id);
private:
struct priv;
std::unique_ptr<priv> p;
wxBoxSizer* m_scrolled_sizer = nullptr;
ComboBox* m_bed_type_list = nullptr;
ScalableButton* connection_btn = nullptr;
ScalableButton* ams_btn = nullptr;
bool m_soft_first_start {true };
bool m_is_gcode_file{ false };
bool m_update_3d_state{false};
bool m_need_auto_sync_after_connect_printer{false};
//w42
ScalableButton* fila_sync_btn = nullptr;
@@ -243,6 +329,8 @@ public:
void render_project_state_debug_window() const;
#endif // ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
bool try_sync_preset_with_connected_printer(int &nozzle_diameter);
Sidebar& sidebar();
const Model& model() const;
Model& model();
@@ -251,11 +339,12 @@ public:
const SLAPrint& sla_print() const;
SLAPrint& sla_print();
void reset_flags_when_new_or_close_project();
//w29
std::string double_to_str(const double value);
int new_project(bool skip_confirm = false, bool silent = false, const wxString &project_name = wxString());
// QDS: save & backup
void load_project(wxString const & filename = "", wxString const & originfile = "-");
int load_project(wxString const & filename = "", wxString const & originfile = "-");
int save_project(bool saveAs = false);
//QDS download project by project id
void import_model_id(wxString download_info);
@@ -284,6 +373,7 @@ public:
void calib_max_vol_speed(const Calib_Params &params);
void calib_retraction(const Calib_Params &params);
void calib_VFA(const Calib_Params &params);
//w29
std::string move_to(const Vec2d& point, double speed, double retract_length, double retract_speed, double height, double retract_lift);
std::string move_to(const Vec2d& point, double speed, double retract_length, double retract_speed);
@@ -293,6 +383,7 @@ public:
//QDS: add only gcode mode
bool is_gcode_3mf() { return m_exported_file; }
bool only_gcode_mode() { return m_only_gcode; }
void set_only_gcode(bool only_gcode) { m_only_gcode = only_gcode; }
@@ -301,10 +392,12 @@ public:
void set_using_exported_file(bool exported_file) {
m_exported_file = exported_file;
}
bool is_empty_project();
bool is_multi_extruder_ams_empty();
// QDS
wxString get_project_name();
void update_all_plate_thumbnails(bool force_update = false);
void update_obj_preview_thumbnail(ModelObject *, int obj_idx, int vol_idx, std::vector<std::array<float, 4>> colors, int camera_view_angle_type);
void invalid_all_plate_thumbnails();
void force_update_all_plate_thumbnails();
@@ -392,12 +485,17 @@ public:
void send_to_printer(bool isall = false);
void export_gcode(bool prefer_removable);
//y58
void export_gcode(const boost::filesystem::path& output_path);
void export_gcode_3mf(bool export_all = false);
void send_gcode_finish(wxString name);
//y
void send_gcode_to_printer();
void send_gcode_to_printers();
void export_core_3mf();
static TriangleMesh combine_mesh_fff(const ModelObject& mo, int instance_id, std::function<void(const std::string&)> notify_func = {});
void export_stl(bool extended = false, bool selection_only = false, bool multi_stls = false);
@@ -441,6 +539,7 @@ public:
void send_job_finished(wxCommandEvent& evt);
void publish_job_finished(wxCommandEvent& evt);
void open_platesettings_dialog(wxCommandEvent& evt);
void open_filament_map_setting_dialog(wxCommandEvent &evt);
void on_change_color_mode(SimpleEvent& evt);
void eject_drive();
@@ -465,7 +564,10 @@ public:
// QDS: return false if not changed
bool leave_gizmos_stack();
void on_filaments_change(size_t extruders_count);
void on_filament_change(size_t filament_idx);
void on_filament_count_change(size_t extruders_count);
void on_filaments_delete(size_t extruders_count, size_t filament_id, int replace_filament_id = -1);
std::vector<std::array<float, 4>> get_extruders_colors();
// QDS
void on_bed_type_change(BedType bed_type,bool is_gcode_file = false);
bool update_filament_colors_in_full_config();
@@ -478,7 +580,24 @@ public:
std::vector<std::string> get_extruder_colors_from_plater_config(const GCodeProcessorResult* const result = nullptr) const;
std::vector<std::string> get_colors_for_color_print(const GCodeProcessorResult* const result = nullptr) const;
void set_global_filament_map_mode(FilamentMapMode mode);
void set_global_filament_map(const std::vector<int>& filament_map);
std::vector<int> get_global_filament_map() const;
FilamentMapMode get_global_filament_map_mode() const;
void update_menus();
wxString get_selected_printer_name_in_combox();
enum class PrinterWarningType {
NOT_CONNECTED,
INCONSISTENT,
UNINSTALL_FILAMENT,
EMPTY_FILAMENT
};
void pop_warning_and_go_to_device_page(wxString printer_name, PrinterWarningType type, const wxString &title);
bool check_printer_initialized(MachineObject *obj, bool only_warning = false);
bool is_same_printer_for_connected_and_selected();
bool is_printer_configed_by_QDT();
// QDS
//void show_action_buttons(const bool is_ready_to_slice) const;
@@ -593,6 +712,8 @@ public:
const Camera& get_camera() const;
Camera& get_camera();
const Camera& get_picking_camera() const;
Camera& get_picking_camera();
//QDS: partplate list related functions
PartPlateList& get_partplate_list();
@@ -619,6 +740,13 @@ public:
bool show_publish_dialog(bool show = true);
//QDS: post process string object exception strings by warning types
void post_process_string_object_exception(StringObjectException &err);
void update_objects_position_when_select_preset(const std::function<void()> &select_prest);
bool check_ams_status(bool is_slice_all);
// only check sync status and printer model id
bool get_machine_sync_status();
void update_machine_sync_status();
#if ENABLE_ENVIRONMENT_MAP
void init_environment_texture();
@@ -648,9 +776,11 @@ public:
const Mouse3DController& get_mouse3d_controller() const;
Mouse3DController& get_mouse3d_controller();
//QDS: update when switch muilti_extruder printer
void update_flush_volume_matrix(size_t old_nozzle_size, size_t new_nozzle_size);
//QDS: add bed exclude area
void set_bed_shape() const;
void set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false) const;
void set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, std::vector<Pointfs> extruder_areas, std::vector<double> extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false) const;
const NotificationManager* get_notification_manager() const;
NotificationManager* get_notification_manager();
@@ -773,6 +903,7 @@ public:
wxMenu* layer_menu();
wxMenu* multi_selection_menu();
wxMenu* assemble_multi_selection_menu();
wxMenu* filament_action_menu(int active_filament_menu_id);
int GetPlateIndexByRightMenuInLeftUI();
void SetPlateIndexByRightMenuInLeftUI(int);
static bool has_illegal_filename_characters(const wxString& name);
@@ -787,8 +918,23 @@ public:
return m_arrange_running.compare_exchange_strong(prevRunning, true);
};
std::atomic<bool> m_arrange_running{false};
void reset_check_status() { m_check_status = 0; }
//y
void resetUploadCount();
//y58
int getUploadCount();
void setUploadCount(int uploadcount);
int getInterval();
void setInterval(int interval);
//y59
Box_msg box_msg;
//y61
#if QDT_RELEASE_TO_PUBLIC
GUI::Box_info current_box_info;
GUI::Box_info get_cur_box_info() { return current_box_info; };
#endif
private:
struct priv;
@@ -802,12 +948,13 @@ private:
wxString m_last_loaded_gcode;
//QDS: add only gcode mode
bool m_only_gcode { false };
bool m_only_gcode { false };//just for .gcode file not for .gcode.3mf
bool m_exported_file { false };
bool skip_thumbnail_invalid { false };
bool m_loading_project {false };
std::string m_preview_only_filename;
int m_valid_plates_count { 0 };
int m_check_status = 0; // 0 not check, 1 check success, 2 check failed
void suppress_snapshots();
void allow_snapshots();
@@ -823,6 +970,7 @@ private:
void _calib_pa_tower(const Calib_Params &params);
void _calib_pa_select_added_objects();
void on_filament_map_mode_change();
friend class SuppressBackgroundProcessingUpdate;
//y
std::thread m_sendThread;
@@ -841,8 +989,13 @@ private:
bool m_was_scheduled;
};
std::vector<int> get_min_flush_volumes(const DynamicPrintConfig& full_config);
std::string check_boolean_possible(const std::vector<const ModelVolume*>& volumes);
std::vector<int> get_min_flush_volumes(const DynamicPrintConfig &full_config, size_t nozzle_id);
std::string check_boolean_possible(const std::vector<const ModelVolume *> &volumes, csg::BooleanFailReason& fail_reason);
Preset *get_printer_preset(MachineObject *obj);
wxArrayString get_all_camera_view_type();
} // namespace GUI
} // namespace Slic3r