I think the editor has to be able to import the models and then "tag" them. The track pieces have to fit together like the real thing. So once the track model is imported into the editor, the editor will allow you to tag the model and that model would need to be tagged as male on one end and the other end as female. It's the same concept as Lego.

Actually there is a Lego CAD program that was written in Delphi many years ago that did something similar. I think http://www.ldraw.org/ ( not sure if this is still related to the Delphi guy's work ) may provide some clues about how it could be done.