Machine Sim Graphics
Start Here: VTK Settings
Set your INI [VTK] section first so users know where the YAML filename is
declared and how axis ownership is called.
[VTK]
MACHINE_PARTS = machine.yml
X = table
Y = table
Z = head
A = table
C = table
At minimum, MACHINE_PARTS must point to your YAML file. Axis ownership
(head or table) should match your real machine kinematics.
After VTK is configured, build the MACHINE_PARTS YAML.
This guide shows how to build a MACHINE_PARTS YAML file for common machine
kinematic combinations used by the VTK backplot machine simulation.
The YAML describes a machine as a parent-child assembly tree. Each moving node is configured as either:
linear(translates)angular(rotates)
Road Map: Complete Example First
Start with this full working example, then use the rest of the guide to break it down section by section.
This roadmap example is an XYZAC table-rotary style machine.
Start with the full [VTK] mapping first so axis ownership is clear before
reading the YAML tree:
[VTK]
MACHINE_PARTS = machine.yml
X = table
Y = table
Z = head
A = table
C = table
Then read the MACHINE_PARTS YAML that this mapping points to:
root:
id: "frame"
model: "machine/frame.stl"
type: "table"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: null
joint: null
child_saddle:
id: "saddle"
model: "machine/saddle.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "y"
joint: 0
child_table:
id: "table"
model: "machine/table.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "x"
joint: 1
child_a_axis:
id: "a_axis"
model: "machine/a_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "a"
joint: 3
child_c_axis:
id: "c_axis"
model: "machine/c_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "c"
joint: 4
child_headstock:
id: "headstock"
model: "machine/headstock.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "z"
joint: 2
Section map for this document:
Quick Rules: high-level checks before editing.Node Schema: meaning of each field in the roadmap example.Supported Axis Tokens: validaxisvalues used in the roadmap.How To Build Any Combination: method to adapt the roadmap to your machine.Combination Templates: focused variants derived from the roadmap pattern.INI [VTK] Axis OwnershipandTroubleshooting Checklist: final validation.
Quick Rules
Keep one top-level key (normally
root).Every part node is a mapping (dictionary).
Child nodes can use any key name, but
child_*naming is recommended for readability.Use
type: linearortype: angularfor moving parts.Keep
axisaligned to supported axis tokens.For rotary parts, set
originto the true pivot point.
Node Schema
Typical part node (one piece of the roadmap example):
some_node:
id: "table"
model: "machine/table.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "x"
joint: 1
color: [0.9, 0.9, 0.9] # optional
power: 5.0 # optional
Field meanings:
id: Human-readable part identifier.model: STL path for this part.type: Motion behavior. -linearfor X/Y/Z translation -angularfor A/B/C rotation - other values are treated as static by motion updatesposition: Base transform as[x, y, z, rx, ry, rz]. - translation uses machine units - rotation uses degreesorigin: Rotation pivot point[x, y, z]. - forangularparts this is critical - if omitted ornull, transform falls back topositionfor pivotaxis: Motion token (see next section).joint: LinuxCNC joint index metadata.color: Optional diffuse color[r, g, b].power: Optional specular power.
Supported Axis Tokens
For type: linear:
x,y,z-x,-y,-z
For type: angular:
a,b,c-a,-b,-c
Notes:
Use lowercase axis tokens in YAML.
If
axisdoes not match a supported token for the selectedtype, that part will not move as expected.
How To Build Any Combination
Use the roadmap example above as a baseline, then adapt it with the sequence below.
Start with a static base/root.
Add linear axis chain(s) in physical order.
Add rotary axis nodes where the real machine rotates.
Set each rotary
originto the mechanical center of rotation.Add matching
[VTK]axis ownership in the INI (headortable).Run and verify each axis independently.
Combination Templates
These are targeted variations of the roadmap pattern, not replacements for the schema/rules above.
3-axis mill (XYZ)
root:
id: "frame"
model: "machine/frame.stl"
type: "table"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: null
joint: null
child_saddle:
id: "saddle"
model: "machine/saddle.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "y"
joint: 0
child_table:
id: "table"
model: "machine/table.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "x"
joint: 1
child_headstock:
id: "headstock"
model: "machine/headstock.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "z"
joint: 2
4-axis table rotary (XYZA or XYZB)
Add a rotary node under the table branch.
child_a_axis:
id: "a_axis"
model: "machine/a_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "a" # use "b" for B-axis machine
joint: 3
4-axis head rotary (XYZ + head A/B/C)
Add the rotary node under the head branch instead of table branch.
child_headstock:
id: "headstock"
model: "machine/headstock.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "z"
joint: 2
child_a_head:
id: "a_head"
model: "machine/a_head.stl"
type: "angular"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "a"
joint: 3
5-axis trunnion style XYZAC
Add A then C on the table branch (nested rotary stages).
child_a_axis:
id: "a_axis"
model: "machine/a_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "a"
joint: 3
child_c_axis:
id: "c_axis"
model: "machine/c_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "c"
joint: 4
5-axis trunnion style XYZBC
Same as above, but use B then C.
child_b_axis:
id: "b_axis"
model: "machine/b_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "b"
joint: 3
child_c_axis:
id: "c_axis"
model: "machine/c_axis.stl"
type: "angular"
position: [0, 0, -18, 0, 0, 0]
origin: [0, 0, -18]
axis: "c"
joint: 4
Lathe-style XZC (example pattern)
Use X and Z as linear, with C as angular on the spindle/table side.
child_x:
id: "x_slide"
model: "machine/x_slide.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "x"
joint: 0
child_z:
id: "z_slide"
model: "machine/z_slide.stl"
type: "linear"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "z"
joint: 1
child_c:
id: "c_spindle"
model: "machine/c_spindle.stl"
type: "angular"
position: [0, 0, 0, 0, 0, 0]
origin: [0, 0, 0]
axis: "c"
joint: 2
INI [VTK] Axis Ownership
Set ownership for active machine axes in the INI.
head: axis motion belongs to spindle/head sidetable: axis motion belongs to table/workholding side
Example for XYZAC trunnion:
[VTK]
MACHINE_PARTS = machine.yml
X = table
Y = table
Z = head
A = table
C = table
Example for head rotary A:
[VTK]
MACHINE_PARTS = machine_head_a.yml
X = table
Y = table
Z = head
A = head
Use only head or table values.
Troubleshooting Checklist
Part does not move: check
typeandaxistoken pair, then verify the axis is active in machine coordinates.Rotary appears to orbit incorrectly: correct the part
originpivot point.Warning about missing machine axes in
MACHINE_PARTS: add YAML nodes for all active axes (X/Y/Z/A/B/C as applicable).Warning about table rotary missing origin: define
originfor each table-owned rotary axis.VTK ownership mismatch warnings: align INI
[VTK]axis ownership with the actual machine design.
Reference Examples In This Repository
configs/probe_basic_asm/machine3.yml(3-axis)configs/probe_basic_asm/machine.yml(XYZAC)configs/probe_basic_asm/machine_b.yml(XYZBC)configs/probe_basic_asm/probe_basic.ini(INI mapping example)configs/probe_basic_asm/probe_basic_xyzac.ini(INI mapping example)configs/probe_basic_asm/probe_basic_xyzbc.ini(INI mapping example)