How to create a railing

Hello, friends! Please tell me if it is possible to sort the list of lines (room boundaries) so that the first point of the next line is equal to the last point of the current one to create a railing along them?
New Test.dyn (49.7 KB)

Hi @toxa2407001 ,

Could you please add some screenshots and a corresponding Revit file? Most people (including myself) are too lazy to actually download, open and do all that stuff.

If they are in a connected loop, convert them to a polycurve then explode them again. The curves should now be in a continuous order with first/last points lining up.

Thank you! I had the lines of the room in the correct order, but then I deleted the side on which the door is located and added two lines to the door and from and through all the manipulations the order was disturbed. Now the task is to sort this list so that the curves are lined up in the correct order according to the start and end points, but I can’t do that.