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

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

Collaboration diagram for Slic3r::DevNozzleSystem:

Public Member Functions

 DevNozzleSystem (MachineObject *owner)
 ~DevNozzleSystem ()=default
MachineObject * GetOwner () const
DevNozzle GetNozzleByPosId (int pos_id) const
bool ContainsExtNozzle (int id) const
DevNozzle GetExtNozzle (int id) const
const std::map< int, DevNozzle > & GetExtNozzles () const
int GetExtNozzleCount () const
void SetSupportNozzleRack (bool supported)
std::shared_ptr< DevNozzleRack > GetNozzleRack () const
DevNozzle GetRackNozzle (int idx) const
const std::map< int, DevNozzle > & GetRackNozzles () const
bool IsRackMaximumInstalled () const
const std::vector< DevNozzle > CollectNozzles (int ext_loc, NozzleFlowType flow_type, float diameter=-1.0f) const
std::vector< MultiNozzleUtils::NozzleGroupInfo > GetNozzleGroups () const
bool IsIdle () const
bool IsRefreshing () const
bool HasUnreliableNozzles () const
bool HasUnknownNozzles () const
int GetReadingIdx () const
int GetReadingCount () const
void AddFirmwareInfoWTM (const DevFirmwareVersionInfo &info)
void ClearFirmwareInfoWTM ()
DevFirmwareVersionInfo GetExtruderNozzleFirmware () const
std::optional< int > GetReplaceNozzleSrc () const
std::optional< int > GetReplaceNozzleTar () const

Private Types

enum  Status : int { NOZZLE_SYSTEM_IDLE = 0 , NOZZLE_SYSTEM_REFRESHING = 1 }

Private Member Functions

void ClearNozzles ()

Private Attributes

MachineObject * m_owner = nullptr
int m_extder_exist = 0
int m_state_0_4 = 0
std::optional< int > m_replace_nozzle_src
std::optional< int > m_replace_nozzle_tar
int m_reading_idx = 0
int m_reading_count = 0
std::map< int, DevNozzle > m_ext_nozzles
DevFirmwareVersionInfo m_ext_nozzle_firmware_info
std::shared_ptr< DevNozzleRack > m_nozzle_rack

Friends

class DevNozzleSystemParser

Detailed Description

Member Enumeration Documentation

◆ Status

enum Slic3r::DevNozzleSystem::Status : int
private
Enumerator
NOZZLE_SYSTEM_IDLE 
NOZZLE_SYSTEM_REFRESHING 
117 {
120 };
@ NOZZLE_SYSTEM_IDLE
Definition DevNozzleSystem.h:118
@ NOZZLE_SYSTEM_REFRESHING
Definition DevNozzleSystem.h:119

Constructor & Destructor Documentation

◆ DevNozzleSystem()

Slic3r::DevNozzleSystem::DevNozzleSystem ( MachineObject * owner)
236 : m_owner(owner), m_nozzle_rack(std::make_shared<DevNozzleRack>(this))
237{
238}
MachineObject * m_owner
Definition DevNozzleSystem.h:174
std::shared_ptr< DevNozzleRack > m_nozzle_rack
Definition DevNozzleSystem.h:191

References m_nozzle_rack, and m_owner.

◆ ~DevNozzleSystem()

Slic3r::DevNozzleSystem::~DevNozzleSystem ( )
default

Member Function Documentation

◆ AddFirmwareInfoWTM()

void Slic3r::DevNozzleSystem::AddFirmwareInfoWTM ( const DevFirmwareVersionInfo & info)
398{
399 static const std::string s_wtm_prefix = "wtm/";
400 auto pos = info.name.find(s_wtm_prefix);
401 if (pos == std::string::npos) {
403 } else {
404 try {
405 auto str = info.name.substr(s_wtm_prefix.size()); // remove "wtm/" prefix
406 int rack_nozzle_id = std::stoi(str) - 0x10; // rack nozzle IDs start from 0x10
407 m_nozzle_rack->AddNozzleFirmwareInfo(rack_nozzle_id, info);
408 } catch (const std::exception& e) {
409 BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": Invalid nozzle ID in firmware name: "
410 << info.name << ", error: " << e.what();
411 }
412 }
413}
DevFirmwareVersionInfo m_ext_nozzle_firmware_info
Definition DevNozzleSystem.h:188
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References m_ext_nozzle_firmware_info, m_nozzle_rack, and Slic3r::DevFirmwareVersionInfo::name.

◆ ClearFirmwareInfoWTM()

void Slic3r::DevNozzleSystem::ClearFirmwareInfoWTM ( )
416{
417 m_ext_nozzle_firmware_info = DevFirmwareVersionInfo();
418 m_nozzle_rack->ClearNozzleFirmwareInfo();
419}

References m_ext_nozzle_firmware_info, and m_nozzle_rack.

◆ ClearNozzles()

void Slic3r::DevNozzleSystem::ClearNozzles ( )
private
422{
423 m_ext_nozzles.clear();
424 m_nozzle_rack->ClearRackNozzles();
425}
std::map< int, DevNozzle > m_ext_nozzles
Definition DevNozzleSystem.h:187

References m_ext_nozzles, and m_nozzle_rack.

Referenced by Slic3r::DevNozzleSystemParser::ParseV2_0().

Here is the caller graph for this function:

◆ CollectNozzles()

const std::vector< DevNozzle > Slic3r::DevNozzleSystem::CollectNozzles ( int ext_loc,
NozzleFlowType flow_type,
float diameter = -1.0f ) const
266{
267 auto s_match = [&](const DevNozzle& nozzle) -> bool {
268 if (nozzle.IsEmpty() || nozzle.IsAbnormal()) {
269 return false;
270 }
271
272 if (diameter >= 0.0f && nozzle.m_diameter != diameter) {
273 return false;
274 }
275
276 if (m_owner->is_nozzle_flow_type_supported() && flow_type != nozzle.GetNozzleFlowType()) {
277 return false;
278 }
279
280 return true;
281 };
282
283 std::vector<DevNozzle> result;
284
285 auto ext_nozzle = GetExtNozzle(ext_loc);
286 if (s_match(ext_nozzle)) {
287 result.push_back(ext_nozzle);
288 }
289
290 if (ext_loc == MAIN_EXTRUDER_ID) {
291 auto rack_nozzles = m_nozzle_rack->GetRackNozzles();
292 for (auto rack_nozzle : rack_nozzles) {
293 if (s_match(rack_nozzle.second)) {
294 result.push_back(rack_nozzle.second);
295 }
296 }
297 }
298
299 return result;
300}
#define MAIN_EXTRUDER_ID
Definition DevDefs.h:101
DevNozzle GetExtNozzle(int id) const
Definition DevNozzleSystem.cpp:240

References GetExtNozzle(), m_nozzle_rack, m_owner, and MAIN_EXTRUDER_ID.

Here is the call graph for this function:

◆ ContainsExtNozzle()

bool Slic3r::DevNozzleSystem::ContainsExtNozzle ( int id) const
inline
133{ return m_ext_nozzles.find(id) != m_ext_nozzles.end(); }

References m_ext_nozzles.

◆ GetExtNozzle()

DevNozzle Slic3r::DevNozzleSystem::GetExtNozzle ( int id) const
241{
242 if (m_ext_nozzles.find(id) != m_ext_nozzles.end())
243 {
244 return m_ext_nozzles.at(id);
245 }
246
247 return DevNozzle();
248}

References m_ext_nozzles.

Referenced by CollectNozzles(), GetNozzleByPosId(), Slic3r::DevFilaSystem::GetNozzleFlowStringByAmsId(), IsRackMaximumInstalled(), Slic3r::GUI::wgtDeviceNozzleRackHotendUpdate::UpdateExtruderNozzleInfo(), and Slic3r::GUI::wgtDeviceNozzleRack::UpdateRackInfo().

Here is the caller graph for this function:

◆ GetExtNozzleCount()

int Slic3r::DevNozzleSystem::GetExtNozzleCount ( ) const
inline
136{ return (int) m_ext_nozzles.size(); }

References m_ext_nozzles.

◆ GetExtNozzles()

const std::map< int, DevNozzle > & Slic3r::DevNozzleSystem::GetExtNozzles ( ) const
inline
135{ return m_ext_nozzles; }

References m_ext_nozzles.

Referenced by GetNozzleGroups().

Here is the caller graph for this function:

◆ GetExtruderNozzleFirmware()

DevFirmwareVersionInfo Slic3r::DevNozzleSystem::GetExtruderNozzleFirmware ( ) const
inline

◆ GetNozzleByPosId()

DevNozzle Slic3r::DevNozzleSystem::GetNozzleByPosId ( int pos_id) const
inline
130{ return pos_id < 0x10 ? GetExtNozzle(pos_id) : GetRackNozzle(pos_id - 0x10); }
DevNozzle GetRackNozzle(int idx) const
Definition DevNozzleSystem.cpp:250

References GetExtNozzle(), and GetRackNozzle().

Referenced by Slic3r::GUI::SelectMachineDialog::get_mapped_nozzles(), Slic3r::DevNozzleMappingCtrl::GetFlushWeight(), and Slic3r::GUI::sCheckFilamentInfo().

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

◆ GetNozzleGroups()

std::vector< MultiNozzleUtils::NozzleGroupInfo > Slic3r::DevNozzleSystem::GetNozzleGroups ( ) const
303{
304 std::vector<MultiNozzleUtils::NozzleGroupInfo> nozzle_groups;
305
306 auto nozzle_in_extruder = this->GetExtNozzles();
307 for (auto& elem : nozzle_in_extruder) {
308 auto& nozzle = elem.second;
309 MultiNozzleUtils::NozzleGroupInfo info;
310 info.extruder_id = nozzle.GetLogicExtruderId();
311 info.diameter = format_diameter_to_str(nozzle.m_diameter);
312 info.volume_type = DevNozzle::ToNozzleVolumeType(nozzle.m_nozzle_flow);
313 info.nozzle_count = 1;
314 nozzle_groups.emplace_back(std::move(info));
315 }
316
317 auto nozzle_rack = this->GetNozzleRack();
318 if (!nozzle_rack)
319 return nozzle_groups;
320
321 auto nozzle_in_rack = nozzle_rack->GetRackNozzles(); // nozzles in rack
322 for (auto& elem : nozzle_in_rack) {
323 auto& nozzle = elem.second;
324 if (nozzle.IsUnknown() || nozzle.IsAbnormal())
325 continue;
326 int extruder_id = nozzle.GetLogicExtruderId();
327 std::string diameter = format_diameter_to_str(nozzle.m_diameter);
328 NozzleVolumeType volume_type = DevNozzle::ToNozzleVolumeType(nozzle.m_nozzle_flow);
329
330 bool found = false;
331 for (auto& group : nozzle_groups) {
332 if (group.extruder_id == extruder_id &&
333 group.volume_type == volume_type &&
334 group.diameter == diameter) {
335 found = true;
336 group.nozzle_count += 1;
337 break;
338 }
339 }
340 if (!found)
341 nozzle_groups.emplace_back(diameter, volume_type, extruder_id, 1);
342 }
343 return nozzle_groups;
344}
std::shared_ptr< DevNozzleRack > GetNozzleRack() const
Definition DevNozzleSystem.h:140
const std::map< int, DevNozzle > & GetExtNozzles() const
Definition DevNozzleSystem.h:135
NozzleVolumeType
Definition PrintConfig.hpp:618
std::string format_diameter_to_str(double diameter, int precision)
Definition utils.cpp:1739
static NozzleVolumeType ToNozzleVolumeType(const NozzleFlowType &type)
Definition DevNozzleSystem.cpp:52

References Slic3r::MultiNozzleUtils::NozzleGroupInfo::diameter, Slic3r::MultiNozzleUtils::NozzleGroupInfo::extruder_id, Slic3r::format_diameter_to_str(), GetExtNozzles(), GetNozzleRack(), Slic3r::MultiNozzleUtils::NozzleGroupInfo::nozzle_count, Slic3r::DevNozzle::ToNozzleVolumeType(), and Slic3r::MultiNozzleUtils::NozzleGroupInfo::volume_type.

Referenced by Slic3r::GUI::Plater::priv::check_ams_status_impl().

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

◆ GetNozzleRack()

◆ GetOwner()

MachineObject * Slic3r::DevNozzleSystem::GetOwner ( ) const
inline
127{ return m_owner; }

References m_owner.

Referenced by Slic3r::DevNozzle::GetTotalExtruderCount(), and Slic3r::GUI::AmsMapingPopup::OnNozzleMappingSelected().

Here is the caller graph for this function:

◆ GetRackNozzle()

DevNozzle Slic3r::DevNozzleSystem::GetRackNozzle ( int idx) const
251{
252 return m_nozzle_rack->GetNozzle(idx);
253}

References m_nozzle_rack.

Referenced by GetNozzleByPosId().

Here is the caller graph for this function:

◆ GetRackNozzles()

const std::map< int, DevNozzle > & Slic3r::DevNozzleSystem::GetRackNozzles ( ) const
256{
257 return m_nozzle_rack->GetRackNozzles();
258}

References m_nozzle_rack.

◆ GetReadingCount()

int Slic3r::DevNozzleSystem::GetReadingCount ( ) const
inline
159{ return m_reading_count; }
int m_reading_count
Definition DevNozzleSystem.h:184

References m_reading_count.

◆ GetReadingIdx()

int Slic3r::DevNozzleSystem::GetReadingIdx ( ) const
inline
158{ return m_reading_idx; }
int m_reading_idx
Definition DevNozzleSystem.h:183

References m_reading_idx.

◆ GetReplaceNozzleSrc()

std::optional< int > Slic3r::DevNozzleSystem::GetReplaceNozzleSrc ( ) const
inline
167{ return m_replace_nozzle_src; }
std::optional< int > m_replace_nozzle_src
Definition DevNozzleSystem.h:179

References m_replace_nozzle_src.

◆ GetReplaceNozzleTar()

std::optional< int > Slic3r::DevNozzleSystem::GetReplaceNozzleTar ( ) const
inline
168{ return m_replace_nozzle_tar; }
std::optional< int > m_replace_nozzle_tar
Definition DevNozzleSystem.h:180

References m_replace_nozzle_tar.

◆ HasUnknownNozzles()

bool Slic3r::DevNozzleSystem::HasUnknownNozzles ( ) const
383{
384 for (auto nozzle : m_ext_nozzles) {
385 if (nozzle.second.IsUnknown()) {
386 return true;
387 }
388 }
389
390 if (m_nozzle_rack->HasUnknownNozzles()) {
391 return true;
392 }
393
394 return false;
395}

References m_ext_nozzles, and m_nozzle_rack.

◆ HasUnreliableNozzles()

bool Slic3r::DevNozzleSystem::HasUnreliableNozzles ( ) const
368{
369 for (auto nozzle : m_ext_nozzles) {
370 if (!nozzle.second.IsInfoReliable()) {
371 return true;
372 }
373 }
374
375 if (m_nozzle_rack->HasUnreliableNozzles()) {
376 return true;
377 }
378
379 return false;
380}

References m_ext_nozzles, and m_nozzle_rack.

◆ IsIdle()

bool Slic3r::DevNozzleSystem::IsIdle ( ) const
inline
151{ return m_state_0_4 == NOZZLE_SYSTEM_IDLE; }
int m_state_0_4
Definition DevNozzleSystem.h:177

References m_state_0_4, and NOZZLE_SYSTEM_IDLE.

◆ IsRackMaximumInstalled()

bool Slic3r::DevNozzleSystem::IsRackMaximumInstalled ( ) const
347{
348 auto ext_nozzle = GetExtNozzle(MAIN_EXTRUDER_ID);
349 if (ext_nozzle.IsEmpty()) {
350 return false;
351 }
352
353 const auto& rack_nozzles = m_nozzle_rack->GetRackNozzles();
354 if (rack_nozzles.size() < 6) {
355 return false;
356 }
357
358 for (auto item : rack_nozzles) {
359 if (item.second.IsEmpty()) {
360 return false;
361 }
362 }
363
364 return true;
365}

References GetExtNozzle(), m_nozzle_rack, and MAIN_EXTRUDER_ID.

Here is the call graph for this function:

◆ IsRefreshing()

bool Slic3r::DevNozzleSystem::IsRefreshing ( ) const
inline

◆ SetSupportNozzleRack()

void Slic3r::DevNozzleSystem::SetSupportNozzleRack ( bool supported)
261{
262 m_nozzle_rack->SetSupported(supported);
263}

References m_nozzle_rack.

◆ DevNozzleSystemParser

friend class DevNozzleSystemParser
friend

References DevNozzleSystemParser.

Referenced by DevNozzleSystemParser.

Member Data Documentation

◆ m_ext_nozzle_firmware_info

DevFirmwareVersionInfo Slic3r::DevNozzleSystem::m_ext_nozzle_firmware_info
private

◆ m_ext_nozzles

◆ m_extder_exist

int Slic3r::DevNozzleSystem::m_extder_exist = 0
private

◆ m_nozzle_rack

◆ m_owner

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

◆ m_reading_count

int Slic3r::DevNozzleSystem::m_reading_count = 0
private

◆ m_reading_idx

int Slic3r::DevNozzleSystem::m_reading_idx = 0
private

◆ m_replace_nozzle_src

std::optional<int> Slic3r::DevNozzleSystem::m_replace_nozzle_src
private

◆ m_replace_nozzle_tar

std::optional<int> Slic3r::DevNozzleSystem::m_replace_nozzle_tar
private

◆ m_state_0_4

int Slic3r::DevNozzleSystem::m_state_0_4 = 0
private

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