Per @SoftFever review on #13752, printer-specific filament sync logic
belongs in the agent rather than in Sidebar. This consolidates the
previously-duplicated code so all CFS-specific work lives in
CrealityPrintAgent.
Changes:
- New: CrealityPrintAgent::sync_filaments_into_ams_list() — static method
that builds a CrealityPrint host from a printer_cfg, queries CFS slots,
populates PresetBundle::filament_ams_list, and triggers sync_ams_list().
GUI-free; returns a result struct (Status + counts + detail) so the
caller decides what dialog to show.
- New: nested CFSAmsListResult struct describing the five possible
outcomes (Success / NotCfsCapable / QueryFailed / EmptySlots / NoMatches).
- Removed: Sidebar::sync_filaments_from_creality_cfs() entirely (its body
is now the agent method).
- Plater.hpp loses the declaration; Plater.cpp dispatches to the agent
inline within sync_ams_list() and owns only the dialog + post-sync UI
refresh (combo updates, layout, preset selection, persistence).
Two CFS-related entry points on the agent now coexist:
- fetch_filament_info() — agent-driven path; publishes via AmsTrayData
and build_ams_payload(). Active when a MachineObject is bound (BBL
concept, not currently created for Creality LAN hosts).
- sync_filaments_into_ams_list() — explicit-pull path used today by the
Sidebar's "Sync filaments" button until the K-series MachineObject
work catches up.
No user-visible behaviour change — same end-to-end flow, the data work
just lives in the agent now.
Per @SoftFever review on #13752, third-party vendored libraries belong in
deps_src/ alongside expat, imgui, hidapi, etc.
- All 5 files (mdns.{h,c}, cxmdns.{h,cpp}, NOTICE.md) move from
src/slic3r/Utils/mdns/ to deps_src/mdns/.
- deps_src/mdns/CMakeLists.txt builds mdns as a STATIC library and scopes
the MSVC Iphlpapi/Ws2_32 link requirement to that target instead of
libslic3r_gui's global MSVC block.
- deps_src/CMakeLists.txt gains add_subdirectory(mdns).
- src/slic3r/CMakeLists.txt drops the inline source listings and links
libslic3r_gui against the new mdns target; MSVC block keeps only
Setupapi.lib.
- src/slic3r/Utils/CrealityHostDiscovery.cpp #include updated to use the
include dir exposed by the new mdns target.
Verified by a clean Linux build (orca-slicer links successfully).
When a user adds a Creality K-series printer (host_type=crealityprint)
and clicks the existing "Browse" button in the Physical Printer dialog,
dispatch to a new CrealityDiscoveryDialog that finds K2 / K2 Plus /
K2 Pro printers on the LAN automatically. For other host types the
button keeps its existing BonjourDialog behaviour.
CrealityHostDiscovery (src/slic3r/Utils/CrealityHostDiscovery.{hpp,cpp})
Wraps the vendored cxmdns wrapper from the previous commit:
static std::vector<CrealityHost> scan(bool probe_info = true);
Calls cxnet::syncDiscoveryService({"Creality", "creality"}) to find
K-series printers via DNS-SD, dedupes by IP, then optionally HTTP
GETs http://<ip>/info on each match to fetch the model code
(F008 = K2 Plus, F012 = K2 Pro, F021 = K2) and MAC. Returns enriched
{ip, hostname, model_code, model_name, mac, cfs_capable} entries.
CrealityDiscoveryDialog (src/slic3r/GUI/CrealityDiscoveryDialog.{hpp,cpp})
Modal dialog with a wxListView showing Model / Hostname / IP per
discovered host. Runs CrealityHostDiscovery::scan() synchronously
with wxBusyCursor + wxWindowDisabler (5-10s total wait). User picks
one, dialog returns the IP via selected_ip().
PhysicalPrinterDialog (src/slic3r/GUI/PhysicalPrinterDialog.cpp)
The "Browse" button's click handler now reads host_type from the
edited config. If htCrealityPrint, opens CrealityDiscoveryDialog
and writes "http://<ip>" into the print_host field. Otherwise the
existing BonjourDialog path runs unchanged -- no behaviour change
for OctoPrint / Moonraker / Klipper users.
No new UI surface: one existing button now does the right thing per
host_type, mirroring how Creality Print discovers its own printers.
Drop a public-domain mDNS / DNS-SD lookup library into the tree at
src/slic3r/Utils/mdns/. Two pieces:
mdns.{h,c} -- public-domain library by Mattias Jansson from
https://github.com/mjansson/mdns
cxmdns.{h,cpp} -- C++ wrapper from CrealityOfficial/CrealityPrint
v7.1.1 (AGPL-3.0, compatible with OrcaSlicer's
AGPL-3.0)
cxmdns exposes one function:
std::vector<machine_info> cxnet::syncDiscoveryService(
const std::vector<std::string>& prefix);
It sends a DNS-SD meta-discovery query (_services._dns-sd._udp.local.),
listens ~5 seconds, and returns {ip, service_name} for every service
announcement whose name contains any of the given prefixes.
Motivation: Creality K-series firmware announces each printer under a
per-device-unique service type _Creality-<MAC-derived-hex>._udp.local.,
so OrcaSlicer's existing Bonjour code (which queries fixed service
names like _octoprint._tcp) cannot find them. The DNS-SD meta-browser
approach implemented here is the standard way to discover services
when you do not know their exact names in advance.
mdns.c calls GetAdaptersAddresses (iphlpapi) and Winsock2 functions,
neither of which were on libslic3r_gui's MSVC link line; both are
added here so the vendored sources compile and link standalone.
Attribution captured in src/slic3r/Utils/mdns/NOTICE.md. No callers
yet; the K-series discovery class + UI lands in the next commit.
The matcher tiebreaker previously preferred user-edited filament
presets over system bases on a tied score. For a K2 owner who has
a custom copy of Creality Generic PLA @K2-all called eg
Creality Hyper PLA @K2 (mine), the matcher scored both that copy
and the shipped brand-specific Hyper PLA @Creality K2 0.4 nozzle
at 30, then tiebreak picked the user copy. User copies inherit
filament_id from their parent -- in this case the generic PLA
GFL99 -- so the returned id pointed at Generic PLA, not at
Hyper PLA brand-specific id (01001). PresetBundle::sync_ams_list
then resolved by id back to Creality Generic PLA @K2-all, visibly
losing the brand on every sync.
Flip the tiebreaker to prefer system over user. The shipped
brand-specific preset always wins now and sync_ams_list lands on
the right slot label.
Drop the post-sync user-override step from the sidebar path that
was layered on to compensate -- silently substituting the user
local tuning is the wrong default for an upstream-shipped
feature; users who want their local tuning on a synced slot still
get to it via the existing combo dropdown.
The agent fetch_filament_info() path does not fire for Creality
K-series hosts because Sidebar::build_filament_ams_list()
short-circuits when no MachineObject is bound. MachineObject is a
BBL cloud-connected-printer concept that does not apply to LAN
Moonraker-style hosts like the K2 -- the AMS-sync icon click was a
no-op for them.
Mirror what Creality Print own slicer does (explicit Auto Mapping
button bypassing the BBL plumbing): when the user clicks the
existing AMS-sync icon and host_type=crealityprint, dispatch to a
new Sidebar::sync_filaments_from_creality_cfs() that reads the
active printer host config, confirms the printer is a CFS-capable
K-series board, queries boxsInfo over the printer WS on port 9999,
scores each loaded slot against the user filament presets and
builds a filament_ams_list entry with the matched filament_id,
colour and slot indices, then routes through
PresetBundle::sync_ams_list so the filament combo widgets get the
same rebuild as BBL printers and runs the BBL post-sync refresh
sequence (on_filament_count_change + combo update + select_preset
+ export_selections + update_dynamic_filament_list).
No new UI surface -- the existing AMS-sync icon does the right
thing per host_type. Match-and-resolve logic is hoisted out of the
agent anonymous namespace into public statics so the sidebar can
call it without duplicating scoring rules.
K-series printers (K2, K2 Plus, K2 Pro) ship with Mainsail on port
4408. Port 80 hosts only the Creality control/upload API, which
returns 404 for unknown paths and renders as a blank/404 page in
Orca Device tab.
Override CrealityPrint::get_print_host_webui() to default to
http://<host>:4408/ when the user has not explicitly set
print_host_webui, giving K-series owners a complete printer
dashboard in the Device tab out of the box.
Score visible compatible filament presets against the CFS spool
(vendor, brand_name, type) tuple to pick the right preset:
+20 preset name contains the brand_name as a substring
(eg Hyper PLA in Hyper PLA @Creality K2 0.4 nozzle)
+10 preset name contains the vendor substring (eg Creality)
Requires preset.filament_type to equal the spool base type so a
PETG preset is never auto-picked for a PLA spool. Falls back to
filaments.filament_id_by_type(base_type) when nothing scores.
Considers both base/system presets and user-derived copies -- K2
owners frequently keep tweaked copies of system presets (per-spool
PA, temps), so filtering to bases-only would skip exactly the
presets users care about most.
Subclass of MoonrakerPrinterAgent for K-series Creality printers
(K2, K2 Plus, K2 Pro) with CFS support. Registers in
NetworkAgentFactory under host_type=crealityprint. Overrides
fetch_filament_info() to defer to base when the host is not a
CFS-capable K-series board, otherwise query the boxsInfo WebSocket
on port 9999, parse the box hierarchy into CFSSlot[], and publish
each loaded slot as an AmsTrayData entry via build_ams_payload()
so they surface in Orca filament UI.
boxsInfo schema reference (verified against K2 Combo F021 firmware
v1.1.260206):
materialBoxs[].materials[] fields: id, state, vendor, type, name,
color, pressure, rfid, percent. state=1 means loaded; box.type=0
is a CFS unit, type=1 is the external spool holder (handled by
the upload dialog).
Accepted CFS boxes are renumbered sequentially since the K2 raw
box.id has gaps for the external spool holder. Model detection is
delegated to CrealityPrint::supports_multi_color_print() added in
PR #13291.
* feat: add UI feedback on http error and some logs
* spelling fix
* show error dialog only once per session
* show errors with plater notification when on developer mode
* remove return
* remove irrelevant logs
GridCellSupportEditor::DoActivate dereferenced
grid->GetSelectedBlocks().begin() without checking against end(). In
wxWidgets 3.1.5 that range always contained at least one block; in 3.3.2
it is empty after the user deselects, and the dereference crashes inside
wxGridBlockCoords::GetLeftCol().
Fall back to the (row, col) that triggered activation when the selection
is empty, so the existing single-cell branch handles it. While here,
drop a dead local_table cast that was never read.
Fix macOS orcaslicer:// deep links after wxWidgets 3.3.2 upgrade
Install an OrcaSlicer-owned kAEGetURL Apple Event handler from
on_init_inner(). The wxWidgets 3.3.2 handler registered in
applicationWillFinishLaunching: stopped delivering URL events to
GUI_App::MacOpenURL on macOS (#13119), so links from Printables /
Thingiverse opened a blank project instead of importing the model.
Registering our own handler late in startup is last-writer-wins on
NSAppleEventManager and routes back to the existing MacOpenURL ->
start_download path, restoring the pre-upgrade behavior without
touching wxWidgets.
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Use glBlendFuncSeparate in GLTexture::render_sub_texture so destination
alpha stays at 1.0. The Wayland compositor honors framebuffer alpha for window compositing; the previous straight-alpha blend reduced dst alpha
at anti-aliased icon edges, making them semi-transparent against the
desktop. RGB blending is unchanged, so X11/Windows/macOS are unaffected.
Delay opening the object-list filament dropdown on wxGTK until the editor
window is mapped, avoiding popup creation without a valid native toplevel.
Also set the GTK transient parent for dropdown popups created from data-view
cell editors.
# Description
Currently, there is some suspicious behavior going on with the logout
flow, adding some logs to potentially catch any unwanted logouts or
unintentional behaviors.
[How to Download Pull Requests Artifacts for
Testing](https://www.orcaslicer.com/wiki/how_to_download_pr_artifacts)
When the spool holder is selected for printing, use the opGcodeFile
command with enableSelfTest instead of colorMatch + multiColorPrint.
This matches the protocol used by CrealityPrint desktop for spool
holder prints.
- Detect spool holder mode: any colorMatch entry with box_id 0
- Spool holder: send opGcodeFile + enableSelfTest (single command)
- CFS: send colorMatch + multiColorPrint (existing behavior)
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Show the spool holder (external filament roll) as a selectable option
in the K2 Plus filament mapping dialog. Previously only CFS slots were
shown because the box state filter excluded the spool holder.
- Only skip inactive CFS boxes (type 0, state != 1); spool holder
(type 1) is always available
- Label spool holder slots as "Ext - {type}" in the dropdown
- Auto-match priority is now:
1. CFS exact (type + color)
2. CFS type-only
3. Ext exact (type + color)
4. Ext type-only
5. Positional default
- When Ext is selected (by user or auto-match), disable other combos
since firmware does not support mixing CFS and spool holder
Signed-off-by: Igor Mammedov <niallain@gmail.com>
When the filament mapping dialog opens, automatically select the best
matching CFS slot for each gcode filament by comparing color and type.
Falls back to positional index if no exact match is found.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Query CFS material slots and show colored dropdowns to map gcode
filaments to physical printer slots. Color mapping is passed through
extended_info as colorMatch entries for the multi-color print protocol.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
v4:
- Use gcode tool index (T1A, T1B, ...) as colorMatch id instead of
CFS slot tool_id — firmware expects the gcode filament identifier,
not the destination slot
Add enableSelfTest checkbox to CrealityPrintHostSendDialog that
persists across sessions via AppConfig. The checkbox state is
passed to the upload via extendedInfo().
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Add model_name() to map firmware model codes (F008, F012, F021)
to human-readable names (K2 Plus, K2 Pro, K2). Update the send
dialog init() to detect multi-color support and show a group box
with the printer name.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Add CrealityPrintHostSendDialog scaffolding: an empty dialog class
that inherits from PrintHostSendDialog, and Plater wiring to use
it when the host type is CrealityPrint.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
For supported models, start_print() sends colorMatch (filament-to-slot
mapping) followed by multiColorPrint (with optional calibration via
enableSelfTest) instead of the legacy opGcodeFile command. The dialog
passes color mapping and calibration settings through extended_info.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
---
v4:
- Skip "path" form field in multipart upload for multi-color printers
(extra field breaks K2 Plus firmware parser)
- Use fire-and-forget ws.write() for colorMatch and multiColorPrint
instead of ws_send_and_read() (printer sends response asynchronously)
Add query_boxes_info() to discover loaded materials in the CFS
(Creality Filament System) via websocket. Returns the boxsInfo
JSON with slot details (type, color, vendor, temperature range).
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Add a reusable websocket helper that sends a JSON command and loops
reads until finding a response containing the expected key. This
handles the printer's unsolicited status messages that arrive on
connect before the actual response. Returns empty string on timeout
instead of throwing.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Consolidate websocket connection setup into a reusable helper.
Migrate from tcp::socket to beast::tcp_stream for timeout support.
Set SO_RCVTIMEO read timeout (3s) and connect timeout (5s).
Refactor query_boxes_info() and start_print() to use ws_connect().
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Parse the model field from the /info JSON response to enable
model-specific features. Add supports_multi_color_print() which
returns true for K2-platform printers (K2 Plus, K2 Pro, K2).
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Change start_print() from void to bool with a wxString& msg
out-parameter, matching the error handling pattern used by Duet,
MKS, ESP3D and Flashforge. On failure, the error message is now
reported to the user via error_fn instead of being silently
swallowed. Use BOOST_LOG_TRIVIAL for logging instead of std::cerr.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Move duplicate get_host_from_url() implementations from ElegooLink and
OctoPrint into Http as a static method using the curl_url API. This
eliminates code duplication and provides a single reliable URL host
extraction utility for all print host implementations.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
get_host_from_url() returns host:port which may cause
boost::asio::ip::make_address() to fail when a port is present,
bypassing the direct IP upload path and falling through to DNS
resolution via upload_inner_with_host(). Use get_host_from_url_no_port()
to extract just the host.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
* unify footer
adds "Done" Buttons,
standardize "Reset" Buttons,
adds disabled logic to "Reset" Buttons
* adds ImGuiWrapper::COL_WARNING = ColorRGB:Warning,
replaces ColorRGB::Warning
* consistently display warnings,
moves assermbly warning after footer,
make cut warnings warning color
* adds separator above cut warnings
* adds tooltip entry in move, rotate & scale for auto-drop
* use wrapper tooltip in wrapper->button for consistent text color
* restructures brim ears button,
renames "Reset" button in painting tools to "Erase All",
small styling fixes
* small adjustments,
moves "Edge detection" checkbox in painting tool underneath,
moves "Section View" in Brim ears tool after buttons,
moves warnings in Assemble tool under footer
* small brim ear tool structure changes,
adds separator between "Head Diameter" and "Max angle",
adds tooltip to "Auto-generate" button,
rewords shortcut descriptions to match other tools
---------
Co-authored-by: Hanno Witzleb <hannowitzleb@gmail.com>
* adds UI and preview plane for multiple dovetail cuts
* adds multiple dovetail cuts to perform_with_groove()
* adds ui text info for spacing, adjusts max_val for gap to respect plate dimensions
* adds spacing before multpile UI
* adjusts wording, adjust gap max by count
---------
Co-authored-by: Hanno Witzleb <hannowitzleb@gmail.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
* Add logic to handle the left, middle and right buttons being assigned to do nothing, pan or rotate
* Add entries for setting the drag actions to preferences
* Allow the label text in preferences to wrap
* Show mouse mappings in Help -> Keyboard Shortcuts
* Re-add preferences in updated layout
* Add camera mouse options under camera
* Change mouse action strings to use L() for localization
* Display "None" when it is selected instead of blank in keyboard shortcuts
---------
Co-authored-by: Rob O <robertolabode@gmail.com>
Co-authored-by: Noisyfox <timemanager.rick@gmail.com>