Wireframe/solid display

I'm trying to set up an application where a BREP/STEP model is loaded, and then the user can set props for various solids withing the model. Basically, the user would select a solid from a list, and I'd like the display to have just that solid rendered with solid faces, whereas all the others have a wireframe representation. Since the selected solid can be hidden somewhere inside/behind all the other components, I'd like the un-selected components to be transparent, but still have a bit of an idea where they are -- that's why wireframe.

Is it possible to do this with OCC? I've managed to display the selected/unselected components with different colors by separating them into two different compounds and updating the displayed AIS_Shape's on the fly. I've seen that a viewer needs to have some lights set up for rendering, but then the wireframe'd components appear solid again.


EricThompson's picture

Yes, it is possible to show some shapes as wireframe and some as shaded.

You can set the display mode for the entire context like this:

aContext->SetDisplayMode( AIS_Shaded ); // Or AIS_WireFrame

Then you can override individual shapes like this:

aContext->SetDisplayMode( aShape, AIS_WireFrame ); // Or AIS_Shaded

Tiberiu Chelcea's picture

Eric, thanks for the suggestion. I've tried it and it works fine. However, yesterday I came up with a different method to do this: for the unselected solids I'm building a compound made of all of their edges, and displaying that. For small models (i.e. with few solids), they both work equally fast (though your method is nicer in that it displays additional wires to help with visualization). For larger designs (I've tried 250+ solids), the method with compound of edges seems to work much faster. I might use a hybrid approach to this, depending on the number of solids in the design, but have to figure out how to change the colors of wireframes.