@chrisb:If such construction geometry is created manually it is usually placed at the end of one of the lines. You can then replace the point-on-object constraint by a coincidence.
If you really want to position the construction lines in the middle of the lines use a symmetry constraint. Please note that this implies the point-on-object constraint.
I try to show you the problem in the attached picture. Imagine allways the left lines are original, the right are the offset lines. The offset value is positive.
Left subfigure: (offset line inside)
Everything OK. The distance line startpoint is at the endpoint of the first offset line.
Middle subfigure: (offset line outside)
The distance line startpoint is at the endpoint of the first offset line. Script fails, distance line endpoint cannot be connected to original line using PointOnObject.
The logic alternative: the distance line starts at the endpoint of the original line.
Distinguish between the left and the middle situation is complicated. The original line has been created by the user. It can be reversed, etc. It is difficult to determine on which side the offset line is situated, etc. The script is not "allowed" to change ist.
So I had the idea, to start the distance line at the midpoint of the offset line. The offset line has been created by the script. The script "knows" everything about it, and can create it as needed. The distance line (in normal situations) allways finds a counterpart for using PointOnObject.
Manually it is very easy to decide about starting at the original or the offset line, and to decide about taking the startpoint or the endpoint. The script needs an as possible simple algorithm which is working in every situation. Thats the problem.