How the Fusion post system works
Fusion posts are .cps files written in JavaScript. The same post engine is used by Fusion, Inventor CAM and HSMWorks. When you post, the engine walks through the CAM data and calls functions in the post (entry functions) for each event.
Key entry functions
| Function | Called when |
|---|---|
onOpen() | Program starts: header, safe start |
onSection() | Each operation starts: tool change, work offset, spindle |
onRapid() / onLinear() | Rapid and feed moves |
onCircular() | Arc moves |
onRapid5D() / onLinear5D() | Multi-axis moves |
onCyclePoint() | Drilling cycle positions |
onSectionEnd() / onClose() | Operation end and program end |
Formats, variables and modals
var xyzFormat = createFormat({decimals: 3, forceDecimal: true});
var feedFormat = createFormat({decimals: 1, forceDecimal: true});
var xOutput = createVariable({prefix: "X"}, xyzFormat);
var gMotionModal = createModal({}, gFormat);
function onLinear(_x, _y, _z, feed) {
var x = xOutput.format(_x);
var y = yOutput.format(_y);
var z = zOutput.format(_z);
if (x || y || z) {
writeBlock(gMotionModal.format(1), x, y, z, feedOutput.format(feed));
}
}
Formats control decimals and units; variables suppress repeated values; modals suppress repeated G-codes. Getting these right produces clean, compact NC code.
Post properties
Properties appear in the Fusion post dialog so programmers can choose options without editing the post: sequence numbers, high-speed mode, safe retract method, coolant defaults, subprograms and more.
Machine configuration
For multi-axis work, the post needs a machine configuration: rotary axes, directions, limits and preferences. This can be defined in the post itself or in a Fusion machine definition, which also drives machine simulation.
Development workflow
- Start from the closest Autodesk library post for the controller.
- Compare output with proven machine programs.
- Modify in an editor such as Visual Studio Code with the Autodesk post processor extension.
- Post a test set and simulate.
- Prove on the machine and release.
The Fusion post system is open JavaScript: almost any output format can be produced with the right logic.
Fusion post development
See our CNC post processor development and Fusion 360 customisation services, or read Fusion custom posts for CNC machines.