OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::anonymous_namespace{NativeCommands.cpp} Namespace Reference

Classes

struct  CommandAction

Functions

bool is_fff_plater (Plater *plater)
AppActionRunResult plate_unavailable ()
void ensure_3d_view (Plater *plater)
AppActionRunResult object_op (Plater *plater, bool(*ok)(Plater *), void(*op)(Plater *))
void go_to_layer (Plater *plater, const std::string &param)
AppActionRunResult view_command (Plater *plater, const std::string &dir)
AppActionRunResult calib_command (CalibKind kind)
std::vector< NativeCommand > build_command_catalog ()

Variables

constexpr const char * kCommandPrefix = "orca_command"

Function Documentation

◆ build_command_catalog()

std::vector< NativeCommand > Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::build_command_catalog ( )
159{
160 std::vector<NativeCommand> out;
161 // `title` and `group` are the untranslated English msgids, L("...")-marked at each call so xgettext
162 // extracts them.
163 auto add = [&](std::string key, std::string title, std::string group, std::function<AppActionRunResult(const std::string&)> runner,
164 std::string input = {}, std::string icon = {}) {
165 out.push_back({std::move(key), std::move(title), std::move(group), std::move(input), std::move(icon), std::move(runner)});
166 };
167 // Presentation-first overload: keeps the tile icon next to the title/group it belongs to.
168 auto add_with_icon = [&](std::string key, std::string title, std::string group, std::string icon,
169 std::function<AppActionRunResult(const std::string&)> runner, std::string input = {}) {
170 add(std::move(key), std::move(title), std::move(group), std::move(runner), std::move(input), std::move(icon));
171 };
172
173 // ---- Slice & Export ----
174 add_with_icon("slice_and_preview", L("Slice and Preview"), L("Slice & Export"), "media_play", [](const std::string&) {
175 Plater* plater = wxGetApp().plater();
176 if (plater) {
177 plater->reslice();
178 plater->select_view_3D("Preview", false);
179 if (MainFrame* mf = wxGetApp().mainframe; mf)
180 mf->select_tab(TAB_ID_PREVIEW);
181 }
182 return AppActionRunResult{AppActionRunResult::Level::Success};
183 });
184
185 add_with_icon(
186 "go_to_layer", L("Go to layer (percent)"), L("Commands"), "height_range_layer",
187 [](const std::string& param) {
188 Plater* plater = wxGetApp().plater();
189 if (plater) {
190 plater->select_view_3D("Preview", false);
191 if (MainFrame* mf = wxGetApp().mainframe; mf)
192 mf->select_tab(TAB_ID_PREVIEW);
193 go_to_layer(plater, param);
194 }
195 return AppActionRunResult{AppActionRunResult::Level::Success};
196 },
197 "percent");
198
199 // "go_to_tab" is two-phase: the palette collects the tab after activating it, then hands the tab
200 // id back as `param` (same contract as go_to_layer's percent).
201 add(
202 "go_to_tab", L("Go to tab..."), L("Commands"),
203 [](const std::string& param) {
204 if (MainFrame* mf = wxGetApp().mainframe; mf && !param.empty())
205 mf->select_tab(from_u8(param));
206 return AppActionRunResult{AppActionRunResult::Level::Success};
207 },
208 "tab");
209
210 add_with_icon("load_project", L("Load Project"), L("Commands"), "menu_open", [](const std::string&) {
211 if (Plater* plater = wxGetApp().plater())
213 return AppActionRunResult{AppActionRunResult::Level::Success};
214 });
215 add_with_icon("save_project", L("Save Project"), L("Commands"), "menu_save", [](const std::string&) {
216 if (Plater* plater = wxGetApp().plater())
217 plater->save_project(false);
218 return AppActionRunResult{AppActionRunResult::Level::Success};
219 });
220 add_with_icon("save_project_as", L("Save Project As"), L("Commands"), "menu_save", [](const std::string&) {
221 if (Plater* plater = wxGetApp().plater())
222 plater->save_project(true);
223 return AppActionRunResult{AppActionRunResult::Level::Success};
224 });
225 add_with_icon("open_preferences", L("Preferences"), L("Commands"), "cog", [](const std::string&) {
226 wxGetApp().open_preferences();
227 return AppActionRunResult{AppActionRunResult::Level::Success};
228 });
229
230 // ---- Mode ----
231 add_with_icon("mode_simple", L("Mode: Simple"), L("Mode"), "advanced", [](const std::string&) {
232 wxGetApp().set_mode(comSimple);
233 return AppActionRunResult{AppActionRunResult::Level::Success};
234 });
235 add_with_icon("mode_advanced", L("Mode: Advanced"), L("Mode"), "advanced", [](const std::string&) {
236 wxGetApp().set_mode(comAdvanced);
237 return AppActionRunResult{AppActionRunResult::Level::Success};
238 });
239 add_with_icon("mode_expert", L("Mode: Expert"), L("Mode"), "advanced", [](const std::string&) {
240 wxGetApp().set_mode(comExpert);
241 return AppActionRunResult{AppActionRunResult::Level::Success};
242 });
243 // Mirrors Preferences > Developer > Developer mode: flip the flag, persist, refresh the UI.
244 add_with_icon("toggle_developer_mode", L("Toggle Developer Mode"), L("Mode"), "advanced", [](const std::string&) {
245 GUI_App& app = wxGetApp();
246 const bool on = !app.app_config->get_bool("developer_mode");
247 app.app_config->set_bool("developer_mode", on);
248 app.app_config->save();
249 app.update_mode();
250 return AppActionRunResult{AppActionRunResult::Level::Success, on ? _L("Developer mode enabled.") : _L("Developer mode disabled.")};
251 });
252
253 // ---- Export pipeline ----
254 add_with_icon("export_gcode", L("Export G-code"), L("Slice & Export"), "custom-gcode_gcode", [](const std::string&) {
255 if (Plater* plater = wxGetApp().plater())
256 plater->export_gcode(false);
257 return AppActionRunResult{AppActionRunResult::Level::Success};
258 });
259 add_with_icon("export_stl", L("Export STL"), L("Slice & Export"), "save", [](const std::string&) {
260 if (Plater* plater = wxGetApp().plater())
262 return AppActionRunResult{AppActionRunResult::Level::Success};
263 });
264 add_with_icon("export_3mf", L("Export 3MF"), L("Slice & Export"), "menu_save", [](const std::string&) {
265 if (Plater* plater = wxGetApp().plater())
267 return AppActionRunResult{AppActionRunResult::Level::Success};
268 });
269 add_with_icon("export_sliced_file", L("Export Sliced File"), L("Slice & Export"), "save", [](const std::string&) {
270 if (Plater* plater = wxGetApp().plater())
271 plater->export_gcode_3mf(false);
272 return AppActionRunResult{AppActionRunResult::Level::Success};
273 });
274 add_with_icon("export_all_sliced_file", L("Export All Sliced Files"), L("Slice & Export"), "save", [](const std::string&) {
275 if (Plater* plater = wxGetApp().plater())
277 return AppActionRunResult{AppActionRunResult::Level::Success};
278 });
279
280 // ---- Calibration ----
281 // The tab-strip calib_sf glyph is drawn white for the dark tab bar and vanishes on the palette's
282 // light tile, so each wizard borrows the matching settings-group icon instead (gray + accent green).
283 add_with_icon("calib_temperature", L("Temperature Calibration"), L("Calibration"), "param_temperature",
284 [](const std::string&) { return calib_command(CalibKind::Temperature); });
285 add_with_icon("calib_max_volumetric", L("Max Volumetric Speed Calibration"), L("Calibration"), "param_volumetric_speed",
286 [](const std::string&) { return calib_command(CalibKind::MaxVolumetric); });
287 add_with_icon("calib_pressure_advance", L("Pressure Advance Calibration"), L("Calibration"), "param_flow_ratio_and_pressure_advance",
288 [](const std::string&) { return calib_command(CalibKind::PressureAdvance); });
289 add_with_icon("calib_flow_ratio", L("Flow Ratio Calibration"), L("Calibration"), "param_flow_ratio_and_pressure_advance",
290 [](const std::string&) { return calib_command(CalibKind::FlowRatio); });
291 add_with_icon("calib_retraction", L("Retraction Calibration"), L("Calibration"), "param_retraction",
292 [](const std::string&) { return calib_command(CalibKind::Retraction); });
293 add_with_icon("calib_cornering", L("Cornering Calibration"), L("Calibration"), "param_precision",
294 [](const std::string&) { return calib_command(CalibKind::Cornering); });
295 add_with_icon("calib_input_shaping_freq", L("Input Shaping Frequency Calibration"), L("Calibration"), "param_resonance_avoidance",
296 [](const std::string&) { return calib_command(CalibKind::InputShapingFreq); });
297 add_with_icon("calib_input_shaping_damp", L("Input Shaping Damping Calibration"), L("Calibration"), "param_resonance_avoidance",
298 [](const std::string&) { return calib_command(CalibKind::InputShapingDamp); });
299 add_with_icon("calib_vfa", L("VFA Calibration"), L("Calibration"), "param_speed", [](const std::string&) { return calib_command(CalibKind::VFA); });
300
301 // ---- View ----
302 // Titles are L("...")-marked here (not via a variable) so xgettext can extract them.
303 for (auto [key, dir, title] :
304 std::initializer_list<std::tuple<const char*, const char*, std::string>>{{"view_top", "top", L("View: Top")},
305 {"view_bottom", "bottom", L("View: Bottom")},
306 {"view_front", "front", L("View: Front")},
307 {"view_rear", "rear", L("View: Rear")},
308 {"view_left", "left", L("View: Left")},
309 {"view_right", "right", L("View: Right")},
310 {"view_iso", "iso", L("View: Isometric")}}) {
311 std::string k = key, d = dir;
312 add(k, title, L("View"),
313 [d](const std::string&) { return view_command(wxGetApp().plater(), d); });
314 }
315 add("view_default", L("View: Default"), L("View"), [](const std::string&) {
316 Plater* plater = wxGetApp().plater();
317 if (plater) {
318 plater->select_view("plate");
319 if (GLCanvas3D* canvas = plater->get_current_canvas3D())
320 canvas->zoom_to_bed();
321 }
322 return AppActionRunResult{AppActionRunResult::Level::Success};
323 });
324 add("view_fit_bed", L("Fit Bed to View"), L("View"), [](const std::string&) {
325 if (Plater* plater = wxGetApp().plater())
326 if (GLCanvas3D* canvas = plater->get_current_canvas3D())
327 canvas->zoom_to_bed();
328 return AppActionRunResult{AppActionRunResult::Level::Success};
329 });
330 add("view_toggle_perspective", L("Toggle Perspective"), L("View"), [](const std::string&) {
331 if (Plater* plater = wxGetApp().plater())
333 return AppActionRunResult{AppActionRunResult::Level::Success};
334 });
335 add_with_icon("reset_window_layout", L("Reset Window Layout"), L("View"), "toolbar_reset", [](const std::string&) {
336 if (Plater* plater = wxGetApp().plater())
338 return AppActionRunResult{AppActionRunResult::Level::Success};
339 });
340
341 // ---- Object ----
342 add_with_icon("obj_delete", L("Delete Selected"), L("Object"), "delete", [](const std::string&) {
343 return object_op(wxGetApp().plater(), [](Plater* p) { return !p->is_selection_empty(); }, [](Plater* p) { p->remove_selected(); });
344 });
345 add_with_icon("obj_delete_all", L("Delete All Objects"), L("Object"), "delete", [](const std::string&) {
346 return object_op(
347 wxGetApp().plater(), [](Plater* p) { return p->can_delete_all(); }, [](Plater* p) { p->delete_all_objects_from_model(); });
348 });
349 add_with_icon("obj_mirror_x", L("Mirror X"), L("Object"), "menu_mirror_x", [](const std::string&) {
350 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_mirror(); }, [](Plater* p) { p->mirror(Axis::X); });
351 });
352 add_with_icon("obj_mirror_y", L("Mirror Y"), L("Object"), "menu_mirror_y", [](const std::string&) {
353 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_mirror(); }, [](Plater* p) { p->mirror(Axis::Y); });
354 });
355 add_with_icon("obj_mirror_z", L("Mirror Z"), L("Object"), "menu_mirror_z", [](const std::string&) {
356 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_mirror(); }, [](Plater* p) { p->mirror(Axis::Z); });
357 });
358 add_with_icon("obj_split_objects", L("Split to Objects"), L("Object"), "menu_split_objects", [](const std::string&) {
359 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_split_to_objects(); }, [](Plater* p) { p->split_object(true); });
360 });
361 add_with_icon("obj_split_parts", L("Split to Parts"), L("Object"), "menu_split_parts", [](const std::string&) {
362 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_split_to_volumes(); }, [](Plater* p) { p->split_volume(); });
363 });
364 add("obj_center", L("Center Selected on Plate"), L("Object"), [](const std::string&) {
365 return object_op(wxGetApp().plater(), [](Plater* p) { return !p->is_selection_empty(); }, [](Plater* p) { p->center_selection(); });
366 });
367 add_with_icon("obj_drop", L("Drop to Bed"), L("Object"), "toolbar_flatten", [](const std::string&) {
368 return object_op(wxGetApp().plater(), [](Plater* p) { return p->get_selection().can_drop(); }, [](Plater* p) { p->drop_selection(); });
369 });
370 add("obj_fit_volume", L("Scale to Fit Print Volume"), L("Object"), [](const std::string&) {
371 return object_op(
372 wxGetApp().plater(), [](Plater* p) { return p->can_scale_to_print_volume(); },
373 [](Plater* p) { p->scale_selection_to_fit_print_volume(); });
374 });
375 add_with_icon("obj_instances_up", L("Increase Instances"), L("Object"), "instance_add", [](const std::string&) {
376 return object_op(
377 wxGetApp().plater(), [](Plater* p) { return p->can_increase_instances(); }, [](Plater* p) { p->increase_instances(); });
378 });
379 add_with_icon("obj_instances_down", L("Decrease Instances"), L("Object"), "instance_remove", [](const std::string&) {
380 return object_op(
381 wxGetApp().plater(), [](Plater* p) { return p->can_decrease_instances(); }, [](Plater* p) { p->decrease_instances(); });
382 });
383 add_with_icon("obj_arrange", L("Auto-Arrange"), L("Object"), "toolbar_arrange", [](const std::string&) {
384 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_arrange(); }, [](Plater* p) { p->arrange(); });
385 });
386 add_with_icon("obj_orient", L("Auto-Orient"), L("Object"), "toolbar_orient", [](const std::string&) {
387 return object_op(wxGetApp().plater(), [](Plater* p) { return p->can_arrange(); }, [](Plater* p) { p->orient(); });
388 });
389
390 // ---- Add Primitive ---- (the Add > Add Primitive submenu; creates a new object)
391 auto add_primitive = [&](std::string key, std::string title, std::string icon, const char* type_name) {
392 add_with_icon(std::move(key), std::move(title), L("Add Primitive"), std::move(icon), [type_name](const std::string&) {
393 Plater* plater = wxGetApp().plater();
394 if (plater) {
396 if (ObjectList* list = wxGetApp().obj_list())
397 list->load_generic_subobject(type_name, ModelVolumeType::INVALID);
398 }
399 return AppActionRunResult{AppActionRunResult::Level::Success};
400 });
401 };
402 add_primitive("add_primitive_cube", L("Cube"), "menu_obj_cube", "Cube");
403 add_primitive("add_primitive_cylinder", L("Cylinder"), "menu_obj_cylinder", "Cylinder");
404 add_primitive("add_primitive_sphere", L("Sphere"), "menu_obj_sphere", "Sphere");
405 add_primitive("add_primitive_cone", L("Cone"), "menu_obj_cone", "Cone");
406 add_primitive("add_primitive_disc", L("Disc"), "menu_obj_disc", "Disc");
407 add_primitive("add_primitive_torus", L("Torus"), "menu_obj_torus", "Torus");
408 add_with_icon("add_primitive_text", L("Text"), L("Add Primitive"), "menu_obj_text", [](const std::string&) {
409 Plater* plater = wxGetApp().plater();
410 if (plater) {
412 if (GLCanvas3D* canvas = plater->canvas3D())
413 canvas->clear_popup_menu_position();
415 }
416 return AppActionRunResult{AppActionRunResult::Level::Success};
417 });
418 add_with_icon("add_primitive_svg", L("SVG"), L("Add Primitive"), "menu_obj_svg", [](const std::string&) {
419 Plater* plater = wxGetApp().plater();
420 if (plater) {
422 if (GLCanvas3D* canvas = plater->canvas3D())
423 canvas->clear_popup_menu_position();
425 }
426 return AppActionRunResult{AppActionRunResult::Level::Success};
427 });
428
429 // ---- Add Handy models ---- (the Add > Add Handy models submenu)
430 const std::vector<MenuFactory::HandyModel>& handy = MenuFactory::handy_models();
431 for (std::size_t i = 0; i < handy.size(); ++i) {
432 add("add_handy_" + std::string(handy[i].key), handy[i].label, L("Add Handy models"),
433 [i](const std::string&) {
434 if (Plater* plater = wxGetApp().plater())
437 return AppActionRunResult{AppActionRunResult::Level::Success};
438 });
439 }
440
441 // ---- Plate ----
442 add_with_icon("plate_add", L("Add Plate"), L("Plate"), "toolbar_add_plate", [](const std::string&) {
443 Plater* plater = wxGetApp().plater();
444 if (!is_fff_plater(plater))
445 return plate_unavailable();
446 if (!plater->can_add_plate())
447 return AppActionRunResult{AppActionRunResult::Level::Info, _L("Cannot add another plate (maximum reached).")};
448 plater->add_plate();
449 return AppActionRunResult{AppActionRunResult::Level::Success};
450 });
451 add_with_icon("plate_duplicate", L("Duplicate Plate"), L("Plate"), "menu_copy", [](const std::string&) {
452 Plater* plater = wxGetApp().plater();
453 if (!is_fff_plater(plater))
454 return plate_unavailable();
455 if (!plater->can_add_plate())
456 return AppActionRunResult{AppActionRunResult::Level::Info, _L("Cannot duplicate a plate (maximum reached).")};
458 return AppActionRunResult{AppActionRunResult::Level::Success};
459 });
460 add_with_icon("plate_delete", L("Delete Plate"), L("Plate"), "delete", [](const std::string&) {
461 Plater* plater = wxGetApp().plater();
462 if (!is_fff_plater(plater))
463 return plate_unavailable();
464 if (!plater->can_delete_plate())
465 return AppActionRunResult{AppActionRunResult::Level::Info, _L("Cannot delete the only plate.")};
467 return AppActionRunResult{AppActionRunResult::Level::Success};
468 });
469 add_with_icon("plate_rename", L("Rename Plate"), L("Plate"), "plate_name_edit", [](const std::string&) {
470 Plater* plater = wxGetApp().plater();
471 if (!is_fff_plater(plater))
472 return plate_unavailable();
473 PartPlate* curr = plater->get_partplate_list().get_curr_plate();
474 PlateNameEditDialog dlg((wxWindow*) wxGetApp().mainframe, wxID_ANY, _L("Edit Plate Name"));
475 dlg.set_plate_name(from_u8(curr->get_plate_name()));
476 if (dlg.ShowModal() == wxID_YES)
477 curr->set_plate_name(dlg.get_plate_name().ToUTF8().data());
478 return AppActionRunResult{AppActionRunResult::Level::Success};
479 });
480 add_with_icon("plate_toggle_lock", L("Toggle Plate Lock"), L("Plate"), "lock_normal", [](const std::string&) {
481 Plater* plater = wxGetApp().plater();
482 if (!is_fff_plater(plater))
483 return plate_unavailable();
484 PartPlateList& plates = plater->get_partplate_list();
485 const int index = plates.get_curr_plate_index();
486 plater->take_snapshot("lock partplate");
487 plates.lock_plate(index, !plates.is_locked(index));
488 return AppActionRunResult{AppActionRunResult::Level::Success};
489 });
490 add_with_icon("plate_goto", L("Go to Plate"), L("Plate"), "go_next_plate", [](const std::string& param) {
491 Plater* plater = wxGetApp().plater();
492 if (!is_fff_plater(plater))
493 return plate_unavailable();
494 PartPlateList& plates = plater->get_partplate_list();
495 const int count = plates.get_plate_count();
496 if (count <= 0)
497 return AppActionRunResult{AppActionRunResult::Level::Info, _L("No plates available.")};
498 int index = 0;
499 try {
500 index = std::stoi(param);
501 } catch (const std::exception&) {}
502 index = std::clamp(index, 0, count - 1);
503 plater->select_plate(index, false);
504 return AppActionRunResult{AppActionRunResult::Level::Success};
505 });
506
507 // ---- Printer / device connection ----
508 add_with_icon("sync_ams", L("Synchronize Filament List from AMS"), L("Printer"), "ams_fila_sync", [](const std::string&) {
509 Plater* plater = wxGetApp().plater();
510 DeviceManager* dev = wxGetApp().getDeviceManager();
511 if (dev && dev->get_selected_machine() && plater) {
513 return AppActionRunResult{AppActionRunResult::Level::Success};
514 }
515 return AppActionRunResult{AppActionRunResult::Level::Info, _L("Connect a printer to synchronize the AMS filament list.")};
516 });
517
518 // ---- Presets / cloud ----
519 add_with_icon("preset_bundle", L("Open Preset Bundle"), L("Presets"), "menu_edit_preset", [](const std::string&) {
520 wxGetApp().open_presetbundledialog();
521 return AppActionRunResult{AppActionRunResult::Level::Success};
522 });
523 add_with_icon("sync_presets", L("Sync Presets"), L("Presets"), "printer_sync_ok", [](const std::string&) {
524 if (!wxGetApp().is_user_login())
525 return AppActionRunResult{AppActionRunResult::Level::Info, _L("Sign in to sync presets.")};
526 wxGetApp().restart_sync_user_preset();
527 return AppActionRunResult{AppActionRunResult::Level::Success};
528 });
529
530 // ---- Import ----
531 add_with_icon("import_file", L("Import 3MF/STL/STEP/SVG/OBJ/AMF"), L("Import"), "menu_open", [](const std::string&) {
532 if (Plater* plater = wxGetApp().plater()) {
533#ifdef __APPLE__
534 plater->add_model();
535#else
536 plater->add_file();
537#endif
538 }
539 return AppActionRunResult{AppActionRunResult::Level::Success};
540 });
541 add_with_icon("import_zip_archive", L("Import ZIP Archive"), L("Import"), "menu_open", [](const std::string&) {
542 if (Plater* plater = wxGetApp().plater())
544 return AppActionRunResult{AppActionRunResult::Level::Success};
545 });
546 add_with_icon("import_configs", L("Import Configs"), L("Import"), "menu_open", [](const std::string&) {
547 if (MainFrame* mf = wxGetApp().mainframe)
548 mf->load_config_file();
549 return AppActionRunResult{AppActionRunResult::Level::Success};
550 });
551
552 // ---- Export extras ----
553 add_with_icon("export_stl_multi", L("Export All Objects as STLs"), L("Export"), "save", [](const std::string&) {
554 if (Plater* plater = wxGetApp().plater())
555 plater->export_stl(false, false, true);
556 return AppActionRunResult{AppActionRunResult::Level::Success};
557 });
558 add_with_icon("export_drc_single", L("Export All Objects as DRC (one file)"), L("Export"), "save", [](const std::string&) {
559 if (Plater* plater = wxGetApp().plater())
560 plater->export_stl(false, false, false, FT_DRC);
561 return AppActionRunResult{AppActionRunResult::Level::Success};
562 });
563 add_with_icon("export_drc_multi", L("Export All Objects as DRCs"), L("Export"), "save", [](const std::string&) {
564 if (Plater* plater = wxGetApp().plater())
565 plater->export_stl(false, false, true, FT_DRC);
566 return AppActionRunResult{AppActionRunResult::Level::Success};
567 });
568 add_with_icon("export_toolpaths_obj", L("Export Toolpaths as OBJ"), L("Export"), "custom-gcode_gcode", [](const std::string&) {
569 if (Plater* plater = wxGetApp().plater())
571 return AppActionRunResult{AppActionRunResult::Level::Success};
572 });
573 add_with_icon("export_config", L("Export Preset Bundle"), L("Export"), "save", [](const std::string&) {
574 if (MainFrame* mf = wxGetApp().mainframe)
575 mf->export_config();
576 return AppActionRunResult{AppActionRunResult::Level::Success};
577 });
578
579 // ---- Help ---- (mirrors the top-bar Help menu, plus the wiki/YouTube links)
580 add("help_keyboard_shortcuts", L("Keyboard Shortcuts"), L("Help"), [](const std::string&) {
581 wxGetApp().keyboard_shortcuts(ShortcutContext::Global);
582 return AppActionRunResult{AppActionRunResult::Level::Success};
583 });
584 add("help_setup_wizard", L("Setup Wizard"), L("Help"), [](const std::string&) {
585 wxGetApp().ShowUserGuide();
586 return AppActionRunResult{AppActionRunResult::Level::Success};
587 });
588 add_with_icon("help_open_config_folder", L("Show Configuration Folder"), L("Help"), "open_project", [](const std::string&) {
590 return AppActionRunResult{AppActionRunResult::Level::Success};
591 });
592 add("help_migrate_filament_presets", L("Migrate Filament Presets"), L("Help"), [](const std::string&) {
593 wxGetApp().check_legacy_user_filament_presets(true);
594 return AppActionRunResult{AppActionRunResult::Level::Success};
595 });
596 add("help_troubleshoot", L("Troubleshoot Center"), L("Help"), [](const std::string&) {
597 wxGetApp().troubleshoot();
598 return AppActionRunResult{AppActionRunResult::Level::Success};
599 });
600 add("help_network_test", L("Open Network Test"), L("Help"), [](const std::string&) {
601 NetworkTestDialog dlg(wxGetApp().mainframe);
602 dlg.ShowModal();
603 return AppActionRunResult{AppActionRunResult::Level::Success};
604 });
605 add("help_benchmark_3d_scene", L("Benchmark 3D Scene"), L("Help"), [](const std::string&) {
607 return AppActionRunResult{AppActionRunResult::Level::Success};
608 });
609 add_with_icon("help_tip_of_the_day", L("Show Tip of the Day"), L("Help"), "info", [](const std::string&) {
610 if (Plater* plater = wxGetApp().plater()) {
612 if (GLCanvas3D* canvas = plater->get_current_canvas3D())
613 canvas->set_as_dirty();
614 }
615 return AppActionRunResult{AppActionRunResult::Level::Success};
616 });
617 add_with_icon("help_check_updates", L("Check for Updates"), L("Help"), "refresh", [](const std::string&) {
618 wxGetApp().check_new_version_sf(true, 1);
619 return AppActionRunResult{AppActionRunResult::Level::Success};
620 });
621 add_with_icon("help_about", L("About OrcaSlicer"), L("Help"), "OrcaSlicer_gradient_circle", [](const std::string&) {
623 return AppActionRunResult{AppActionRunResult::Level::Success};
624 });
625 add_with_icon("open_wiki", L("Open Wiki"), L("Help"), "link_wiki_img", [](const std::string&) {
626 wxLaunchDefaultBrowser("https://www.orcaslicer.com/wiki/", wxBROWSER_NEW_WINDOW);
627 return AppActionRunResult{AppActionRunResult::Level::Success};
628 });
629 add("open_youtube", L("Open YouTube Channel"), L("Help"), [](const std::string&) {
630 wxLaunchDefaultBrowser("https://www.youtube.com/@OfficialOrcaSlicer/videos", wxBROWSER_NEW_WINDOW);
631 return AppActionRunResult{AppActionRunResult::Level::Success};
632 });
633
634 // ---- Plugins ----
635 add("open_plugins", L("Open Plugins"), L("Plugins"), [](const std::string&) {
636 wxGetApp().open_plugins_dialog();
637 return AppActionRunResult{AppActionRunResult::Level::Success};
638 });
639 add("refresh_plugins", L("Refresh Plugins"), L("Plugins"), [](const std::string&) {
640 wxGetApp().refresh_plugins();
641 return AppActionRunResult{AppActionRunResult::Level::Success};
642 });
643 add("install_plugin", L("Install Plugin"), L("Plugins"), [](const std::string&) {
645 return AppActionRunResult{AppActionRunResult::Level::Success};
646 });
647 add("install_local_plugin", L("Install Local Plugin"), L("Plugins"), [](const std::string&) {
648 wxGetApp().install_local_plugin();
649 return AppActionRunResult{AppActionRunResult::Level::Success};
650 });
651
652 return out;
653}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
#define L(s)
Definition ExtrusionEntity.cpp:25
#define TAB_ID_PREVIEW
Definition MainFrame.hpp:61
#define _L(s)
Definition OBJ.cpp:34
void open()
Definition DailyTips.cpp:579
static const std::vector< HandyModel > & handy_models()
Definition GUI_Factories.cpp:634
static void add_text_volume(ModelVolumeType type)
Definition GUI_Factories.cpp:751
static void add_svg_volume(ModelVolumeType type)
Definition GUI_Factories.cpp:752
static void load_handy_model(std::size_t index)
Definition GUI_Factories.cpp:651
PartPlate * get_curr_plate()
Definition PartPlate.hpp:962
int get_curr_plate_index() const
Definition PartPlate.hpp:961
int get_plate_count() const
Definition PartPlate.cpp:7042
int duplicate_plate(int plate_index=-1)
Definition Plater.cpp:23538
bool can_delete_plate() const
Definition Plater.cpp:23883
void reslice()
Definition Plater.cpp:20752
int save_project(bool saveAs=false)
Definition Plater.cpp:16296
void add_file()
Definition Plater.cpp:18989
int select_plate(int plate_index, bool need_slice=false)
Definition Plater.cpp:22612
GLCanvas3D * get_current_canvas3D(bool exclude_preview=false)
Definition Plater.cpp:22126
PartPlateList & get_partplate_list()
Definition Plater.cpp:22578
void take_snapshot(const std::string &snapshot_name)
Definition Plater.cpp:21281
void export_gcode_3mf(bool export_all=false)
Definition Plater.cpp:19599
bool add_model(bool imperial_units=false, std::string fname="")
Definition Plater.cpp:16628
int add_plate()
Definition Plater.cpp:23521
int delete_plate(int plate_index=-1)
Definition Plater.cpp:23552
void export_core_3mf()
Definition Plater.cpp:19721
const Camera & get_camera() const
Definition Plater.cpp:22567
Sidebar & sidebar()
Definition Plater.cpp:16046
void export_stl(bool extended=false, bool selection_only=false, bool multi_stls=false, FileType file_type=FT_STL)
Definition Plater.cpp:20053
void load_project(wxString const &filename="", wxString const &originfile="-")
Definition Plater.cpp:16144
void reset_window_layout()
Definition Plater.cpp:19154
GLCanvas3D * canvas3D()
Definition Plater.cpp:22070
void export_gcode(bool prefer_removable)
Definition Plater.cpp:19493
void select_view(const std::string &direction)
Definition Plater.cpp:19116
void import_zip_archive()
Definition Plater.cpp:18109
bool can_add_plate() const
Definition Plater.cpp:23882
DailyTipsWindow * get_dailytips() const
Definition Plater.cpp:23858
void select_view_3D(const std::string &name, bool no_slice=true)
Definition Plater.cpp:19119
void export_toolpaths_to_obj() const
Definition Plater.cpp:20722
void sync_ams_list(bool is_from_big_sync_btn=false)
Definition Plater.cpp:6304
void ensure_3d_view(Plater *plater)
Definition NativeCommands.cpp:57
AppActionRunResult view_command(Plater *plater, const std::string &dir)
Definition NativeCommands.cpp:114
void go_to_layer(Plater *plater, const std::string &param)
Definition NativeCommands.cpp:82
AppActionRunResult plate_unavailable()
Definition NativeCommands.cpp:53
AppActionRunResult calib_command(CalibKind kind)
Definition NativeCommands.cpp:123
bool is_fff_plater(Plater *plater)
Definition NativeCommands.cpp:51
AppActionRunResult object_op(Plater *plater, bool(*ok)(Plater *), void(*op)(Plater *))
Definition NativeCommands.cpp:68
void about()
Definition GUI.cpp:574
@ Cornering
Definition MainFrame.hpp:140
@ MaxVolumetric
Definition MainFrame.hpp:136
@ VFA
Definition MainFrame.hpp:143
@ InputShapingFreq
Definition MainFrame.hpp:141
@ FlowRatio
Definition MainFrame.hpp:138
@ PressureAdvance
Definition MainFrame.hpp:137
@ InputShapingDamp
Definition MainFrame.hpp:142
@ Retraction
Definition MainFrame.hpp:139
@ Temperature
Definition MainFrame.hpp:135
void open_plugin_hub()
Definition PluginsDialog.cpp:468
static ObjectList * obj_list()
Definition GUI_Factories.cpp:405
static Plater * plater()
Definition GUI_Factories.cpp:400
@ FT_DRC
Definition GUI_App.hpp:139
void desktop_open_datadir_folder()
Definition GUI.cpp:580
void run_scene_benchmark()
Definition SceneBenchmark.cpp:547
@ ObjectList
Definition Shortcuts.hpp:21
@ Global
Definition Shortcuts.hpp:21
@ Plater
Definition Shortcuts.hpp:21
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
SpiralVase::SpiralPoint add(SpiralVase::SpiralPoint a, SpiralVase::SpiralPoint b)
Definition SpiralVase.cpp:26
@ comSimple
Definition Config.hpp:222
@ comAdvanced
Definition Config.hpp:223
@ comExpert
Definition Config.hpp:224
@ INVALID
Definition Model.hpp:356
@ Y
Definition libslic3r.h:142
@ Z
Definition libslic3r.h:143
@ X
Definition libslic3r.h:141
Definition ActionRegistry.hpp:30
@ Info
Definition ActionRegistry.hpp:31
@ Success
Definition ActionRegistry.hpp:31
void select_next_type()
Definition Camera.cpp:62

