Line by points in XY plane following a path

Hi All,
I am trying to create a script which draws a line to adjacent points as shown in cyan color in snap.


The actual problem is that I have a list of element Ids and I want to collect all of them and draw a path/line which passes through all of them. but is should not be a zig zag which is what currently I am getting.

Hola amigo @NIRMAL buenas. may best fit will help but i don’t think so.

the probleme is that the points are not in a consecutive order, you will have to figure out how to order it or go back a little and try to find a diferent aproch, if i understand well you try to project a 3D geometry into a Flaten level 0 i’m right??

I am attempting to display a 2D line in a view that follows the elements with provided IDs to visualize the path. This path represents a wire routed through cable trays, showcasing how the wire is guided from equipment to the panel.

I am still progressing on it but didn’t get any success yet :cry:

Line.ByBestFitThroughPoints is not what I need

hoo ok, you want to get the 3D cable tray path and convert it in a 2D is that?? can you share your .rvt file to try something?? may be you can check this post may be gives you some ideas!!

How about closest point to, and a parameter at point, and use these keys for sort…
Edit: not sure what you are after, is it something here ?? probably best if you could share a rvt sample file…