Table of Contents

Machine Chain Code

A machine tool file can carry its kinematic topology as a chain code — a short bracket notation for the same connectivity the mechanism builder produces, meant for hand-editing the XML. It is read and written by CodeXyzabcChain(API), which builds the very same mechanism, so a hand-written code and a builder-drawn structure are interchangeable — with two exceptions on the way back: a mechanism with two components sharing one name, or with an unnamed component that more than one segment would have to mention, cannot be written down as code.

The code carries connectivity only. Pivots, exact axis vectors, end-anchor offsets and shapes are properties of the mechanism, and editing the code preserves them for every component whose name is unchanged.

The Notation

Each segment declares branches from left to right:

[O][base][Z][C][w];[O][base][Y][X][B][S][t]
  • [A][B][C] is shorthand for the branches [A][B];[B][C], so a segment is just a path.

  • Words are components. The same word in different segments is the same component, which is how segments join into one structure.

  • The first word of the whole code names the ground anchor. Within a segment each branch runs from the word on its left to the word on its right.

  • Reserved words are the topology keywords: X, Y, Z, A, B, C become motion axes, and w and t become the end anchors. Any other word is a plain component carried along without motion, such as base or S above. A code must name exactly one [w] and one [t]; the six axes are optional, and each may be used at most once. Words merge by exact name, so no two components can claim one role; what the check refuses is a code naming no table buckle at all — the chain code must contain the table buckle [w]. A code carrying only [W] is refused by that same check, and the message names the near miss: The code carries [W], which differs only in letter case; the keyword is matched exactly, so rename it to [w].

  • Spell the keywords exactly — upper case for the axes, lower case for t and w. The code itself and everything downstream of it compare them as written: role resolution, axis discovery, the default collision pairs, and the end-anchor check a machine file is loaded through. So a mis-cased axis is a plain component contributing no motion, and a mis-cased end anchor stops the code building, with a message naming the near miss.

  • [] is an anonymous component. Each occurrence is a separate one, it cannot be referred to from another segment, and it cannot hold a geometric shape — shapes are stored by component name.

  • Declaring the same branch twice is harmless; it states the same connection.

  • A segment with a single word just declares a component, which is how a ground anchor that only receives branches gets named.

  • Any number of segments is allowed, so auxiliary structures can branch off any component:

    [O][base][Z][C][w];[O][base][Y][X][B][S][t];[base][loader][gripper]
    

Direction and Convergence

Branch direction is free. A branch authored towards the ground anchor is simply written that way, as in [Z][O]. A branch belongs to the component farther from the ground anchor, so [O][Y] and [Y][O] both make Y the axis; only the direction differs. Pointing every branch away from the ground anchor remains a readability convention — it makes the structure read outwards, ground → base → motion axes → the t and w end anchors — but the motion, the axis keywords and the default collision pairs all read a branch the same way round regardless.

Limbs may meet again. [A][B][D];[A][C][D] gives D two incoming branches. Only one route through such a loop drives the motion, so use it for structure rather than for a second motion path.

Axis directions follow the machine-building convention: axes between the ground anchor and w are seeded negative, the others positive.

See Also

  • Kinematic Topology — the anchors, branches and assemblies this notation encodes
  • Machine Tool — building the same structure in the mechanism builder, and the keywords both forms share