Command rotate 4 straight lines average parallel to Cplane?

Hi,
oops forgot to attach the file, now added to initial post.

Take a look then establish best method.

I need an average of the 4 lines in front view, then take that, group it to the lines and tractor (tractor not in uploaded file as its a mesh and huge file size) and rotate it to horizontal,

I had a Pascal script AverageCurves.py and perhaps this might do it.
I make a new button, then add the script, which is to be found in the following the thread:-

and run it, and in Front view I get a short line which is an average of the lines, .
Group that to the lines and rotate that line to horiz.

That would seem to do what I require.

However why is that average curve much shorter than the others ?

make lines average level tractor_AverageCurves macro.3dm (34.5 KB)

I extend the line either end to compensate and have something larger to work with.

Now I realise perhaps average is not quite the right thing.

Say I have lines 0.1deg 0.0deg (level), another 0.0 , 0.05 and 0.9 degs
Average would allow 0.9 to have too much of an influence, clearly my object is almost level, averageCurve would be 0.2deg and throw my object out if I rotated that to level. I need something that takes account of the most prolific of the curves, standard deviation etc school stuff ! what is in the centre of the hump !
How is that done ?

Cheers

Steve