mcbuilder is the machine builder of linuxcncMulti, modelled on
SINUMERIK’s Create MyVirtual Machine /3D Builder. A machine is built as a
kinematic tree in a *.mcm file (JSON); the same file drives the 3D
view, material removal and collision check of mchmi and is exported as
the LinuxCNC configuration, so a machine is described in one place. It
is started with mcbuilder [model.mcm]; mcbuilder model.mcm --export
DIR writes the configuration without the window (man page
mcbuilder(1)).
Window
-
Left: the kinematic tree with a toolbar that adds a node of each type under the selected one, an eye column that hides a subtree, drag and drop to re-hang nodes, a context menu with copy/cut/paste/delete (Ctrl+C/X/V, Entf) and undo/redo (Ctrl+Z/Y). Below it the properties of the selected node.
-
Centre: the 3D preview (orbit with the mouse, zoom with the wheel, camera buttons Iso/Vorne/Hinten/Links/Rechts/Oben, "Alles" fits the machine). The selected subtree is highlighted, tool slots and mount positions show their frames.
-
Right: the pages Simulation (a slider and entry per axis, filter, reset), Bibliothek (parametric components), Kollisionsgruppen, Ebenen (layers) and INI (free INI keys, INI preview).
Nodes
Coordinates are millimetres in a right-handed world frame with Z up. Every node has a position and a roll/pitch/yaw orientation in its parent’s frame (R = Rz(yaw) Ry(pitch) Rx(roll)); an axis node moves its subtree along or about its axis vector, given in the node’s own frame.
| Node | Meaning | Properties |
|---|---|---|
Translationsachse |
linear axis |
axis vector, min/max, initial value, velocity, acceleration, home position / switch offset / search velocity / sequence ( |
Rotationsachse |
rotary axis |
as above; rollover for endless axes, Schwenkachse marks a swivel head whose TRAORI data set is derived from the geometry |
Spindel |
work or milling spindle |
rotary axis with the spindle number, maximum speed, counter-spindle flag; with a joint number it is also the C axis |
Revolver/Magazin |
tool carrier |
stations, active station (the cutting position), channel ("tool unit"), magazine number, driven-tool spindle, pitch radius; "Werkzeugaufnahmen erzeugen" places the tool slots on the pitch circle |
Geometrie |
a machine part |
primitive shape (box, cylinder, tube, n-gon, cone with axis) or STL file (ASCII or binary), colour |
Werkzeugaufnahme |
tool slot |
kind (station of a turret, spindle place, magazine place), channel, magazine, slot number, holder transformation. The tool tip is the slot origin, the tool body lies along the slot’s +Z |
Montageposition |
workpiece on a spindle |
workpiece number ( |
Gruppe |
transformation for its children |
|
Signal / Schalter |
a HAL pin switches subtrees |
pin name and default value; the switch with the matching trigger value is shown |
The library inserts ready-made subtrees under the selected node:
milling spindle (taper, length, diameter), work spindle with chuck,
chuck, VDI turret with its stations, disc magazine, swivel head (B
about Y with a milling spindle pointing down), linear axis, bed, column,
slide, tailstock. The example
configs/sim/multichannel/index_g200/index_g200.mcm is the INDEX G200
of the simulation built from these components.
Import of a vismach model module (new)
The hand-written models of mchmi ([DISPLAY]MACHINE_MODEL = _model.py,
a Python module whose build(j, …) returns a vismach tree) are opened
in the builder with Datei > Python-Modell importieren, Datei >
Oeffnen on a .py file or mcbuilder model.py; mcbuilder model.py
--convert [OUT.mcm] converts without the window (the file goes beside
the module unless OUT is given), --export DIR exports the imported
model straight away. The module’s build() is run with every joint at
0 and with the vismach classes replaced by recorders (no OpenGL is
needed), and the recorded tree becomes the kinematic tree:
| vismach | node |
|---|---|
|
flattened into its parent |
|
a group with the position / orientation (roll, pitch, yaw) |
|
a translation / rotation axis with joint N |
|
a HAL-driven axis, the pin from the module’s |
|
a signal node (the pin) with a switch that shows the parts |
|
geometry box |
|
geometry cylinder, with two radii a cone |
|
geometry sphere (a new shape of the builder) |
|
geometry STL, the file is referenced |
|
the colour of the geometry inside |
The modules draw in the frame of mchmi’s view (y up), the model’s world
has z up: every position, axis and shape is converted. An INI in the
module’s directory (#INCLUDE files are followed) gives the joints
their letters ([TRAJ]COORDINATES or the kinematics' coordinates=,
per channel [CHANNEL_n]JOINTS/COORDINATES), limits, home data,
velocity and acceleration; without one the letters follow the axis
direction and the limits stay at their defaults. Tools the module draws
from the tool file are not imported (the tool slots draw them), so the
tool slot of the spindle, magazine nodes and collision groups are added
afterwards in the builder. What cannot be converted (Scale,
HalRotateEuler, Track, a coordinate read from a HAL pin while
drawing, an STL given as data) is listed in the import report; the parts
of an unsupported transform are placed without it. The imported model
is not saved yet: Speichern suggests <name>.mcm beside the module.
Export of the configuration
Datei > Konfiguration exportieren (or --export DIR) writes into the
chosen directory:
-
<name>.ini-[EMCMOT]NUM_CHANNELS,[KINS]trivkins with one letter per joint,[TRAJ]/[CHANNEL_n]withCOORDINATES,JOINTS,NAME,MASTER_SPINDLE,TOOL_DBand theTRAORI_k_*data sets of swivel axes (BASE_TOOL= pivot to tool tip at the axis value 0,ROT_DIRin the channel’s machine coordinates),[JOINT_n]with type, limits, velocities and the home keys,[AXIS_x]covering all joints of a letter,[SPINDLE_n],[WORKPIECE_n](chuck face Z, direction, C joint, slide joint, chuck output),[DISPLAY]MACHINE_MODEL = <name>.mcm. The free keys of the INI page (SECTION.KEY = value) are added, a key given there wins over the derived one. -
<name>.hal- simulation HAL with the position loopbacks of all joints, one iocontrol per channel and the spindles;<name>_postgui.halnets the mchmi panel keys and feed pot to every channel’shalui. -
<name>_chN.tools- an mctooldb tool file per channel listing its stations (written once, never overwritten). -
<name>.mcmand the STL files it references;linuxcnc_mc.nmlfor more than one channel.
Export is refused while the model has problems (duplicate joints, gaps in the joint numbers, a letter twice in a channel, min >= max, spindle numbers with gaps).
The model in mchmi
With [DISPLAY]MACHINE_MODEL = <name>.mcm mchmi builds its 3D view from
the model: geometry nodes become meshes, axis nodes with a joint follow
the joint positions, coupled axes their driver, the tool slots show the
tools of the magazines (the station of a turret, the active tool in a
spindle place). The collision check takes the static parts (geometry
not under a translation joint) as obstacles, parts under one translation
joint as moving with it, and the geometry below the joint that carries a
channel’s active tool slot as that channel’s holder; the cutter body
direction of a milling spindle comes from the slot’s +Z. Hand-written
vismach model modules (*_model.py) keep working.