Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
AMS bugfixes
Browse files Browse the repository at this point in the history
- ams_slot added as print param, default to 0.  0-based AMS slot array.  use_ams also must be set to true.
- bugfix 3MF file printing
- bugfix, when BB selected printer is changed,  AMS sync will occur each time in orca PE, including when starting a print.
  • Loading branch information
PilotMatt committed Mar 15, 2024
1 parent 3ef7d8b commit 73bf80c
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/slic3r/GUI/Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ void MonitorPanel::on_update_all(wxMouseEvent &event)

Layout();
Refresh();

wxGetApp().plater()->sidebar().sync_ams_list();

}

void MonitorPanel::on_printer_clicked(wxMouseEvent &event)
Expand Down
6 changes: 5 additions & 1 deletion src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,11 @@ void Sidebar::sync_ams_list()
add_button(wxID_CANCEL, false, _L("Cancel"));
}
} dlg(this, ams_filament_ids.empty());
auto res = dlg.ShowModal();

//printago
// auto res = dlg.ShowModal();
auto res = wxID_YES;

if (res == wxID_CANCEL) return;
list2.resize(list.size());
auto iter = list.begin();
Expand Down
12 changes: 12 additions & 0 deletions src/slic3r/GUI/SelectMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3955,6 +3955,7 @@ void SelectMachineDialog::set_default_normal()
info.color = wxString::Format("#%02X%02X%02X%02X", colour_rgb.Red(), colour_rgb.Green(), colour_rgb.Blue(), colour_rgb.Alpha()).ToStdString();
m_filaments.push_back(info);
}

}

if (extruders.size() <= 4) {
Expand Down Expand Up @@ -4319,6 +4320,17 @@ void SelectMachineDialog::SetCheckboxOption(const std::string& key, bool value)
}
}

//printago
void SelectMachineDialog::PrintagoMapAms(int ams_slot_id, bool mapFor3MF)
{
m_ams_mapping_result.clear();
m_ams_mapping_result = m_filaments; // UPDATE THIS MAPPING RESULT- Id == tray_id.
m_ams_mapping_res = true;
for (auto& elem : m_ams_mapping_result) {
mapFor3MF ? elem.tray_id = ams_slot_id : elem.tray_id = elem.id;
elem.tray_id = mapFor3MF ? elem.id : ams_slot_id;
}
}

EditDevNameDialog::EditDevNameDialog(Plater *plater /*= nullptr*/)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Modifying the device name"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
Expand Down
1 change: 1 addition & 0 deletions src/slic3r/GUI/SelectMachine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ class SelectMachineDialog : public DPIDialog
//Printago
void SetPrinter(const std::string& printerLastSelect);
void SetCheckboxOption(const std::string& key, bool value);
void PrintagoMapAms(int ams_slot_id = 0, bool mapFor3MF = false);
};

wxDECLARE_EVENT(EVT_FINISHED_UPDATE_MACHINE_LIST, wxCommandEvent);
Expand Down
20 changes: 17 additions & 3 deletions src/slic3r/Utils/PrintagoServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ bool PrintagoDirector::ProcessPrintagoCommand(const PrintagoCommand& cmd)
PBJob::bbl_do_bed_leveling = parameters.contains("do_bed_leveling") && parameters["do_bed_leveling"].get<bool>();
PBJob::bbl_do_flow_cali = parameters.contains("do_flow_cali") && parameters["do_flow_cali"].get<bool>();

PBJob::ams_slot = parameters.contains("ams_slot") ? parameters["ams_slot"] : 0;

if (parameters.count("bed_type")) {
PBJob::bed_type = PBJob::StringToBedType(parameters["bed_type"]);
if (PBJob::bed_type == BedType::btDefault) {
Expand Down Expand Up @@ -702,8 +704,6 @@ bool PrintagoDirector::ProcessPrintagoCommand(const PrintagoCommand& cmd)
return false;
}

// Do the configuring here: this allows 3MF files to load, then we can configure the slicer and override the 3MF conf settings
// from what Printago sent.
wxFileName localPrinterConf, localFilamentConf, localPrintConf;
if (SavePrintagoFile(printerConfUrl, localPrinterConf) && SavePrintagoFile(filamentConfUrl, localFilamentConf) &&
SavePrintagoFile(printConfUrl, localPrintConf)) {
Expand Down Expand Up @@ -751,6 +751,8 @@ bool PrintagoDirector::ProcessPrintagoCommand(const PrintagoCommand& cmd)
// The last 'true' tells the function to not ask the user to confirm the load; save any existing work.
wxGetApp().plater()->load_project(PBJob::localFile.GetFullPath(), "-", true);
SetPrintagoConfigs(); // since the 3MF may have it's own configs that get set on load.
wxGetApp().plater()->sidebar().on_bed_type_change(PBJob::bed_type);
wxGetApp().plater()->get_partplate_list().get_curr_plate()->set_bed_type(PBJob::bed_type);
} else {
std::vector<std::string> filePathArray;
filePathArray.push_back(PBJob::localFile.GetFullPath().ToStdString());
Expand Down Expand Up @@ -1470,7 +1472,12 @@ void PrintagoDirector::OnSlicingCompleted(SlicingProcessCompletedEvent::StatusTy
m_select_machine_dlg = new SelectMachineDialog(wxGetApp().plater());

m_select_machine_dlg->set_print_type(FROM_NORMAL);
m_select_machine_dlg->prepare(0);
m_select_machine_dlg->set_default_normal();
m_select_machine_dlg->prepare(0);
if (PBJob::use_ams && wxGetApp().getDeviceManager()->get_my_machine(PBJob::printerId.ToStdString())) {

}


m_select_machine_dlg->SetPrinter(PBJob::printerId.ToStdString());
auto selectedPrinter = wxGetApp().getDeviceManager()->get_selected_machine();
Expand All @@ -1480,6 +1487,13 @@ void PrintagoDirector::OnSlicingCompleted(SlicingProcessCompletedEvent::StatusTy

if (selectedPrinter->has_ams()) {
m_select_machine_dlg->SetCheckboxOption("use_ams", PBJob::use_ams);
if (PBJob::use_ams) {
if (!PBJob::localFile.GetExt().MakeUpper().compare("3MF")) {
m_select_machine_dlg->PrintagoMapAms(0, true); // set AMS 1:1
} else {
m_select_machine_dlg->PrintagoMapAms(PBJob::ams_slot, false); // map all filaments to specified slot.
}
}
} else {
m_select_machine_dlg->SetCheckboxOption("use_ams", false);
}
Expand Down
2 changes: 2 additions & 0 deletions src/slic3r/Utils/PrintagoServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ class PBJob
jobId = "ptgo_default";

use_ams = false;
ams_slot = 0;
bbl_do_bed_leveling = false;
bbl_do_flow_cali = false;

Expand Down Expand Up @@ -373,6 +374,7 @@ class PBJob
inline static bool bbl_do_bed_leveling = false;
inline static bool bbl_do_flow_cali = false;
inline static BedType bed_type = BedType::btDefault;
inline static int ams_slot = 0;

static BedType StringToBedType(const std::string& bedType)
{
Expand Down

0 comments on commit 73bf80c

Please sign in to comment.