# VSTA: read geometry information

**URL:** <https://tech-community.robotics.abb.com/t/vsta-read-geometry-information/1216>\
**Category:** RobotStudio\
**Created:** [May 16, 2007, 1:38pm UTC](https://tech-community.robotics.abb.com/t/vsta-read-geometry-information/1216 "2007-05-16T13:38:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robotrix](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@robotrix](https://tech-community.robotics.abb.com/u/robotrix)\
**Post date:** [May 16, 2007, 1:38pm UTC](https://tech-community.robotics.abb.com/t/vsta-read-geometry-information/1216/1 "2007-05-16T13:38:13Z")

</div>

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 …

---

<div class="post-metadata">

**Author:** ![apox](https://dub1.discourse-cdn.com/flex005/user_avatar/tech-community.robotics.abb.com/apox/32/2392_2.png) [@apox](https://tech-community.robotics.abb.com/u/apox)\
**Post date:** [May 16, 2007, 1:52pm UTC](https://tech-community.robotics.abb.com/t/vsta-read-geometry-information/1216/2 "2007-05-16T13:52:52Z")

</div>

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
