mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-25 00:58:35 -07:00
ENH: support extension tool; support check extension tool
JIRA: [STUDIO-14122] [STUDIO-14162] Change-Id: I147d335420fcc7c9a190f570863e38e138cdadcf (cherry picked from commit db83b9fb6c6399d917b27b74cc573d668737c705)
This commit is contained in:
parent
b5b64265b2
commit
fedcfc4ea5
10 changed files with 170 additions and 0 deletions
|
|
@ -8,6 +8,8 @@ src/slic3r/GUI/DeviceCore/DevConfigUtil.cpp
|
|||
src/slic3r/GUI/DeviceCore/DevCtrl.h
|
||||
src/slic3r/GUI/DeviceCore/DevCtrl.cpp
|
||||
src/slic3r/GUI/DeviceCore/DevDefs.h
|
||||
src/slic3r/GUI/DeviceCore/DevExtensionTool.h
|
||||
src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp
|
||||
src/slic3r/GUI/DeviceCore/DevExtruderSystem.h
|
||||
src/slic3r/GUI/DeviceCore/DevExtruderSystem.cpp
|
||||
src/slic3r/GUI/DeviceCore/DevExtruderSystemCtrl.cpp
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ list(APPEND SLIC3R_GUI_SOURCES
|
|||
GUI/DeviceCore/DevCtrl.h
|
||||
GUI/DeviceCore/DevCtrl.cpp
|
||||
GUI/DeviceCore/DevDefs.h
|
||||
GUI/DeviceCore/DevExtensionTool.h
|
||||
GUI/DeviceCore/DevExtensionTool.cpp
|
||||
GUI/DeviceCore/DevExtruderSystem.h
|
||||
GUI/DeviceCore/DevExtruderSystem.cpp
|
||||
GUI/DeviceCore/DevExtruderSystemCtrl.cpp
|
||||
|
|
|
|||
39
src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp
Normal file
39
src/slic3r/GUI/DeviceCore/DevExtensionTool.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "DevExtensionTool.h"
|
||||
#include "DevUtil.h"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using namespace nlohmann;
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
DevExtensionTool::DevExtensionTool(MachineObject* obj) : m_owner(obj)
|
||||
{
|
||||
m_mount_3dp = MOUNT_NOT_MOUNTED;
|
||||
m_calib = CALIB_NONE;
|
||||
m_tool_type = TOOL_TYPE_EMPTY;
|
||||
}
|
||||
|
||||
void DevExtensionToolParser::ParseV2_0(const nlohmann::json& extension_tool_json, std::weak_ptr<DevExtensionTool> extension_tool)
|
||||
{
|
||||
if (auto ext_tool = extension_tool.lock())
|
||||
{
|
||||
DevJsonValParser::ParseVal(extension_tool_json, "mount_3d", ext_tool->m_mount_3dp, ext_tool->m_mount_3dp);
|
||||
DevJsonValParser::ParseVal(extension_tool_json, "calib", ext_tool->m_calib, ext_tool->m_calib);
|
||||
|
||||
{
|
||||
const std::string& type_str = DevJsonValParser::GetVal<std::string>(extension_tool_json, "type", "");
|
||||
static std::map<std::string, DevExtensionTool::ToolType> s_type_map = {
|
||||
{"CP00", DevExtensionTool::TOOL_TYPE_CUT_CP00},
|
||||
{"LB00", DevExtensionTool::TOOL_TYPE_LASER_LB00},
|
||||
{"F000", DevExtensionTool::TOOL_TYPE_FAN_F000}
|
||||
};
|
||||
|
||||
auto iter = s_type_map.find(type_str);
|
||||
iter != s_type_map.end() ? ext_tool->m_tool_type = iter->second : DevExtensionTool::TOOL_TYPE_EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
67
src/slic3r/GUI/DeviceCore/DevExtensionTool.h
Normal file
67
src/slic3r/GUI/DeviceCore/DevExtensionTool.h
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#pragma once
|
||||
#include <optional>
|
||||
#include "libslic3r/CommonDefs.hpp"
|
||||
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include <wx/string.h>
|
||||
|
||||
#include "DevDefs.h"
|
||||
|
||||
namespace Slic3r
|
||||
{
|
||||
|
||||
//Previous definitions
|
||||
class MachineObject;
|
||||
|
||||
// some extension tools for toolheads
|
||||
class DevExtensionTool
|
||||
{
|
||||
friend class DevExtensionToolParser;
|
||||
public:
|
||||
static std::shared_ptr<DevExtensionTool> Create(MachineObject* obj) { return std::shared_ptr<DevExtensionTool>(new DevExtensionTool(obj)); }
|
||||
|
||||
public:
|
||||
// tool type
|
||||
bool IsToolTypeFanF000() const { return m_tool_type == TOOL_TYPE_FAN_F000; }
|
||||
|
||||
// mount state
|
||||
bool IsMounted() const { return m_mount_3dp == MOUNT_MOUNTED; }
|
||||
|
||||
protected:
|
||||
DevExtensionTool(MachineObject* obj);
|
||||
|
||||
private:
|
||||
MachineObject* m_owner = nullptr;
|
||||
|
||||
enum MountState
|
||||
{
|
||||
MOUNT_NOT_MOUNTED = 0,
|
||||
MOUNT_MOUNTED = 1,
|
||||
MOUNT_NO_MODULE = 2,
|
||||
MOUNT_NO_CABLE = 3
|
||||
} m_mount_3dp;
|
||||
|
||||
enum CalibState
|
||||
{
|
||||
CALIB_NONE = 0,
|
||||
CALIB_FIRST = 1,
|
||||
CALIB_MOUNT = 2
|
||||
} m_calib;
|
||||
|
||||
enum ToolType
|
||||
{
|
||||
TOOL_TYPE_EMPTY = 0,
|
||||
TOOL_TYPE_CUT_CP00 = 1,
|
||||
TOOL_TYPE_LASER_LB00 = 2,
|
||||
TOOL_TYPE_FAN_F000 = 3,
|
||||
} m_tool_type;
|
||||
};
|
||||
|
||||
|
||||
class DevExtensionToolParser
|
||||
{
|
||||
public:
|
||||
static void ParseV2_0(const nlohmann::json& extension_tool_json, std::weak_ptr<DevExtensionTool> extension_tool);
|
||||
};
|
||||
|
||||
};
|
||||
|
|
@ -37,6 +37,22 @@ public:
|
|||
class DevJsonValParser
|
||||
{
|
||||
public:
|
||||
template<typename T>
|
||||
static T GetVal(const nlohmann::json& j, const std::string& key, const T& default_val = T())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (j.contains(key)) { return j[key].get<T>(); }
|
||||
}
|
||||
catch (const nlohmann::json::exception& e)
|
||||
{
|
||||
assert(0 && __FUNCTION__);
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": " << e.what();
|
||||
}
|
||||
|
||||
return default_val;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void ParseVal(const nlohmann::json& j, const std::string& key, T& val)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "fast_float/fast_float.h"
|
||||
|
||||
#include "DeviceCore/DevFilaSystem.h"
|
||||
#include "DeviceCore/DevExtensionTool.h"
|
||||
#include "DeviceCore/DevExtruderSystem.h"
|
||||
#include "DeviceCore/DevNozzleSystem.h"
|
||||
#include "DeviceCore/DevBed.h"
|
||||
|
|
@ -530,6 +531,7 @@ MachineObject::MachineObject(DeviceManager* manager, NetworkAgent* agent, std::s
|
|||
m_bed = new DevBed(this);
|
||||
m_storage = new DevStorage(this);
|
||||
m_extder_system = new DevExtderSystem(this);
|
||||
m_extension_tool = DevExtensionTool::Create(this);
|
||||
m_nozzle_system = new DevNozzleSystem(this);
|
||||
m_fila_system = new DevFilaSystem(this);
|
||||
m_hms_system = new DevHMS(this);
|
||||
|
|
@ -4972,6 +4974,7 @@ void MachineObject::parse_new_info(json print)
|
|||
|
||||
if (device.contains("nozzle")) { DevNozzleSystemParser::ParseV2_0(device["nozzle"], m_nozzle_system); }
|
||||
if (device.contains("extruder")) { ExtderSystemParser::ParseV2_0(device["extruder"], m_extder_system);}
|
||||
if (device.contains("ext_tool")) { DevExtensionToolParser::ParseV2_0(device["ext_tool"], m_extension_tool); }
|
||||
|
||||
if (device.contains("ctc")) {
|
||||
json const& ctc = device["ctc"];
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class DevAmsTray;
|
|||
class DevBed;
|
||||
class DevConfig;
|
||||
class DevCtrl;
|
||||
class DevExtensionTool;
|
||||
class DevExtderSystem;
|
||||
class DevFan;
|
||||
class DevFilaSystem;
|
||||
|
|
@ -110,6 +111,7 @@ private:
|
|||
|
||||
/*parts*/
|
||||
DevLamp* m_lamp;
|
||||
std::shared_ptr<DevExtensionTool> m_extension_tool;
|
||||
DevExtderSystem* m_extder_system;
|
||||
DevNozzleSystem* m_nozzle_system;
|
||||
DevFilaSystem* m_fila_system;
|
||||
|
|
@ -318,6 +320,8 @@ public:
|
|||
|
||||
/* parts */
|
||||
DevExtderSystem* GetExtderSystem() const { return m_extder_system; }
|
||||
std::weak_ptr<DevExtensionTool> GetExtensionTool() const { return m_extension_tool; }
|
||||
|
||||
DevNozzleSystem* GetNozzleSystem() const { return m_nozzle_system;}
|
||||
|
||||
DevFilaSystem* GetFilaSystem() const { return m_fila_system;}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ enum PrintDialogStatus : unsigned int {
|
|||
PrintStatusTimelapseNoSdcard,
|
||||
PrintStatusTimelapseWarning,
|
||||
PrintStatusMixAmsAndVtSlotWarning,
|
||||
PrintStatusToolHeadCoolingFanWarning,
|
||||
PrintStatusPrinterWarningEnd,
|
||||
|
||||
// Warnings for filament
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "DeviceCore/DevConfig.h"
|
||||
#include "DeviceCore/DevNozzleSystem.h"
|
||||
#include "DeviceCore/DevExtensionTool.h"
|
||||
#include "DeviceCore/DevExtruderSystem.h"
|
||||
#include "DeviceCore/DevFilaBlackList.h"
|
||||
#include "DeviceCore/DevFilaSystem.h"
|
||||
|
|
@ -1676,6 +1677,9 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
|
|||
msg = msg_text;
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
} else if (status == PrintStatusToolHeadCoolingFanWarning) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
} else if (status == PrintStatusMixAmsAndVtSlotWarning) {
|
||||
Enable_Refresh_Button(true);
|
||||
Enable_Send_Button(true);
|
||||
|
|
@ -3587,6 +3591,9 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
|
|||
}
|
||||
}
|
||||
|
||||
// check extension tool warning
|
||||
UpdateStatusCheckWarning_ExtensionTool(obj_);
|
||||
|
||||
/** normal check **/
|
||||
show_status(PrintDialogStatus::PrintStatusReadyToGo);
|
||||
}
|
||||
|
|
@ -4575,6 +4582,32 @@ SelectMachineDialog::~SelectMachineDialog()
|
|||
delete m_refresh_timer;
|
||||
}
|
||||
|
||||
void SelectMachineDialog::UpdateStatusCheckWarning_ExtensionTool(MachineObject* obj_)
|
||||
{
|
||||
if (!obj_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto extension_tool = obj_->GetExtensionTool().lock())
|
||||
{
|
||||
if (extension_tool->IsToolTypeFanF000() && !extension_tool->IsMounted() )
|
||||
{
|
||||
for (const FilamentInfo& item : m_ams_mapping_result)
|
||||
{
|
||||
auto filament_info = wxGetApp().preset_bundle->get_filament_by_filament_id(item.filament_id);
|
||||
if (filament_info && (filament_info->temperature_vitrification <= 50))
|
||||
{
|
||||
show_status(PrintDialogStatus::PrintStatusToolHeadCoolingFanWarning,
|
||||
{ _L("Install toolhead enhanced cooling fan to prevent filament softening.")},
|
||||
"https://e.bambulab.com/t?c=l3T7caKGeNt3omA9");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ThumbnailPanel::ThumbnailPanel(wxWindow *parent, wxWindowID winid, const wxPoint &pos, const wxSize &size)
|
||||
: wxPanel(parent, winid, pos, size)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -445,6 +445,9 @@ public:
|
|||
void update_user_printer();
|
||||
void reset_ams_material();
|
||||
void update_show_status(MachineObject* obj_ = nullptr);
|
||||
|
||||
void UpdateStatusCheckWarning_ExtensionTool(MachineObject* obj_);
|
||||
|
||||
void update_ams_check(MachineObject* obj);
|
||||
void update_filament_change_count();
|
||||
void on_rename_click(wxMouseEvent &event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue