OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::FilamentLoad Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/FilamentLoad.hpp>

Inheritance diagram for Slic3r::GUI::FilamentLoad:
Collaboration diagram for Slic3r::GUI::FilamentLoad:

Public Member Functions

 FilamentLoad (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
void SetAmsModel (AMSModel mode, AMSModel ext_mode)
void SetFilamentStep (FilamentStep item_idx, FilamentStepType f_type)
void ShowFilamentTip (bool hasams=true)
void SetupSteps (MachineObject *obj_, bool is_extrusion_exist)
void show_nofilament_mode (bool show)
void updateID (int ams_id, int slot_id)
void SetExt (bool ext)
void set_min_size (const wxSize &minSize)
void set_max_size (const wxSize &maxSize)
void set_background_color (const wxColour &colour)

Public Attributes

std::map< FilamentStep, wxString > FILAMENT_CHANGE_STEP_STRING
std::map< DevFilamentStep, wxString > DEV_FILAMENT_CHANGE_STEP_STRING
AMSModel m_ams_model { AMSModel::GENERIC_AMS }
AMSModel m_ext_model { AMSModel::AMS_LITE }
AMSModel m_is_none_ams_mode { AMSModel::AMS_LITE }

Protected Attributes

::FilamentStepIndicator * m_filament_load_steps = { nullptr }
::FilamentStepIndicator * m_filament_unload_steps = { nullptr }
::FilamentStepIndicator * m_filament_vt_load_steps = { nullptr }
int m_ams_id = { 1 }
int m_slot_id = { 1 }
bool is_extrusion = false

Detailed Description

Constructor & Destructor Documentation

◆ FilamentLoad()

Slic3r::GUI::FilamentLoad::FilamentLoad ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize )
27 : wxSimplebook(parent, wxID_ANY, pos, size)
28{
29 SetBackgroundColour(*wxWHITE);
30 m_filament_load_steps = new FilamentStepIndicator(this, wxID_ANY);
31 m_filament_unload_steps = new ::FilamentStepIndicator(this, wxID_ANY);
32 m_filament_vt_load_steps = new ::FilamentStepIndicator(this, wxID_ANY);
33
34 this->AddPage(m_filament_load_steps, wxEmptyString, false);
35 this->AddPage(m_filament_unload_steps, wxEmptyString, false);
36 this->AddPage(m_filament_vt_load_steps, wxEmptyString, false);
37 //UpdateStepCtrl(false);
38
42 FILAMENT_CHANGE_STEP_STRING[FilamentStep::STEP_PULL_CURR_FILAMENT] = _L("Pull back the current filament");
43 FILAMENT_CHANGE_STEP_STRING[FilamentStep::STEP_PUSH_NEW_FILAMENT] = _L("Push new filament into extruder");
46 //FILAMENT_CHANGE_STEP_STRING[FilamentStep::STEP_FEED_FILAMENT] = _L("Feed Filament");
49
50 // Orca: labels for the device-numbered steps carried by the AMS (ams.cfs). Overlapping steps
51 // reuse the wording above so the current-step highlight (driven by the legacy ams_status_sub
52 // path) still text-matches; the switch/hotend/cooling and Filament Track Switch steps are new.
53 // STEP_CHECK_POSITION and STEP_CONFIRM_EXTRUDED share code 0x08, so CONFIRM is assigned first
54 // and CHECK_POSITION last, leaving code 0x08 mapped to "Check filament location" as on device.
63 // TRN Filament change step: the printer switches to the other extruder.
65 // TRN Filament change step: the printer switches to another hotend.
68 DEV_FILAMENT_CHANGE_STEP_STRING[DevFilamentStep::STEP_PUSH_SWITCHER_FILA] = _L("Switch current filament at Filament Track Switch");
69 DEV_FILAMENT_CHANGE_STEP_STRING[DevFilamentStep::STEP_PULL_SWITCHER_FILA] = _L("Pull back current filament at Filament Track Switch");
70 DEV_FILAMENT_CHANGE_STEP_STRING[DevFilamentStep::STEP_SWITCHER_SWITCH] = _L("Switch track at Filament Track Switch");
73}
#define _L(s)
Definition OBJ.cpp:34
std::map< DevFilamentStep, wxString > DEV_FILAMENT_CHANGE_STEP_STRING
Definition FilamentLoad.hpp:49
std::map< FilamentStep, wxString > FILAMENT_CHANGE_STEP_STRING
Definition FilamentLoad.hpp:45
::FilamentStepIndicator * m_filament_load_steps
Definition FilamentLoad.hpp:36
::FilamentStepIndicator * m_filament_unload_steps
Definition FilamentLoad.hpp:37
::FilamentStepIndicator * m_filament_vt_load_steps
Definition FilamentLoad.hpp:38
@ STEP_PURGE_OLD_FILAMENT
Definition AMSItem.hpp:153
@ STEP_CUT_FILAMENT
Definition AMSItem.hpp:149
@ STEP_CHECK_POSITION
Definition AMSItem.hpp:155
@ STEP_CONFIRM_EXTRUDED
Definition AMSItem.hpp:154
@ STEP_PUSH_NEW_FILAMENT
Definition AMSItem.hpp:151
@ STEP_IDLE
Definition AMSItem.hpp:147
@ STEP_GRAB_NEW_FILAMENT
Definition AMSItem.hpp:152
@ STEP_HEAT_NOZZLE
Definition AMSItem.hpp:148
@ STEP_PULL_CURR_FILAMENT
Definition AMSItem.hpp:150
@ STEP_AMS_FILA_COOLING
Definition DevDefs.h:80
@ STEP_CHECK_POSITION
Definition DevDefs.h:77
@ STEP_PURGE_OLD_FILAMENT
Definition DevDefs.h:76
@ STEP_PULL_CURR_FILAMENT
Definition DevDefs.h:73
@ STEP_SWITCH_EXTRUDER
Definition DevDefs.h:78
@ STEP_SWITCHER_SWITCH
Definition DevDefs.h:83
@ STEP_PULL_SWITCHER_FILA
Definition DevDefs.h:82
@ STEP_CONFIRM_EXTRUDED
Definition DevDefs.h:84
@ STEP_PAUSE
Definition DevDefs.h:70
@ STEP_PUSH_NEW_FILAMENT
Definition DevDefs.h:74
@ STEP_IDLE
Definition DevDefs.h:69
@ STEP_SWITCH_HOTEND
Definition DevDefs.h:79
@ STEP_GRAB_NEW_FILAMENT
Definition DevDefs.h:75
@ STEP_CUT_FILAMENT
Definition DevDefs.h:72
@ STEP_HEAT_NOZZLE
Definition DevDefs.h:71
@ STEP_PUSH_SWITCHER_FILA
Definition DevDefs.h:81
#define _L_CONTEXT(s, ctx)
Definition I18N.hpp:15

References _L, _L_CONTEXT, DEV_FILAMENT_CHANGE_STEP_STRING, FILAMENT_CHANGE_STEP_STRING, m_filament_load_steps, m_filament_unload_steps, m_filament_vt_load_steps, Slic3r::STEP_AMS_FILA_COOLING, Slic3r::GUI::STEP_CHECK_POSITION, Slic3r::STEP_CHECK_POSITION, Slic3r::GUI::STEP_CONFIRM_EXTRUDED, Slic3r::STEP_CONFIRM_EXTRUDED, Slic3r::GUI::STEP_CUT_FILAMENT, Slic3r::STEP_CUT_FILAMENT, Slic3r::GUI::STEP_GRAB_NEW_FILAMENT, Slic3r::STEP_GRAB_NEW_FILAMENT, Slic3r::GUI::STEP_HEAT_NOZZLE, Slic3r::STEP_HEAT_NOZZLE, Slic3r::GUI::STEP_IDLE, Slic3r::STEP_IDLE, Slic3r::STEP_PAUSE, Slic3r::GUI::STEP_PULL_CURR_FILAMENT, Slic3r::STEP_PULL_CURR_FILAMENT, Slic3r::STEP_PULL_SWITCHER_FILA, Slic3r::GUI::STEP_PURGE_OLD_FILAMENT, Slic3r::STEP_PURGE_OLD_FILAMENT, Slic3r::GUI::STEP_PUSH_NEW_FILAMENT, Slic3r::STEP_PUSH_NEW_FILAMENT, Slic3r::STEP_PUSH_SWITCHER_FILA, Slic3r::STEP_SWITCH_EXTRUDER, Slic3r::STEP_SWITCH_HOTEND, and Slic3r::STEP_SWITCHER_SWITCH.

Member Function Documentation

◆ set_background_color()

void Slic3r::GUI::FilamentLoad::set_background_color ( const wxColour & colour)
272 {
273 m_filament_load_steps->SetBackgroundColour(colour);
274 m_filament_unload_steps->SetBackgroundColour(colour);
275 m_filament_vt_load_steps->SetBackgroundColour(colour);
276}

References m_filament_load_steps, m_filament_unload_steps, and m_filament_vt_load_steps.

◆ set_max_size()

void Slic3r::GUI::FilamentLoad::set_max_size ( const wxSize & maxSize)
265 {
266 this->SetMaxSize(minSize);
267 m_filament_load_steps->SetMaxSize(minSize);
268 m_filament_unload_steps->SetMaxSize(minSize);
269 m_filament_vt_load_steps->SetMaxSize(minSize);
270}

References m_filament_load_steps, m_filament_unload_steps, and m_filament_vt_load_steps.

◆ set_min_size()

void Slic3r::GUI::FilamentLoad::set_min_size ( const wxSize & minSize)
258 {
259 this->SetMinSize(minSize);
260 m_filament_load_steps->SetMinSize(minSize);
261 m_filament_unload_steps->SetMinSize(minSize);
262 m_filament_vt_load_steps->SetMinSize(minSize);
263}

References m_filament_load_steps, m_filament_unload_steps, and m_filament_vt_load_steps.

◆ SetAmsModel()

void Slic3r::GUI::FilamentLoad::SetAmsModel ( AMSModel mode,
AMSModel ext_mode )
inline
54{ m_ams_model = mode; m_ext_model = ext_mode; };
AMSModel m_ams_model
Definition FilamentLoad.hpp:50
AMSModel m_ext_model
Definition FilamentLoad.hpp:51

References m_ams_model, and m_ext_model.

◆ SetExt()

void Slic3r::GUI::FilamentLoad::SetExt ( bool ext)
inline
63{ is_extrusion = ext; };
bool is_extrusion
Definition FilamentLoad.hpp:41

References is_extrusion.

◆ SetFilamentStep()

void Slic3r::GUI::FilamentLoad::SetFilamentStep ( FilamentStep item_idx,
FilamentStepType f_type )
76{
77 if (item_idx == FilamentStep::STEP_IDLE) {
81 if (IsShown()) {Hide(); }
82 return;
83 }
84
85 if (!IsShown()) {Show();}
86 wxString step_str = wxEmptyString;
87 if (item_idx < FilamentStep::STEP_COUNT) {
88 step_str = FILAMENT_CHANGE_STEP_STRING[item_idx];
89 }
90
91 auto step_control = m_filament_load_steps;
93 step_control = m_filament_load_steps;
94 if (item_idx > 0 && item_idx < FilamentStep::STEP_COUNT) {
95 if (GetSelection() != 0) {
96 SetSelection(0);
97 }
98 m_filament_load_steps->SelectItem(m_filament_load_steps->GetItemUseText(step_str));
99 }
100 else {
101 m_filament_load_steps->Idle();
102 Hide();
103 Layout();
104 }
105 }
106 else if (f_type == FilamentStepType::STEP_TYPE_UNLOAD) {
107 step_control = m_filament_unload_steps;
108 if (item_idx > 0 && item_idx < FilamentStep::STEP_COUNT) {
109 if (GetSelection() != 1) {
110 SetSelection(1);
111 Layout();
112 }
113 m_filament_unload_steps->SelectItem(m_filament_unload_steps->GetItemUseText(step_str));
114 }
115 else {
117 Hide();
118 Layout();
119 }
120 }
121 else if (f_type == FilamentStepType::STEP_TYPE_VT_LOAD) {
122 step_control = m_filament_vt_load_steps;
123 SetSelection(2);
124 Layout();
125 if (item_idx > 0 && item_idx < FilamentStep::STEP_COUNT) {
126 if (item_idx == STEP_CONFIRM_EXTRUDED) {
127 m_filament_vt_load_steps->SelectItem(2);
128 }
129 else {
130 m_filament_vt_load_steps->SelectItem(m_filament_vt_load_steps->GetItemUseText(step_str));
131 }
132 }
133 else {
135 Hide();
136 Layout();
137 }
138 }
139 else {
140 step_control = m_filament_load_steps;
141 if (item_idx > 0 && item_idx < FilamentStep::STEP_COUNT) {
142 SetSelection(0);
143 m_filament_load_steps->SelectItem(m_filament_load_steps->GetItemUseText(step_str));
144 }
145 else {
146 m_filament_load_steps->Idle();
147 Hide();
148 Layout();
149 }
150 }
151
152 // TRN AMS unit number, then slot number
153 wxString slot_info = wxString::Format(_L("AMS-%d-%d Slot"), m_ams_id, m_slot_id);
154 step_control->SetSlotInformation(slot_info);
155}
int m_ams_id
Definition FilamentLoad.hpp:39
int m_slot_id
Definition FilamentLoad.hpp:40
@ STEP_COUNT
Definition AMSItem.hpp:156
@ STEP_TYPE_VT_LOAD
Definition AMSItem.hpp:163
@ STEP_TYPE_LOAD
Definition AMSItem.hpp:161
@ STEP_TYPE_UNLOAD
Definition AMSItem.hpp:162

References _L, FILAMENT_CHANGE_STEP_STRING, m_ams_id, m_filament_load_steps, m_filament_unload_steps, m_filament_vt_load_steps, m_slot_id, Slic3r::GUI::STEP_CONFIRM_EXTRUDED, Slic3r::GUI::STEP_COUNT, Slic3r::GUI::STEP_IDLE, Slic3r::GUI::STEP_TYPE_LOAD, Slic3r::GUI::STEP_TYPE_UNLOAD, and Slic3r::GUI::STEP_TYPE_VT_LOAD.

◆ SetupSteps()

void Slic3r::GUI::FilamentLoad::SetupSteps ( MachineObject * obj_,
bool is_extrusion_exist )
157 {
158 m_filament_load_steps->DeleteAllItems();
159 m_filament_unload_steps->DeleteAllItems();
160 m_filament_vt_load_steps->DeleteAllItems();
161
162 // Orca: newer firmware sends the exact change-step sequence through the AMS (ams.cfs). When
163 // present, build the visible steps straight from that list and skip the hardcoded per-model
164 // sequences below. Inert on current firmware: the list is empty, so this branch is skipped and
165 // the legacy logic runs unchanged.
166 if (obj_ && obj_->GetFilaSystem() && !obj_->GetFilaSystem()->GetFilamentChangeSteps().empty()) {
167 const auto& steps = obj_->GetFilaSystem()->GetFilamentChangeSteps();
168 for (auto step : steps) {
169 auto iter = DEV_FILAMENT_CHANGE_STEP_STRING.find(step);
170 if (iter == DEV_FILAMENT_CHANGE_STEP_STRING.end()) {
171 BOOST_LOG_TRIVIAL(error) << "Unknown filament change step: " << static_cast<int>(step);
172 continue;
173 }
174
175 m_filament_load_steps->AppendItem(iter->second);
176 m_filament_unload_steps->AppendItem(iter->second);
177 m_filament_vt_load_steps->AppendItem(iter->second);
178 }
179
180 Layout();
181 Fit();
182 return;
183 }
184
186 if (has_fila_to_switch) {
192 }
193 else {
197 }
198
203
207 }
208
209
217
224
229 }
230
231 Layout();
232 Fit();
233}
@ N3S_AMS
Definition AMSItem.hpp:62
@ GENERIC_AMS
Definition AMSItem.hpp:59
@ N3F_AMS
Definition AMSItem.hpp:61
@ AMS_LITE
Definition AMSItem.hpp:60
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213

References Slic3r::GUI::AMS_LITE, DEV_FILAMENT_CHANGE_STEP_STRING, FILAMENT_CHANGE_STEP_STRING, Slic3r::GUI::GENERIC_AMS, Slic3r::MachineObject::GetFilaSystem(), m_ams_model, m_ext_model, m_filament_load_steps, m_filament_unload_steps, m_filament_vt_load_steps, Slic3r::GUI::N3F_AMS, Slic3r::GUI::N3S_AMS, Slic3r::GUI::STEP_CHECK_POSITION, Slic3r::GUI::STEP_CUT_FILAMENT, Slic3r::GUI::STEP_GRAB_NEW_FILAMENT, Slic3r::GUI::STEP_HEAT_NOZZLE, Slic3r::GUI::STEP_PULL_CURR_FILAMENT, Slic3r::GUI::STEP_PURGE_OLD_FILAMENT, and Slic3r::GUI::STEP_PUSH_NEW_FILAMENT.

Here is the call graph for this function:

◆ show_nofilament_mode()

void Slic3r::GUI::FilamentLoad::show_nofilament_mode ( bool show)
237{
238 m_filament_load_steps->DeleteAllItems();
239 m_filament_unload_steps->DeleteAllItems();
240 m_filament_vt_load_steps->DeleteAllItems();
241 m_filament_load_steps->Idle();
244 this->Layout();
245 Refresh();
246 /*if (!show)
247 {
248 m_filament_load_steps->Idle();
249 m_filament_unload_steps->Idle();
250 m_filament_vt_load_steps->Idle();
251 }
252 else {
253 this->Show();
254 this->Layout();
255 }*/
256}

References m_filament_load_steps, m_filament_unload_steps, and m_filament_vt_load_steps.

◆ ShowFilamentTip()

void Slic3r::GUI::FilamentLoad::ShowFilamentTip ( bool hasams = true)

◆ updateID()

void Slic3r::GUI::FilamentLoad::updateID ( int ams_id,
int slot_id )
inline
62{ m_ams_id = ams_id; m_slot_id = slot_id; };

References m_ams_id, and m_slot_id.

Member Data Documentation

◆ DEV_FILAMENT_CHANGE_STEP_STRING

std::map<DevFilamentStep, wxString> Slic3r::GUI::FilamentLoad::DEV_FILAMENT_CHANGE_STEP_STRING

Referenced by FilamentLoad(), and SetupSteps().

◆ FILAMENT_CHANGE_STEP_STRING

std::map<FilamentStep, wxString> Slic3r::GUI::FilamentLoad::FILAMENT_CHANGE_STEP_STRING

◆ is_extrusion

bool Slic3r::GUI::FilamentLoad::is_extrusion = false
protected

Referenced by SetExt().

◆ m_ams_id

int Slic3r::GUI::FilamentLoad::m_ams_id = { 1 }
protected
39{ 1 };

Referenced by SetFilamentStep(), and updateID().

◆ m_ams_model

AMSModel Slic3r::GUI::FilamentLoad::m_ams_model { AMSModel::GENERIC_AMS }

Referenced by SetAmsModel(), and SetupSteps().

◆ m_ext_model

AMSModel Slic3r::GUI::FilamentLoad::m_ext_model { AMSModel::AMS_LITE }

Referenced by SetAmsModel(), and SetupSteps().

◆ m_filament_load_steps

::FilamentStepIndicator* Slic3r::GUI::FilamentLoad::m_filament_load_steps = { nullptr }
protected

◆ m_filament_unload_steps

::FilamentStepIndicator* Slic3r::GUI::FilamentLoad::m_filament_unload_steps = { nullptr }
protected

◆ m_filament_vt_load_steps

::FilamentStepIndicator* Slic3r::GUI::FilamentLoad::m_filament_vt_load_steps = { nullptr }
protected

◆ m_is_none_ams_mode

AMSModel Slic3r::GUI::FilamentLoad::m_is_none_ams_mode { AMSModel::AMS_LITE }

◆ m_slot_id

int Slic3r::GUI::FilamentLoad::m_slot_id = { 1 }
protected
40{ 1 };

Referenced by SetFilamentStep(), and updateID().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/FilamentLoad.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Widgets/FilamentLoad.cpp