VSTA: read geometry information
robotrix
✭
in RobotStudio
Has anybody experiences on VSTA regarding the possibilities
to read geometrical information of a selected part or body
How can you read geometrical informations (faces, vertices, nodes):
e.g. a box has 6 faces, it has ... nodes at X, Y, Z ...
robotrix
0
Comments
-
I'm using this code to get these informations. Perhaps there is a easier way to do that.
Station station = Project.ActiveProject as Station;
if (station == null)
{
Logger.AddMessage(new LogMessage("Station = null..."));
return;
}
ProjectObject selObject = Project.ActiveProject.Selection.SingleSelectedObject as ProjectObject;
if (selObject == null)
{
Logger.AddMessage(new LogMessage("Nothing selected..."));
return;
}
Logger.AddMessage(new LogMessage("selected object: " + selObject.Name + " - " + selObject.Attributes.Count));
Part selPart = selObject as Part;
BodyCollection selBodiesC = selPart.Bodies;
Body selBody = selPart.Bodies[0];
Logger.AddMessage(new LogMessage("Number of bodies in selection :" + selBodiesC.Count));
ShellCollection shellC = selBody.Shells;
Logger.AddMessage(new LogMessage("Number of shells:" + shellC.Count));
Shell selShell = shellC[0];
FaceCollection faceC = selShell.Faces;
Logger.AddMessage(new LogMessage("Number of faces:" + faceC.Count));
foreach (Face f in faceC)
{
LoopCollection faceLoopC = f.Loops;
Logger.AddMessage(new LogMessage("Number of loops:" + faceLoopC.Count));
Logger.AddMessage(new LogMessage("Face Color:" + f.Color.ToString()));
foreach (Loop l in faceLoopC)
{
CoedgeCollection coedgeC = l.Coedges;
Logger.AddMessage(new LogMessage("Number of coedges:" + coedgeC.Count));
foreach (Coedge cEdge in coedgeC)
{
Vertex v0 = cEdge.StartVertex;
Vertex v1 = cEdge.EndVertex;
Logger.AddMessage(new LogMessage("Vertices: " + cEdge.StartVertex.Position.ToString() + " / " + cEdge.EndVertex.Position.ToString()));
}//for coedges
}//for loops
}//for faces
apox2007-5-16 13:58:380
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings