Reordering Point ID to save data after slicing

Hi all,

I would like to extract the data from a slice but to reorder the point ID so that they are consistent with the numbering of the initial geometry.

In more details, I want to export the data from the slice in .csv, then use this .csv to generate a new mesh based on my extracted results with MMG3D (in 2D mode). My issue is that when I remesh with MMG3D (.sol file containing the targeted cell size obtained from the extracted data), the refinement locations are not where they should be because the order of the point from the extracted data is different from the one expected from MMG3D.

Note that this issue is not appearing if I extract the 3D data and remesh with the 3D mode of MMG3D because the point order is respected.

How can I reorder the points ID after a slice? From what I see, it seems that the first points should correspond to the boundaries of my geometry. If I have a look of the point by scrolling their ID after a slice they are arranged in messy configuration.

Thank you very much for your help,

This looks highly specific. you may need to write your own logic in a programmable filter.