A little demo showing what you are after will help.
To set an object position to an image-point instead of its origin-point you will need to make some calculations to position it
To set the Width of the line just set the width to the distance you are after, if you set it to the distance between two objects then make sure the object is picked before you reference it, I think you have a problem of picking.