Does OCC Hidden Line works?

Hello everybody,
I'm having problems with OCC interactive 3D views in Hidden Line mode.
I attached to this emal 2 links to 2 images: one is the an OCC sample and the other one is a test I'm developing to evaluate OCC.
In the first case, the OCC sample, the hidden line of each object works just fine, however is not working for the 3 objects aligned in the same 3D view.
In the second case I fuse 3 boxes and the hidden line does not work for all faces of the same shape.

Based on your experience should I look for a different graphics library, to put on top of OCC modeling kernel or OCC interactive graphics should work and is worth digging into the issue until resolution.

I really appreciate any comment.
Thank you

Stephane Routelous's picture

did you check that your fused shape is valid ?
if the shape is not valid, it is normal that the HLR computation gives wrong result.
try to fix your shape after your fuse



anassisi's picture

Hello Stephane,
Here is my test, I added BRepCheck_Analyzer to check if is valid.
The result is valid but still same display result.

TopoDS_Shape w1 = BRepPrimAPI_MakeBox(gp_Pnt( 0. , 0. , 0. ), 400. , 10. , 96. );
TopoDS_Shape w2 = BRepPrimAPI_MakeBox(gp_Pnt( 390. , 0. , 0. ), 10. , 300. , 96. );
TopoDS_Shape w3 = BRepPrimAPI_MakeBox(gp_Pnt( 400. , 290. , 0. ), -400. , 10. , 96. );
TopoDS_Shape w4 = BRepPrimAPI_MakeBox(gp_Pnt( 0. , 0. , 0. ), 10. , 300. , 96. );

// Boolean between w
TopoDS_Shape h1 = BRepAlgo_Fuse(w1,w2);
h1 = BRepAlgo_Fuse(h1,w3);
h1 = BRepAlgo_Fuse(h1,w4);

// Check shape
BRepCheck_Analyzer TheVerif(h1);
if (!TheVerif.IsValid(h1))
//if not valid show one box
h1 = BRepPrimAPI_MakeBox(gp_Pnt( 0. , 0. , 0. ), 400. , 10. , 96. );

Handle(AIS_Shape) anAISShapeh1 = new AIS_Shape(h1);

Thank you.

Stephane Routelous's picture

for the first case, in the viewer, the display is done shape after shape. This means that each shape displays its onw HLR. it is the reason why you don't have the a "common" HLR for the 3 shapes.
if you want to do that in your application, you can simply create a compound of all your shapes, and only use one AIS_Shape for the display, instead of one AIS_Shape per shape.


anassisi's picture

Thank you Stephane,
I should have thought about it. ;)