How does kicad generate the geometry of a track/trace?

When a trace is selected, in the layout editor, somewhere in memory, I am guessing that there is a list of vectors in order for the graphical program to highlight the trace. Of course, someone out there will say “why don’t you just read the Gerber file after it is generated?”. And they would be correct in asking that. But reading Gerber files directly is next to impossible and there are no signal names associated with all of the different elements.

Or, to put it another way, how could I generate a Gerber file from just one trace (and it’s associated tracks). Again, someone could say “just create a schematic and layout with just that one trace?”. And I would say, not to useful if one imports a large board with lots of traces on it and I just want to create a FEM analysis of one of those trace.

To make it simple, what I want to do is to be able to “mesh” that trace in 3D (create tetrahedral or such) for use with an electromagnetic solver.

Thank You

Tom

FYI, I am an “old guy” who did layouts way back in Orcad and Pads and now use primarily Altium. Interested in contributing to Kicad because it is open source.