fix: Print plate and Send to Moonraker printers upload a 3MF zip as G-code (#16968)

With "Use printer agents" on, Print plate and Send on Moonraker-based printer agents uploaded the plate's .gcode.3mf bundle under a .gcode name, so Klipper read a zip as G-code and cancelled the print.

Both paths now upload the plate's G-code from the bundle, named after the job. Printers whose profile sets use_3mf keep getting the bundle, named <job>.gcode.3mf, and the Qidi agent's print start names the plate with plateindex. The print start quotes the file name, so job names keep spaces, apostrophes and non-ASCII letters.

Picks up #16453 by DIEHARDave, who wrote the plate G-code extraction for Print plate.

Fixes #16954

Co-authored-by: DIEHARDave <diehard.dave@gmail.com>
(cherry picked from commit 187baae4ee)
This commit is contained in:
Kris Austin authored and SoftFever committed 2026-11-01 09:53:53 +08:00
1 parent 5ca36251a2
commit 61eb4622ea
6 files changed
+415 -24

No files matched your search

+11 -1
View File
@@ -8,6 +8,7 @@
#include "nlohmann/json.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/log/trivial.hpp>
@@ -129,7 +130,16 @@ bool QidiPrinterAgent::print_uploaded_file(const PrintParams& params, const std:
// On the X-Max 4 and Q2, Klipper only opens the copy Moonraker's print start makes, so SDCARD_PRINT_FILE can't find the upload
std::string response;
return send_jsonrpc_command(device_info.base_url, device_info.api_key, {{"filename", filename}}, response);
return send_jsonrpc_command(device_info.base_url, device_info.api_key, print_start_request(params, filename), response);
}
nlohmann::json QidiPrinterAgent::print_start_request(const PrintParams& params, const std::string& filename)
{
nlohmann::json request{{"filename", filename}};
// Qidi's Moonraker prints Metadata/plate_<plateindex>.gcode from a 3MF, defaulting to plate 1
if (boost::iends_with(filename, ".3mf"))
request["plateindex"] = std::to_string(params.plate_index);
return request;
}
bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url,