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.
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:
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.
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:
Come up with a way to import your PLY files directly into Grasshopper.
Extract the border information
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.
Here is one of the .ply amb332-mp.zip (84.2 KB)
Thank you