How can I get mesh data from a selected object in the station into an Addin?
I'm trying to create a robotstudio addin that operates on mesh data, but I can't find a good way to get the mesh data from a selection into an addin. All I need is a list of the vertices and indices, or just a list of Face or MeshFace objects. The closest I've gotten is the process below:
This makes logical sense, but the code isn't behaving how I would expect: The code keeps giving me single digit numbers for the amount of faces, even if the selected part has over a thousand faces. I've tried using the Mesh.closest() method instead of indexing, but it gives the same result. RobotStudio clearly knows how many faces the mesh actually has, since it's rendering everything properly, I'm just not sure how to get that data into my addin.
If anyone has a good way to get selected mesh data into an addin, I'd love to hear it!
- Get the selected object from the Selection
- Cast the object as a Part
- Get the Mesh from the Part
- Get the MeshPart from the Mesh by indexing using the Fine detail level
- Get MeshFace data from theMeshPart
This makes logical sense, but the code isn't behaving how I would expect: The code keeps giving me single digit numbers for the amount of faces, even if the selected part has over a thousand faces. I've tried using the Mesh.closest() method instead of indexing, but it gives the same result. RobotStudio clearly knows how many faces the mesh actually has, since it's rendering everything properly, I'm just not sure how to get that data into my addin.
If anyone has a good way to get selected mesh data into an addin, I'd love to hear it!
0
Answers
-
Solved, you have to dig down to the MeshFace level and the data is contained in the vertices and triangleindices structures.0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings