Automation of _DupBorder and _ExtractPt with Python

Dear all,

I am a biology student using 3D models (.ply) of animal tracks.
For my project I need to extract the border of the mesh (_DupBorder) , extract the point (_ExtractPt) and export them as .txt.
It is really to do manually but i really need to automate this because I have than 3300 models and i am a complete beginer in coding.

All my data are in one same folder, I suppose I need some kind of loop opening mesh by mesh and extracting the points.

Do any one of you could help me even a little ?

Kindest regards,


Here’s a simple approach using the GHPython component to get the naked edge loops vertices (using RhinoCommon API mesh functionality), and then exporting their coordinates using the Grasshopper Panel streaming functionality: (26.3 KB)

You can also write to file using the standard Python file writing functionality. If you for some reason don’t want to go through Grasshopper (which I would highly recommend), you could implement the mesh/polyline methods I’m calling above and the Python write function in a “normal” RhinoPython script.

1 Like

Hi Anders,

First thank you for taking the time to answer me.

I would prefer to use only Python to loop the opening of all my mesh one by one.

I was trying to use your little script to test the function but i report me an error saying the “Mesh” is not defined. Any idea ?

You need to reference your mesh in Grasshopper. You can simply right-click the Mesh component, click on Set One Mesh, and select your mesh in Rhino. Et voilà, you’re done!
Your Mesh component should now output the mesh in question and forward it to the GHPython component, provided by Anders. You can for instance use a panel to see what a component outputs.
Generally speaking, this is how you reference Rhino geometry (e.g. points, lines, curves, surfaces, breps, meshes, etc.) in Grasshopper.

I’d also recommend the Grasshopper route, since it’s more straightforward and beginner friendly than scripting directly in RhinoPython. You are able to fragment your process into smaller tasks and debug each task, and don’t have to run the entire script each time. You can also preview what happens, what data is output at which step, and how it is structured, which if far more cumbersome in RhinoPython.

Here’s how I’d imagine your process:

  1. Come up with a way to import your PLY files directly into Grasshopper.
  2. Extract the border information
  3. Export the text files

The first part is probably the hardest. Could you provide one PLY file for testing?


I don’t think I have GrassHopper is installed with my version of Rhino so i need a script to make this process run. :confused:
Here is one of the .ply (84.2 KB)
Thank you


Which version of Rhino are you using? Have you enabled the GrassHopper plugin and tried to lauch it by typing GrassHopper?


I’m using 5.0… I don’t know why. I downloaded again the plugin and it’s still not working…

Have you enabled it with _PlugInManager ? Maybe try searching for ‘install GrassHopper’ on the forum as well…

Hi - I hope you meant 5.14.