Very cool system. It's just what I needed.
I found a typo in the TLRingCallback function:
set x1 = a.Cx + a.a1cos[i] * a.curdist
set y1 = a.Cy + a.a1sin[i] * a.curdist
set x2 = a.Cy + a.a2cos[i] * a.curdist
set y2 = a.Cy + a.a2sin[i] * a.curdist
The third line should use a.Cx...