Skip to content
omigamedevPublic

About

Shared code of the Omi plugins for SolidCraft: gears, drivetrain, wheels, chassis, power, 3D-printing, mold and laser tools for building vehicles

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

84 Commits

Folders and files

Repository files navigation

omicore: the shared code of the Omi plugins

The Omi plugins make parts for SolidCraft that build into 3D-printable vehicles and machines: gears, shafts and joints, differentials, wheels and tracks, suspension and steering, battery holders, and the tools to print, mold and laser-cut them. They are building blocks, not kits: every part is an ordinary editable component, sized by one scale and fitted to your printer.

Each plugin has its own repository, release and Workshop listing, and each is built from the code in this repository, which it holds as a git submodule (core/).

Plugin Repository Commands Status
OmiGears omigears Gears, gear pairs and gearboxes, pulleys, sprockets, ratchets and Geneva drives 0.50.3 released; 0.51.0 built (unreleased)
OmiPrint omiprint printer, print-check, fastener, split printer and fastener built (0.51.0, unreleased); print-check and split planned
OmiWheels omiwheels rim, tire, hub, track rim, tire and hub built (0.51.0, unreleased); track planned
OmiDrive omidrive shaft, ujoint, coupling, bearing, adaptor, differential, gearbox, axle planned
OmiChassis omichassis balljoint, arm, knuckle, shock, steering, block, bracket planned
OmiPower omipower battery, motor-mount, servo-mount, tray planned
OmiMold omimold mold, mold-box, ring-mold, mold-check planned
OmiLaser omilaser laser, plate, box, gear-plate, engrave-jig, layout planned
OmiLaser Export omilaser-export an exporter: LightBurn projects (.lbrn2) and laser SVGs planned

Why several plugins. A SolidCraft plugin holds at most 32 commands and a 64 KiB manifest, and SolidCraft has no dependencies between plugins. It also allows one kind of entry per plugin, so OmiLaser's exporter is a plugin of its own. Each plugin carries all the code it uses, compiled in from here, and parts that build each other live in one plugin. The plugins share numbers through the design: the scale (omi_scale) and the printer profile (print_*) are design parameters that every plugin reads.

Plan and progress

  • docs/vehicle-parts-plan.md: what each plugin will make, the rules every part follows (scale, fits, printing without supports) and the order of work.
  • docs/visual-plan.html: the same plan drawn, with every part's variations and parameters and a scale selector.
  • docs/research/: the research behind it, from hobby RC projects to vehicle engineering, with its sources.
  • Work is tracked in this repository's issues, labelled by plugin, and its milestones, one per phase. Open issues here, whichever plugin they concern. The issues of every repository are on the Omi plugins project board.

The source

A Cargo workspace: the shared code in one crate, and a crate for each plugin.

crates/omicore/   the shared code every plugin compiles in
plugins/<id>/     a plugin: its commands, its forms, icons, pictures, host tests and tools
tools/            the licence list every package carries, the writer of every plugin's host tests, and the
                  plugins' Workshop pictures (shots.py)
wit/              SolidCraft's plugin interface
build.sh          ./build.sh [--plugin <id>] [--out <dir>] [--test]
Where What is in it
crates/omicore/src/gear.rs, tooth.rs, mech.rs The geometry: involute, bevel, worm and cycloidal gears; ratchets, Geneva drives, sprockets and pulleys. No SolidCraft in them
crates/omicore/src/outline.rs, sketch.rs Outlines as lines, curves, arcs and circles, and the sketch SolidCraft takes in one command
crates/omicore/src/schema.rs, manifest.rs The forms' fields (their help, "More about this field" links, and their options' tips and pictures), and a plugin's plugin.json written from them
crates/omicore/src/bore.rs Fits, bores and hubs
crates/omicore/src/model.rs A run: components, placements, joints and couplings, and each part's print face
crates/omicore/src/lib.rs The host interface, and command_plugin!, the WebAssembly component a command plugin exports
crates/omicore/src/fake.rs The fake SolidCraft host every plugin's native tests run against (the fake feature): components, the timeline, bodies, joints, the plugin's data, the design's parameters, box-shaped bodies whose faces it answers for, print faces, and whether a run is a preview
tools/plugin_tests.py Writes a plugin's host tests from what its built zip makes in a headless SolidCraft
plugins/omigears/src/entries/ OmiGears' commands: each one's form and how it builds what the form asks for
plugins/omigears/src/edit.rs The records and Edit gear
plugins/omiprint/src/entries/ OmiPrint's commands: the printer profile (its form filled by a dialog hook) and its test pieces, and fastener holes
plugins/omiprint/src/holes.rs What each kind of fastener hole cuts, in each print orientation, so that it prints without support
plugins/omiwheels/src/section.rs A wheel's geometry: the classes and wheel hexes, the rim's section with its bead seats, the tire's section and hollow, and the treads' lugs
plugins/omiwheels/src/entries/ OmiWheels' commands: rims (with their beadlock rings and their tires), tires and their inserts, and hubs

