18 {
19 auto slicing = module.def_submodule("slicing", "Slicing pipeline API (research/experimental).");
20
21 py::enum_<SlicingPipelineStepPlugin>(slicing, "Step")
34
35
36
37
38
39
41 .export_values();
42
43
44
45
46
47
48
49
51 "Convert a scaled integer coordinate to millimeters (reads the live SCALING_FACTOR).");
52
53 py::class_<SlicingPipelineContext>(slicing, "SlicingPipelineContext")
57 "Path to the working G-code file, set ONLY at Step.psGCodePostProcess. Edit it in "
58 "place; empty at every other step.")
60 "Target host at Step.psGCodePostProcess (\"File\", \"OctoPrint\", ...); empty otherwise.")
62 "Final output G-code name at Step.psGCodePostProcess (mirrors SLIC3R_PP_OUTPUT_NAME); "
63 "empty otherwise.")
64 .def_property_readonly("print", [](const SlicingPipelineContext& ctx) -> py::object {
65 if (ctx.print == nullptr)
66 return py::none();
67 return py::cast(ctx.print, py::return_value_policy::reference);
68 }, "The orca.host.Print being sliced — the raw slicing graph, exactly what the "
69 "C++ pipeline walks. Valid only during the execute(ctx) call. For mesh access "
70 "use ctx.print.model() (the Print's snapshot), never orca.host.model().")
71 .def_property_readonly("object", [](const SlicingPipelineContext& ctx) -> py::object {
72 if (ctx.object == nullptr)
73 return py::none();
74
75
76
77 return py::cast(const_cast<PrintObject*>(ctx.object), py::return_value_policy::reference);
78 }, "orca.host.PrintObject for object-scoped steps, or None for print-wide steps. "
79 "Valid only during the execute(ctx) call.")
80 .def("config_value", [](const SlicingPipelineContext& ctx, const std::string& key) -> py::object {
81
82
83 if (ctx.print != nullptr)
85 if (ctx.full_config != nullptr)
87 return py::none();
88 }, py::arg("key"),
89 "serialized value of a resolved (full) print config option for this slice, or "
90 "None if absent. Shorthand for ctx.print.config_value(key).")
92
93 py::class_<SlicingPipelinePluginCapability, PluginCapabilityInterface,
94 PySlicingPipelinePluginCapabilityTrampoline,
95 std::shared_ptr<SlicingPipelinePluginCapability>>(slicing, "SlicingPipelineCapabilityBase")
96 .def(py::init<>())
99}
virtual ExecutionResult execute(SlicingPipelineContext &ctx)=0
PluginCapabilityType get_type() const override
Definition SlicingPipelinePluginCapability.hpp:37
int64_t coord_t
Definition libslic3r.h:48
pybind11::object config_value_or_none(const ConfigBase &config, const std::string &key)
Definition PluginBindingUtils.hpp:79
T unscale(Q v)
Definition libslic3r.h:138
@ posIroning
Definition Print.hpp:133
@ psWipeTower
Definition Print.hpp:134
@ posInfill
Definition Print.hpp:133
@ psGCodePostProcess
Definition Print.hpp:137
@ posDetectOverhangsForLift
Definition Print.hpp:134
@ posPerimeters
Definition Print.hpp:133
@ posEstimateCurledExtrusions
Definition Print.hpp:133
@ psSkirtBrim
Definition Print.hpp:134
@ posPrepareInfill
Definition Print.hpp:133
@ posSlice
Definition Print.hpp:133
@ posSimplifyPath
Definition Print.hpp:134
@ posSupportMaterial
Definition Print.hpp:134
@ posContouring
Definition Print.hpp:133
SlicingPipelineStepPlugin step
Definition SlicingPipelinePluginCapability.hpp:19
bool cancelled() const
Definition SlicingPipelinePluginCapability.cpp:16
std::string orca_version
Definition SlicingPipelinePluginCapability.hpp:18
std::string host
Definition SlicingPipelinePluginCapability.hpp:27
std::string gcode_path
Definition SlicingPipelinePluginCapability.hpp:26
std::string output_name
Definition SlicingPipelinePluginCapability.hpp:28