Retreving the Vertices,Edges and wire from the presentation

Can someone help me in taking the face details which was selected from the presentation. Consider i am having a box and i can select the faces of the box using following code,


now after selecting any one of the face of the box using the mouse click. How to get the details of the face such as (Vertices, Edges and Wires if involved) after we select a face by the presentation.

Thanks in Advance,

Paul Jimenez's picture

Check the following methods from AIS_InteractiveContext:

* InitSelected, HasSelectedShape, SelectedShape

You can explore the face (or any other shape) using TopExp_Explorer specifying what you want to iterate over. You can even nest it to explore wires of face, edges of wire and vertices of edge. You could also try TopExp::MapShapes, depending on how you want to do the exploration.

If you need to cast to a specific type, check in TopoDS:

* Compound, CompSolid, Solid, Shell, Face, Edge, Vertex.

If you want to know the coordinates of a vertex, you can use BRep_Tool::Pnt.

I hope that helps.

Vidhyan's picture

Paul Jimenez,
Thanks a lot for your help. Using TopExp_Explorer i am able to get the vertex ,edges etc.. from the shape. It helped a lot thanks.