Categorizing CAD Lines

Hello

 trying to solve an algoritmic problem... anyone seen the rosetta stone of my brain ???

not sure the method but i have to make script or node"what ever you call" that solves distance betwean two model curves and draws a set of polycurves with respect to them…

 is the python code is somethn smiliar like this{

init revit.elements
init revit.styles
init math.geo
init math.distance

clr select.model.elements(model.curves(x))
for line.style(model.curves(x)) == walls

do:
search for parallel curves;
for each parallel curve find nearest parallel curve
do:
curve.referance(XsXe,YsYe,ZsZe);
curve.parallel(XsXe,YsYe,ZsZe);

                      math.MidCurve( (curve.referance + curve.parallel)/2);

"now remembered if there is an other ghost curve over there then it will be the nearest and then it will again screw up algorytm

oassdjfalsdkjfşasldf
im starting to wonder where to go where to start again… know no answer will come but have to find that algorythm…

else:

return 0;

WHİCH METHOD DO İ NEED TO USE…