./build.sh --plugin <id> writes the plugin's plugin.json (cargo run -p <id> --example <id>-manifest), runs the tests of omicore and the plugin, builds the component, and zips the package: the manifest, the component, the licence, THIRD-PARTY-LICENSES.txt, the plugin's icons/*.svg and its pictures/, when it has any. Everything but the zip goes under target/omi/<id>/. When it finds solidcraft-cli (on the PATH, or named by SOLIDCRAFT_CLI; Windows installs it in C:\Program Files\SolidCraft), it checks the package as Install does. SolidCraft reads at most 64 KiB of manifest and 32 entries; a unit test fails past either. The manifest defines a field that several entries ask for once, under $defs, and each entry writes beside its reference only what it has otherwise (another default, title or condition).

Every field has help, its tooltip, that says what it does, in what unit and what a usual value is; one whose README section explains more links to it ("More about this field"). A choice whose options are easier to see than to read shows a picture of each, 512 × 384 PNGs in the plugin's pictures/: OmiGears' tools/make_pictures.py draws them (SVG, then PNG with Inkscape). The bore shapes and Made by are omicore's fields, so a plugin that has bores or fits carries their pictures/bore-*.png and pictures/fit-*.png; a test checks that every picture a form names is in the package, within SolidCraft's limits.

A plugin's plugin-tests/ holds cases for solidcraft-cli plugin test, which installs the package in a scratch folder and runs each entry in SolidCraft's own modelling kernel. Each case gives the bodies and the volume to expect, to 0.1 %, and any values of the reply it names: what the entry made in SolidCraft when the case was written, so a change to a profile shows. An OmiGears entry's defaults case names the parts SolidCraft laid on a print face, and every OmiWheels and OmiPower case does, so a print face SolidCraft refuses fails it. A plugin's tools/make_plugin_tests.py lists its cases and the designs they start from, and tools/plugin_tests.py writes them from the built plugin, in a scratch plugins folder; run it when a profile or a default changes, and read the diff. OmiGears' edit cases start from designs that hold recorded gears (recorded-*.sc): a spur, a herringbone, a bevel pair, a pair the user moved, a gearbox with its sun turned, and a spur recorded by OmiGears 0.50.2; printed spurs start from designs whose printer profile makes holes 0.35 mm small (printer-profile.sc) or leaves them to the slicer (slicer-compensates.sc). With --test, a case that fails, or an entry no case covers, fails the build.

python tools/shots.py <id> makes a plugin's pictures with SolidCraft itself, from its shots.json: the images of its Workshop listing (the first is the cover) and the animations of its README. Each is a scene the built zip makes in a headless design, in a scratch plugins folder, coloured from one shared palette, framed on its outline and path traced, or drawn with edges as the app draws it. Run it after ./build.sh --plugin <id>, which empties target/omi/<id>/; the pictures go to target/omi/<id>/images/, with contact-sheet.png beside them, and at a release to the plugin repository's images/. The script's own help describes shots.json.

host-check/ runs the packaged component inside SolidCraft's real runtime crate (craft-plugin-wasm) with a host that records each command, and tries the largest inputs the forms allow, and edits of them, against the fuel, memory and message-size limits. It expects a SolidCraft checkout next to this repository:

git clone --depth 1 https://github.com/tangency-labs/solidcraft ../solidcraft
cd host-check && cargo run --release

wit/plugin.wit is copied unchanged from SolidCraft 0.50.0 (crates/craft-plugin/wit/plugin.wit, MIT OR Apache-2.0): craft:plugin@0.2.0.

How a plugin repository builds

Each plugin repository has:

  • core/: this repository as a git submodule, pinned to the commit the plugin is built from;
  • build.sh: builds <id>-<version>.zip from core/ and checks its id and version against solidcraft-workshop.json;
  • solidcraft-workshop.json, workshop-description.md and images/: its Workshop listing;
  • release-notes/: one file for each release.

A plugin repository's build.sh runs core/build.sh --plugin <id> --out <its folder> [--test], which writes <id>-<version>.zip there. Until the workspace lands, ./build.sh here builds OmiGears, and omigears' build.sh falls back to it.

To release a plugin: set its version here and push; in its repository, move core/ to that commit, set the version in solidcraft-workshop.json, write the release notes, run ./build.sh --test, then tag v<version> and publish the release with the zip (each repository's README has the commands). A plugin's version follows the SolidCraft release it targets: 0.51.z for SolidCraft 0.51.

How SolidCraft plugins work

  • A plugin is a WebAssembly component plus plugin.json.
  • It runs sandboxed: no WASI, no network, and fuel, memory, host-call and time limits. A command entry gets 30 s of its own computing (from SolidCraft 0.51, the work SolidCraft does for it does not count) and 256 host calls; an entry marked "job": true gets ten minutes and runs without a live preview.
  • It can only call the SolidCraft commands listed in the manifest's runtime.commands, the same commands MCP clients use. If a command fails, the run stops and is rolled back, so this plugin checks every input before its first command and reads the design's names first.
  • runtime.entries declares each entry's input schema. SolidCraft draws the form from it and calls the component's execute(entry, params). A form previews its entry on a scratch copy of the design as you type.
  • A plugin can keep its own data in the design (storage@0.1) and ask for a form to open, filled in, after its run (forms@0.1); Edit gear is built from those two.
  • A plugin holds at most 32 entries and a manifest of at most 64 KiB, and its entries are all commands, all importers or all exporters. SolidCraft has no dependencies between plugins: one plugin can run another only with the user's plugin permission and that plugin's exact approval, which changes with every update.

License

MIT: copyright 2026 bbonsen, who wrote Gears (up to 0.10.0), and omigamedev. wit/plugin.wit is SolidCraft's plugin interface, copied unchanged and licensed by its authors under MIT OR Apache-2.0.

About

Shared code of the Omi plugins for SolidCraft: gears, drivetrain, wheels, chassis, power, 3D-printing, mold and laser tools for building vehicles

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages