For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Could we retrive information from Compond?

wei guo's picture


Given TopoDS_Compound &c, how could I retrive not only geometry but also topology information? For example, all vertices in that compount and indices of vertices of each edge.

I need thoseinformation at run time and do not want to output them as files.

Thanks for any help,

Best regards,


Rob Bachrach's picture


When the topology is in memory, there is really no such thing as an index on a vertex. However, there are multiple ways to get the edges and the vertices on each edge. One way you can consider is:

TopExp::MapShapesAndAncestors(c, TopAbs_VERTEX, TopAbs_EDGE, myMap);

This creates a TopTools_IndexedDataMapOfShapeListOfShape where each indexed item in the map is a vertex the data value for each vertex is a list of edges connected by that vertex.

If you need to look at each edge and its vertices, you can use TopExp_Explorer to traverse the edges and then traverse each edge for its vertices. You can also use BRep_Tool::Pnt to get the actual locations for those vertices.


wei guo's picture

Hi, Rob, thanks a lot for help.

I use TopExp_Explorer to explorer the edges and faces. And it seems that those elements are duplicated because of topology structure. For example, for a ring structure (one cylider was cut by another cyplinder inside). There should be 4 surfaces required to be rendered while through TopExp_Explorer, there are 12 faces instead.

While 4 of these 12 faces are with Orientation as 1 and other 8 are with Orientation as 0. Based on that, could I only render faces with Orientation as 1?

Best regard,


Rob Bachrach's picture

Are you sure you are only exploring the ring? I did the following in the DRAW test harness:

pcylinder outer 3 1
pcylinder inner 2.5 1.5
cut ring outer inner
explode ring F

You will notice that it only creates 4 faces. Likewise, a dump of ring only shows 4 faces. Granted, edges are usually duplicated since they appear in opposite directions on adjacent faces, but faces should only appear once.

Understand that if you explore the edges and then explore the faces attached to those edges, faces will, of course, be duplicated.


wei guo's picture

Hi, Rob,

Thanks a lot for response.

I made a ring as well but I build the topology in c++ instead of script. The procedure is:


So I feel the reason that I have 12 faces elements is because shells and solids contain the face elements as well so I got this number trippled.

Could you let me know whether I did it correctly?

Best regards,


Rob Bachrach's picture

Your general outline is correct. It is hard to say for sure without see true code. However, if your solid is just built from your shell, and the shell from created faces, etc., your final solid should only consist of the faces you created in buildFaces. Therefore, if you use the explorer to traverse the faces in your "solid" you should only see 4 faces.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.