References _L, Slic3r::GUI::about(), Slic3r::GUI::MenuFactory::add_svg_volume(), Slic3r::GUI::MenuFactory::add_text_volume(), Slic3r::GUI::GUI_App::app_config, Slic3r::GUI::Plater::arrange(), build_command_catalog(), calib_command(), Slic3r::GUI::Plater::can_arrange(), Slic3r::GUI::Plater::can_decrease_instances(), Slic3r::GUI::Plater::can_delete_all(), Slic3r::GUI::Selection::can_drop(), Slic3r::GUI::Plater::can_increase_instances(), Slic3r::GUI::Plater::can_mirror(), Slic3r::GUI::Plater::can_split_to_objects(), Slic3r::GUI::Plater::can_split_to_volumes(), Slic3r::GUI::Plater::center_selection(), Slic3r::comAdvanced, Slic3r::comExpert, Slic3r::comSimple, Slic3r::GUI::Cornering, count, Slic3r::GUI::Plater::decrease_instances(), Slic3r::GUI::Plater::delete_all_objects_from_model(), Slic3r::GUI::desktop_open_datadir_folder(), Slic3r::GUI::Plater::drop_selection(), ensure_3d_view(), Slic3r::GUI::FlowRatio, Slic3r::GUI::from_u8(), Slic3r::GUI::FT_DRC, Slic3r::AppConfig::get_bool(), Slic3r::GUI::PartPlateList::get_curr_plate_index(), Slic3r::GUI::PartPlateList::get_plate_count(), Slic3r::GUI::PartPlate::get_plate_name(), Slic3r::GUI::PlateNameEditDialog::get_plate_name(), Slic3r::DeviceManager::get_selected_machine(), Slic3r::GUI::Plater::get_selection(), Slic3r::GUI::Global, go_to_layer(), Slic3r::GUI::MenuFactory::handy_models(), Slic3r::GUI::Plater::increase_instances(), Slic3r::GUI::AppActionRunResult::Info, Slic3r::GUI::InputShapingDamp, Slic3r::GUI::InputShapingFreq, Slic3r::INVALID, is_fff_plater(), Slic3r::GUI::PartPlateList::is_locked(), Slic3r::GUI::Plater::is_selection_empty(), L, Slic3r::GUI::MenuFactory::load_handy_model(), Slic3r::GUI::PartPlateList::lock_plate(), Slic3r::GUI::MaxVolumetric, Slic3r::GUI::Plater::mirror(), Slic3r::GUI::obj_list(), object_op(), Slic3r::GUI::open_plugin_hub(), Slic3r::GUI::Plater::orient(), plate_unavailable(), Slic3r::GUI::plater(), Slic3r::GUI::PressureAdvance, Slic3r::GUI::Plater::remove_selected(), Slic3r::GUI::Retraction, Slic3r::GUI::run_scene_benchmark(), Slic3r::AppConfig::save(), Slic3r::GUI::Plater::scale_selection_to_fit_print_volume(), Slic3r::AppConfig::set_bool(), Slic3r::GUI::PartPlate::set_plate_name(), Slic3r::GUI::PlateNameEditDialog::set_plate_name(), Slic3r::GUI::DPIAware< P >::ShowModal(), Slic3r::GUI::Plater::split_object(), Slic3r::GUI::Plater::split_volume(), Slic3r::GUI::AppActionRunResult::Success, TAB_ID_PREVIEW, Slic3r::GUI::Temperature, Slic3r::GUI::GUI_App::update_mode(), Slic3r::GUI::VFA, view_command(), Slic3r::X, Slic3r::Y, and Slic3r::Z.

