Aligning cat arb bone to two helper objects in 3dsmax

maxscript
max

#1

Hi,
i am looking for a way to align cat arbbone to two helper objects in such a way,
catbone places itself on first helper object in world and rotate it self to look at second object and increase length or depth to match distance between two helpers and finally rotate itself to look at second helper.
current progress, just places bones in relevant space. any ideas would be greatly appriciated

function createHelpersFromSelection = (
for each in selection do (
if (findstring each.name “end") == undefined then (
pt = point()
pt.position = each.position
pt.name = "pt
” + each.name
pt.size = 0.1
)
)
)

function createCatBonesFromHelpers = (
– first is cat object , second is faceparent
a = selection[1] – CAT PELVIS
b = selection[2]
for each in b.children do (
print each.name
catCnt = a.controller
–cnt = a.controller
cnt = catCnt.addArbBone()
–cnt.address
bObj = cnt.node
– way1
pos = each.pos - cnt.setuptm.pos
move bObj pos
–aCATBone.transform = target.transform
– way 2
tm = cnt.setuptm * inverse catcnt.setuptm
tm.pos
tm.rotation

  --bObj.width = bObj.depth = bObj.length = 1
  bObj.controller.name = "bn_" + each.name
  #q = (eulerAngles 90 0 0) as quat
  #rotate c.node q

)
)

–createCatBonesFromHelpers()