Resource Printer Asset¶
The orca.resource_printer_asset module exposes ResourcePrinterAssetPluginCapabilityBase for
plugins that contribute a pack of bed models and bed textures.
| Base class | get_type() returns |
Required methods | Invoked by |
|---|---|---|---|
orca.resource_printer_asset.ResourcePrinterAssetPluginCapabilityBase |
ResourcePrinterAsset |
get_name(), get_asset_dir(self) -> str |
OrcaSlicer, when the capability is materialized |
Lifecycle hooks on_load() / on_unload() are optional and available on every capability
(defaults do nothing).
What the pack is for¶
A printer preset stores its custom bed model in bed_custom_model and its custom bed texture in
bed_custom_texture. A file path in these settings points at one computer's disk, so a shared
preset loses its custom bed on another computer. A pack lets the preset store a portable
reference instead, and each machine resolves it to its own installed copy.
The Bed Shape dialog (Printer settings > Basic information > Printable space > Bed Shape) offers the pack's files under From asset pack..., next to the Load buttons for the texture and for the model.
This type is separate from Resource Texture: it has its own capability, registry and loader branch.
Minimal Shape¶
import os
import orca
class BedPack(orca.resource_printer_asset.ResourcePrinterAssetPluginCapabilityBase):
def get_name(self):
return "Voron Bed Pack"
def get_asset_dir(self):
return os.path.join(os.path.dirname(__file__), "bed")
@orca.plugin
class BedPackPlugin(orca.base):
def register_capabilities(self):
orca.register_capability(BedPack)
get_name() is the pack's display name, so it must be unique among the loaded packs of this type
(see Registry).
The asset directory¶
get_asset_dir() returns a directory the host scans for bed files.
| Rule | Detail |
|---|---|
| Formats | .stl for a bed model, .png or .svg for a bed texture, matched case-insensitively |
| Depth | one level, non-recursive; files in a subdirectory are not listed |
| Location | the resolved directory must sit inside the plugin's own folder. A directory outside it is refused, and a symlink inside the pack that resolves outside is skipped |
| File names | each file name must be one a reference can hold (see References), because the Bed Shape dialog cannot offer a file it cannot reference |
| File limit | at most 16 files are listed, after sorting, so every file system keeps the same files |
get_asset_dir() runs once, under the GIL, when the capability is materialized, and the result is
cached. A changed directory takes effect on reload, not while the plugin stays loaded.
A directory that is empty, missing, unreadable, or outside the plugin folder costs the pack its files only: the plugin still loads, and the pack is left out. The reason is written to the session log.
References¶
bed_custom_model and bed_custom_texture store a reference of the form:
<plugin id>is the Orca Cloud plugin uuid, compared without regard to case and stored in lower case, or the plugin key for a pack installed by hand.<file>usesA-Z a-z 0-9 . _ -, is at most 128 characters, and is not a Windows device name (CON,NUL,COM1, ...).- A reference has no colon and no backslash, so it means the same on every operating system.
The file name is matched against the validated list, so a reference cannot leave the pack.
A slicer that does not have the pack resolves nothing and draws the vendor bed, which is the same result as a foreign absolute path today.
Printer manifest¶
The hidden option printer_asset_plugins names the packs the bed files come from. It is
plugin-backed with type resource-printer-asset, so the printer preset's manifest
(printer_plugins) lists the packs, and a machine without a pack is offered Install Plugins
or Activate Now. A missing pack is reported but never blocks slicing.
Packaging¶
Ship a wheel (.whl). An install copies a single entry file, so a .py plugin cannot carry
sibling STL, PNG or SVG files; a wheel is one file, and the loader extracts it on demand with the
files inside the package's own directory. See
Wheel (.whl) plugins.
On Orca Cloud the author uploads the files and the cloud builds the wheel, so the author writes no Python. The cloud also validates the content (STL structure, PNG size, SVG active content, Windows-safe names) and caps a pack at 8 files and a file name at 64 characters; the slicer allows 16 files.
Lifecycle¶
The host tracks loaded and enabled packs. A pack's files become available to OrcaSlicer when the capability loads and is enabled, and are dropped when it is disabled, unloaded, or uninstalled. No restart is needed: the 3D view redraws the bed when the set of packs changes.
Limitations¶
- A file's use follows its extension, so a pack cannot give one extension two uses (a hotend model next to a bed model, for example).
- A reference to a hand-installed pack uses the plugin key. It resolves only on a machine that has that key, and its manifest entry has no uuid, so no other machine is offered the install.
- Keeping a cloud plugin as a local one replaces its uuid with the plugin key, so references that name the uuid stop resolving.
- A printer bundle export skips a reference and logs "Bed asset file is missing". The reference and the manifest still travel in the preset JSON.
See Also¶
- Registry - registration, capability name rules, and
ExecutionResult.