FPM Sim
A Marlin-style simulator for a 4-axis probing machine: G-code goes in, a machine state and a 3D scene come out. Code: github.com/aRandomHumanoid/FPM-sim.
Most of my work on the flat-plane mechanism was firmware and host software — the A-axis inverse kinematics, the Python control script, the scan routines. All of that talks G-code to a machine, which means every change has to be tested against a machine. That is slow when the machine is in a lab, and worse when it’s a 4-axis FPM rather than something you can buy a second of. A probe move that misses, or homes into a limit, or drives the rotary axis the wrong way, is a real crash on real hardware.
So the thing to test against is a machine that doesn’t exist yet. The simulator accepts the same G-code and answers the way firmware answers — ok on success, echo:busy: processing during long moves, Error: on failures — so host software cannot tell the difference at the protocol boundary. That is the whole point: not to be a pretty visualiser, but to be a believable thing on the other end of the serial port.

The part I cared most about is probing. G38.2 through G38.5 are the codes that move toward or away from a target and stop on contact — the entire basis of touch-probe metrology, and the one family of commands whose failure mode on real hardware is a bent probe. An imported mesh is loaded with trimesh, and each probe move becomes a segment intersection test against it: the toolhead stops at the first face it meets, and the contact point is reported back over serial exactly as a probe hit would be.
Running a raster of probes over a mesh gives something that looks like a real scan. Each descent stops at a different height depending on what is underneath it, and misses are reported rather than silently ignored, which matters because a scan path that wanders off the part should say so instead of writing a zero into your surface.

Geometry with real features is where it gets useful. On a part with slots, probe descents drop into the gaps and stop on the floor between the cylinders, at a different Z from the ones that land on top — which is precisely the case that breaks a scan routine written against a flat test plate.

Underneath, the structure is deliberately plain. A parser turns raw lines into command objects, an engine dispatches them to handlers, a state object owns the kinematics, and a probe world owns the meshes and the intersection tests. Commands run one at a time from a single queue, the way firmware does, so there is no concurrency to reason about and a given G-code file always produces the same result. Motion is simulated with acceleration-limited trapezoidal profiles rather than jumping between endpoints, bounded by commanded feedrate, per-axis maximum feedrate and per-axis acceleration, so a long move takes about as long as it really would and busy lines arrive at about the right spacing. The rotary A axis runs through the same profile logic with its own limits.
The last piece is the one that makes it worth more than a renderer. On start-up it opens a pseudo-terminal and advertises the path over an HTTP endpoint, so host software — a slicer, a sender, my own control script — can open it as an ordinary serial port and talk to it without knowing it isn’t a printer.
It is not a Marlin clone and isn’t trying to be. There is no planner buffer depth, no EEPROM-backed settings, no full endstop state machine. It mirrors the host-facing interaction pattern closely enough to develop against, and stops there.