Referenced by build_command_catalog().

Here is the caller graph for this function:

◆ calib_command()

AppActionRunResult Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::calib_command ( CalibKind kind)
124{
125 MainFrame* mf = wxGetApp().mainframe;
126 if (!mf)
127 return {AppActionRunResult::Level::Info, _L("Open the 3D view first.")};
128 ensure_3d_view(wxGetApp().plater());
129 mf->run_calibration(kind);
131}
Definition MainFrame.hpp:147
void run_calibration(CalibKind calib_kind)
Definition MainFrame.cpp:4654

References _L, calib_command(), ensure_3d_view(), Slic3r::GUI::AppActionRunResult::Info, Slic3r::GUI::plater(), Slic3r::GUI::MainFrame::run_calibration(), and Slic3r::GUI::AppActionRunResult::Success.

Referenced by build_command_catalog(), and calib_command().

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

◆ ensure_3d_view()

void Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::ensure_3d_view ( Plater * plater)
58{
59 if (plater && !plater->is_view3D_shown()) {
60 plater->select_view_3D("3D");
61 if (MainFrame* mf = wxGetApp().mainframe; mf)
62 mf->select_tab(TAB_ID_PREPARE);
63 }
64}
#define TAB_ID_PREPARE
Definition MainFrame.hpp:60

References ensure_3d_view(), Slic3r::GUI::plater(), and TAB_ID_PREPARE.

Referenced by build_command_catalog(), calib_command(), ensure_3d_view(), and object_op().

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

◆ go_to_layer()

void Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::go_to_layer ( Plater * plater,
const std::string & param )
83{
84 if (!plater)
85 return;
86 double pct = 50.0;
87 try {
88 pct = std::stod(param);
89 } catch (const std::exception&) {}
90 pct = std::clamp(pct, 0.0, 100.0);
91
92 GLCanvas3D* canvas = plater->get_current_canvas3D();
93 if (!canvas)
94 return;
95 GCodeViewer& viewer = canvas->get_gcode_viewer();
96 IMSlider* layers = viewer.get_layers_slider();
97 IMSlider* moves = viewer.get_moves_slider();
98 if (!layers || layers->GetMaxValue() <= 0)
99 return;
100
101 const double max = double(layers->GetMaxValue());
102 const int target = int(std::lround(pct / 100.0 * max));
103 layers->SetHigherValue(target);
104 if (layers->is_one_layer())
105 layers->SetLowerValue(target);
106 layers->set_as_dirty();
107 if (moves) {
108 moves->SetHigherValue(moves->GetMaxValue());
109 moves->set_as_dirty();
110 }
111}
IMSlider * get_layers_slider()
Definition GCodeViewer.hpp:465
GCodeViewer & get_gcode_viewer()
Definition GLCanvas3D.hpp:1007
@ GCodeViewer
Definition Process.cpp:38

References Slic3r::GUI::GLCanvas3D::get_gcode_viewer(), Slic3r::GUI::GCodeViewer::get_layers_slider(), Slic3r::GUI::GCodeViewer::get_moves_slider(), Slic3r::GUI::IMSlider::GetMaxValue(), go_to_layer(), Slic3r::GUI::IMSlider::is_one_layer(), Slic3r::GUI::plater(), Slic3r::GUI::IMSlider::set_as_dirty(), Slic3r::GUI::IMSlider::SetHigherValue(), and Slic3r::GUI::IMSlider::SetLowerValue().

Referenced by build_command_catalog(), and go_to_layer().

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

◆ is_fff_plater()

bool Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::is_fff_plater ( Plater * plater)
51{ return plater && plater->printer_technology() == ptFFF && !plater->only_gcode_mode(); }
@ ptFFF
Definition Config.hpp:231

References is_fff_plater(), Slic3r::GUI::plater(), and Slic3r::ptFFF.

Referenced by build_command_catalog(), and is_fff_plater().

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

◆ object_op()

AppActionRunResult Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::object_op ( Plater * plater,
bool(* ok )(Plater *),
void(* op )(Plater *) )
69{
70 if (!plater)
71 return {AppActionRunResult::Level::Info, _L("Open the 3D view first.")};
73 if (!ok(plater))
74 return {AppActionRunResult::Level::Info, _L("Select an object first.")};
75 op(plater);
77}

References _L, ensure_3d_view(), Slic3r::GUI::AppActionRunResult::Info, object_op(), Slic3r::GUI::plater(), and Slic3r::GUI::AppActionRunResult::Success.

Referenced by build_command_catalog(), and object_op().

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

◆ plate_unavailable()

AppActionRunResult Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::plate_unavailable ( )
53{ return {AppActionRunResult::Level::Info, _L("Plates are a filament (FFF) feature.")}; }

References _L, Slic3r::GUI::AppActionRunResult::Info, and plate_unavailable().

Referenced by build_command_catalog(), and plate_unavailable().

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

◆ view_command()

AppActionRunResult Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::view_command ( Plater * plater,
const std::string & dir )
115{
116 if (plater)
117 plater->select_view(dir);
119}

References Slic3r::GUI::plater(), Slic3r::GUI::AppActionRunResult::Success, and view_command().

Referenced by build_command_catalog(), and view_command().

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

Variable Documentation

◆ kCommandPrefix

const char* Slic3r::GUI::anonymous_namespace{NativeCommands.cpp}::kCommandPrefix = "orca_command"
constexpr