How to get all child model elements of a STEP model and display them as a tree view?

The main purpose is to go through all child elements (child parts of the entire model) of a STEP model and to make a tree view out of them using OpenCascade. Now I am downloading the STEP model according to a particular path to a TopoDS_Shape object and then I am passing this object to the AIS_Shape object in order to finally display the model in the viewport. So, I thought that there was a method that should get a model path or a model itself as a parameter, then recursively go through all its child and finally prints them somewhere

Kirill Gavrilov's picture

If you would like to display a decomposed assembly tree as defined in STEP document in 3D viewer, you may try taking a look at XDEDRAW_XDisplayTool (XDisplay command implementation). Tool XCAFPrs_DocumentExplorer might be helpful to iterate over document in a non-recursive way (sure, recursive implementation will be simpler, but less predictable).

Of course, you will need to read STEP file into XCAF document, rather than in form of a single TopoDS_Shape, as TopoDS_Shape doesn't preserve names and colors.

Кирилл Жильников's picture

I would like to create a tree view of my model using Gtkmm (TreeView widget) and using OpenCascade - to go through all parents and children. In photos you can see the code I use (your code from stack overflow) and the result I get. I want to get the result like in DFBrowser ( - to build the tree view of the model, but using gtkmm for displaying this tree