OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::DevExtderSystem Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/DeviceCore/DevExtruderSystem.h>

Collaboration diagram for Slic3r::DevExtderSystem:

Public Member Functions

 DevExtderSystem (MachineObject *obj)
 ~DevExtderSystem ()=default
MachineObject * Owner () const
int GetTotalExtderCount () const
int GetTotalExtderSize () const
int GetCurrentExtderId () const
int GetTargetExtderId () const =delete
DevExtderSwitchState GetSwitchState () const
bool IsSwitching () const
bool IsSwitchingFailed () const
bool CanQuitSwitching () const
bool CanRetrySwitching () const
int CtrlRetrySwitching ()
int CtrlQuitSwitching ()
std::optional< DevExtder > GetCurrentExtder () const
std::optional< DevExtder > GetLoadingExtder () const
std::optional< DevExtder > GetExtderById (int extder_id) const
const std::vector< DevExtder > & GetExtruders () const
NozzleType GetNozzleType (int extder_id) const
NozzleFlowType GetNozzleFlowType (int extder_id) const
float GetNozzleDiameter (int extder_id) const
int GetNozzleTempCurrent (int extder_id) const
int GetNozzleTempTarget (int extder_id) const
bool NozzleDiameterMatchesOrUnknown (int extder_id, float target_diameter) const
std::string GetCurrentAmsId () const
std::string GetCurrentSlotId () const
std::string GetTargetAmsId () const
std::string GetTargetSlotId () const
bool IsBusyLoading () const
int GetLoadingExtderId () const
bool HasFilamentBackup () const
bool HasFilamentInExt (int exter_id)
std::vector< DevAmsSlotId > GetBackupAmsSlotInGroup (const DevAmsSlotId &ams_slot_id)

Protected Member Functions

void AddExtder (const DevExtder &ext)

Private Attributes

MachineObject * m_owner = nullptr
int m_total_extder_count = 1
std::vector< DevExtder > m_extders
int m_current_extder_id = MAIN_EXTRUDER_ID
DevExtderSwitchState m_switch_extder_state = DevExtderSwitchState::ES_IDLE
int m_target_extder_id = MAIN_EXTRUDER_ID
bool m_current_busy_for_loading { false }
int m_current_loading_extder_id = INVALID_EXTRUDER_ID

Friends

class MachineObject
class ExtderSystemParser

Detailed Description

Constructor & Destructor Documentation

◆ DevExtderSystem()

Slic3r::DevExtderSystem::DevExtderSystem ( MachineObject * obj)
103 : m_owner(obj)
104 {
105 // default to have one extruder
107 DevExtder ext(this, MAIN_EXTRUDER_ID);
108 m_extders.emplace_back(ext);
109 }
#define MAIN_EXTRUDER_ID
Definition DevDefs.h:101
int m_total_extder_count
Definition DevExtruderSystem.h:192
std::vector< DevExtder > m_extders
Definition DevExtruderSystem.h:193
MachineObject * m_owner
Definition DevExtruderSystem.h:189

References m_extders, m_owner, m_total_extder_count, MachineObject, and MAIN_EXTRUDER_ID.

Here is the call graph for this function:

◆ ~DevExtderSystem()

Slic3r::DevExtderSystem::~DevExtderSystem ( )
default

Member Function Documentation

◆ AddExtder()

void Slic3r::DevExtderSystem::AddExtder ( const DevExtder & ext)
inlineprotected
186{ m_extders[ext.GetExtId()] = ext; };

References Slic3r::DevExtder::GetExtId(), and m_extders.

Here is the call graph for this function:

◆ CanQuitSwitching()

bool Slic3r::DevExtderSystem::CanQuitSwitching ( ) const
112 {
113 if (!IsSwitchingFailed())
114 {
115 return false;
116 }
117 return !m_owner->is_in_printing() && !m_owner->is_in_printing_pause();
118 }
bool IsSwitchingFailed() const
Definition DevExtruderSystem.h:140

References IsSwitchingFailed(), and m_owner.

Here is the call graph for this function:

◆ CanRetrySwitching()

bool Slic3r::DevExtderSystem::CanRetrySwitching ( ) const
inline
142{ return IsSwitchingFailed(); };

References IsSwitchingFailed().

Here is the call graph for this function:

◆ CtrlQuitSwitching()

int Slic3r::DevExtderSystem::CtrlQuitSwitching ( )
15 {
16 if (m_owner) { return m_owner->command_ams_control("abort"); }
17 return -1;
18 }

References m_owner.

◆ CtrlRetrySwitching()

int Slic3r::DevExtderSystem::CtrlRetrySwitching ( )
9 {
10 if (m_owner) { return m_owner->command_ams_control("resume"); }
11 return -1;
12 }

References m_owner.

◆ GetBackupAmsSlotInGroup()

std::vector< DevAmsSlotId > Slic3r::DevExtderSystem::GetBackupAmsSlotInGroup ( const DevAmsSlotId & ams_slot_id)
185 {
186 std::map<int, DevAmsSlotId> tray_map = Owner()->GetFilaSystem()->GetTrayIndexMap();
187
188 std::vector<DevAmsSlotId> backup_group;
189 for (const auto& extruder : m_extders) {
190 for (int fila_backup : extruder.GetFilamBackup()) {
191 for (auto [tray_id, is_valid] : DevExtder::GetBackupStatus(fila_backup)) {
192 if (is_valid && tray_map.find(tray_id) != tray_map.end() && tray_map[tray_id] != ams_slot_id) {
193 backup_group.emplace_back(tray_map[tray_id]);
194 }
195 }
196 }
197 }
198
199 return backup_group;
200 }
MachineObject * Owner() const
Definition DevExtruderSystem.h:129
static std::unordered_map< int, bool > GetBackupStatus(unsigned int fila_back_group)
Definition DevExtruderSystem.cpp:76
std::shared_ptr< DevFilaSystem > GetFilaSystem() const
Definition DeviceManager.hpp:388

References Slic3r::DevExtder::GetBackupStatus(), Slic3r::MachineObject::GetFilaSystem(), m_extders, and Owner().

Here is the call graph for this function:

◆ GetCurrentAmsId()

std::string Slic3r::DevExtderSystem::GetCurrentAmsId ( ) const
148 {
149 auto cur_extder = GetCurrentExtder();
150 return cur_extder ? cur_extder->GetSlotNow().ams_id : DevAmsSlotInfo().ams_id;
151 }
std::optional< DevExtder > GetCurrentExtder() const
Definition DevExtruderSystem.cpp:120

References Slic3r::DevAmsSlotInfo::ams_id, and GetCurrentExtder().

Referenced by Slic3r::GUI::AMSDryCtrWin::update_printer_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentExtder()

std::optional< DevExtder > Slic3r::DevExtderSystem::GetCurrentExtder ( ) const
121 {
123 }
int m_current_extder_id
Definition DevExtruderSystem.h:196
std::optional< DevExtder > GetExtderById(int extder_id) const
Definition DevExtruderSystem.cpp:135

References GetExtderById(), and m_current_extder_id.

Referenced by GetCurrentAmsId(), GetCurrentSlotId(), GetTargetAmsId(), and GetTargetSlotId().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCurrentExtderId()

int Slic3r::DevExtderSystem::GetCurrentExtderId ( ) const
inline
134{ return m_current_extder_id; }

References m_current_extder_id.

Referenced by Slic3r::GUI::CalibrationCaliPage::update().

Here is the caller graph for this function:

◆ GetCurrentSlotId()

std::string Slic3r::DevExtderSystem::GetCurrentSlotId ( ) const
154 {
155 auto cur_extder = GetCurrentExtder();
156 return cur_extder ? GetCurrentExtder()->GetSlotNow().slot_id : DevAmsSlotInfo().slot_id;
157 }

References GetCurrentExtder(), and Slic3r::DevAmsSlotInfo::slot_id.

Here is the call graph for this function:

◆ GetExtderById()

std::optional< DevExtder > Slic3r::DevExtderSystem::GetExtderById ( int extder_id) const
136 {
137 if (extder_id >= m_extders.size())
138 {
139 assert(false && "Invalid extruder ID");
140 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << "No extruder found for " << extder_id;
141 return std::nullopt;
142 }
143
144 return m_extders[extder_id];
145 }

References m_extders.

Referenced by GetCurrentExtder(), GetLoadingExtder(), GetNozzleDiameter(), GetNozzleFlowType(), GetNozzleTempCurrent(), GetNozzleTempTarget(), GetNozzleType(), HasFilamentInExt(), and Slic3r::GUI::AMSDryCtrWin::update_filament_list().

Here is the caller graph for this function:

◆ GetExtruders()

const std::vector< DevExtder > & Slic3r::DevExtderSystem::GetExtruders ( ) const
inline
150{ return m_extders;};

References m_extders.

Referenced by Slic3r::GUI::Plater::check_printer_initialized(), Slic3r::GUI::SyncAmsInfoDialog::is_nozzle_type_match(), Slic3r::GUI::Plater::priv::on_select_preset(), Slic3r::GUI::SelectMachineDialog::update_show_status(), and Slic3r::GUI::Sidebar::priv::update_sync_status().

Here is the caller graph for this function:

◆ GetLoadingExtder()

std::optional< DevExtder > Slic3r::DevExtderSystem::GetLoadingExtder ( ) const
126 {
128 {
130 }
131
132 return std::nullopt;
133 }
#define INVALID_EXTRUDER_ID
Definition DevDefs.h:104
int m_current_loading_extder_id
Definition DevExtruderSystem.h:204

References GetExtderById(), INVALID_EXTRUDER_ID, and m_current_loading_extder_id.

Here is the call graph for this function:

◆ GetLoadingExtderId()

int Slic3r::DevExtderSystem::GetLoadingExtderId ( ) const
inline

◆ GetNozzleDiameter()

float Slic3r::DevExtderSystem::GetNozzleDiameter ( int extder_id) const
inline
155{ return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetNozzleDiameter() : 0.0; }

References GetExtderById().

Referenced by Slic3r::GUI::NewCalibrationHistoryDialog::NewCalibrationHistoryDialog(), Slic3r::GUI::_get_tips(), Slic3r::GUI::NewCalibrationHistoryDialog::get_all_filaments(), Slic3r::GUI::CalibrationCaliPage::get_selected_calibration_nozzle_dia(), Slic3r::GUI::CalibrationPresetPage::init_with_machine(), NozzleDiameterMatchesOrUnknown(), Slic3r::GUI::Sidebar::priv::sync_extruder_list(), Slic3r::GUI::PressureAdvanceWizard::update(), and Slic3r::GUI::AMSDryCtrWin::update_filament_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNozzleFlowType()

NozzleFlowType Slic3r::DevExtderSystem::GetNozzleFlowType ( int extder_id) const
inline
154{ return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetNozzleFlowType() : NozzleFlowType::NONE_FLOWTYPE;; }
@ NONE_FLOWTYPE
Definition DevDefs.h:117

References GetExtderById(), and Slic3r::NONE_FLOWTYPE.

Referenced by Slic3r::GUI::CalibUtils::check_printable_status_before_cali(), Slic3r::GUI::CalibUtils::check_printable_status_before_cali(), Slic3r::GUI::CalibrationPresetPage::init_with_machine(), and Slic3r::GUI::Sidebar::priv::sync_extruder_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNozzleTempCurrent()

int Slic3r::DevExtderSystem::GetNozzleTempCurrent ( int extder_id) const
inline
156{ return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetCurrentTemp() : 0; }

References GetExtderById().

Here is the call graph for this function:

◆ GetNozzleTempTarget()

int Slic3r::DevExtderSystem::GetNozzleTempTarget ( int extder_id) const
inline
157{ return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetTargetTemp() : 0; }

References GetExtderById().

Here is the call graph for this function:

◆ GetNozzleType()

NozzleType Slic3r::DevExtderSystem::GetNozzleType ( int extder_id) const
inline
153{ return GetExtderById(extder_id) ? GetExtderById(extder_id)->GetNozzleType() : NozzleType::ntUndefine; }
@ ntUndefine
Definition CommonDefs.hpp:14

References GetExtderById(), and Slic3r::ntUndefine.

Referenced by Slic3r::GUI::check_nozzle_diameter_and_type(), Slic3r::GUI::is_same_nozzle_type(), and Slic3r::GUI::SyncAmsInfoDialog::is_same_nozzle_type().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSwitchState()

DevExtderSwitchState Slic3r::DevExtderSystem::GetSwitchState ( ) const
inline
138{ return m_switch_extder_state; }
DevExtderSwitchState m_switch_extder_state
Definition DevExtruderSystem.h:199

References m_switch_extder_state.

Referenced by Slic3r::GUI::ExtruderSwithingStatus::updateBy().

Here is the caller graph for this function:

◆ GetTargetAmsId()

std::string Slic3r::DevExtderSystem::GetTargetAmsId ( ) const
160 {
161 auto cur_extder = GetCurrentExtder();
162 return cur_extder ? GetCurrentExtder()->GetSlotTarget().ams_id : DevAmsSlotInfo().ams_id;
163 }

References Slic3r::DevAmsSlotInfo::ams_id, and GetCurrentExtder().

Here is the call graph for this function:

◆ GetTargetExtderId()

int Slic3r::DevExtderSystem::GetTargetExtderId ( ) const
delete

◆ GetTargetSlotId()

std::string Slic3r::DevExtderSystem::GetTargetSlotId ( ) const
166 {
167 auto cur_extder = GetCurrentExtder();
168 return cur_extder ? GetCurrentExtder()->GetSlotTarget().slot_id : DevAmsSlotInfo().slot_id;
169 }

References GetCurrentExtder(), and Slic3r::DevAmsSlotInfo::slot_id.

Here is the call graph for this function:

◆ GetTotalExtderCount()

◆ GetTotalExtderSize()

int Slic3r::DevExtderSystem::GetTotalExtderSize ( ) const
inline
133{ return static_cast<int>(m_extders.size()); }

References m_extders.

Referenced by Slic3r::GUI::CalibUtils::check_printable_status_before_cali(), and Slic3r::GUI::CalibUtils::check_printable_status_before_cali().

Here is the caller graph for this function:

◆ HasFilamentBackup()

bool Slic3r::DevExtderSystem::HasFilamentBackup ( ) const
172 {
173 for (const auto& ext : m_extders)
174 {
175 if (ext.HasFilamBackup())
176 {
177 return true;
178 }
179 }
180
181 return false;
182 }

References m_extders.

Referenced by Slic3r::GUI::SelectMachineDialog::on_timer(), and Slic3r::GUI::SyncAmsInfoDialog::on_timer().

Here is the caller graph for this function:

◆ HasFilamentInExt()

bool Slic3r::DevExtderSystem::HasFilamentInExt ( int exter_id)
inline
178{ return GetExtderById(exter_id) ? GetExtderById(exter_id)->HasFilamentInExt() : false; }

References GetExtderById().

Here is the call graph for this function:

◆ IsBusyLoading()

bool Slic3r::DevExtderSystem::IsBusyLoading ( ) const
inline
bool m_current_busy_for_loading
Definition DevExtruderSystem.h:203

References m_current_busy_for_loading.

◆ IsSwitching()

bool Slic3r::DevExtderSystem::IsSwitching ( ) const
inline
@ ES_SWITCHING
Definition DevExtruderSystem.h:36

References Slic3r::ES_SWITCHING, and m_switch_extder_state.

◆ IsSwitchingFailed()

bool Slic3r::DevExtderSystem::IsSwitchingFailed ( ) const
inline
@ ES_SWITCHING_FAILED
Definition DevExtruderSystem.h:37

References Slic3r::ES_SWITCHING_FAILED, and m_switch_extder_state.

Referenced by CanQuitSwitching(), and CanRetrySwitching().

Here is the caller graph for this function:

◆ NozzleDiameterMatchesOrUnknown()

bool Slic3r::DevExtderSystem::NozzleDiameterMatchesOrUnknown ( int extder_id,
float target_diameter ) const
inline
159 {
160 float diameter = GetNozzleDiameter(extder_id);
161 if (diameter == 0.0f) {
162 return true;
163 } else {
164 return std::fabs(diameter - target_diameter) < 1e-3;
165 }
166 }
float GetNozzleDiameter(int extder_id) const
Definition DevExtruderSystem.h:155

References GetNozzleDiameter().

Referenced by Slic3r::GUI::CalibUtils::check_printable_status_before_cali(), Slic3r::GUI::CalibUtils::check_printable_status_before_cali(), Slic3r::GUI::get_printer_preset(), and Slic3r::GUI::Plater::priv::on_select_preset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Owner()

MachineObject * Slic3r::DevExtderSystem::Owner ( ) const
inline
129{ return m_owner; }

References m_owner, and MachineObject.

Referenced by GetBackupAmsSlotInGroup(), and Slic3r::ExtderSystemParser::ParseV2_0().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExtderSystemParser

friend class ExtderSystemParser
friend

References ExtderSystemParser, and MachineObject.

Referenced by ExtderSystemParser.

◆ MachineObject

friend class MachineObject
friend

Member Data Documentation

◆ m_current_busy_for_loading

bool Slic3r::DevExtderSystem::m_current_busy_for_loading { false }
private

◆ m_current_extder_id

int Slic3r::DevExtderSystem::m_current_extder_id = MAIN_EXTRUDER_ID
private

◆ m_current_loading_extder_id

int Slic3r::DevExtderSystem::m_current_loading_extder_id = INVALID_EXTRUDER_ID
private

◆ m_extders

◆ m_owner

MachineObject* Slic3r::DevExtderSystem::m_owner = nullptr
private

◆ m_switch_extder_state

◆ m_target_extder_id

int Slic3r::DevExtderSystem::m_target_extder_id = MAIN_EXTRUDER_ID
private

◆ m_total_extder_count

int Slic3r::DevExtderSystem::m_total_extder_count = 1
private

The documentation for this class was generated from the following files: