Extracting wireframes and shape contour representations

Hello everyone,

There is one thing that bothered me for a few days, and I couldn't find a work-around.
I am currently working on a software that uses OCC and a custom OpenGL-based viewer.
In this viewer, there is a "wireframe display" mode that shows only edges from a given TopoDs_Shape.

Imported STEP models do look nice but I'm struggling with simple shapes like spheres and cylinders,
generated with the BRepPrimAPI.

I want to display the TopoDS_Shapes in the same way as the AIS display methods (See AIS_display.png attached)
Unfortunately, I don't know where to search and my attempts failed one after another (see Edges_from_cut.png)
I also tried to visualize the whole mesh, but it gets messy really quickly (See Mesh_display.png)

Do you have an idea of where I should look ? Am I missing something ?
Or is there a method to build something like the contours of a shape ?

Meanwhile, I'll continue searching.
Best Regards.

Attachments: 
Alexander Luger's picture

Hello!

Did you have a look at the class Prs3d_Drawer? Especially at the functions SetUnFreeBoundaryDraw() and SetFreeBoundaryDraw(). It looks like you are not drawing all boundaries of the shape.

Regards,
Alex

Rémi Loze's picture

Hello Alexander,

Nice to see you again.
Actually I can draw the boundaries with OCC but since I can't use the OCC drawers (yet),
I have to find a way to manually determine the contours/boundaries/edges of my geometric shapes.

That is, I have to do something similar as meshing my shapes in a fancy way, but I can't figure a way to do it.
Since the OCC 3D package do have a nice wire mode display, I hoped I could create edges in the same way as the AIS display methods. But today, I can't use them.
Any ideas ?

Best Regards

Alexander Luger's picture

To get the topological boundary of a shape, I would use BRepTools::OuterWire or ShapeAnalysis_FreeBounds::GetClosedWires()/GetOpenWires() to get all the free boundaries of a shape.

Hope that helped.

Regards

Rémi Loze's picture

Thanks for your quick reply, Alexander.
I tried both methods, but still don't find anything like the AIS wireframe display. I still get a result like the one on Edges_from_cut.png (attached file).

The number of features in OCC is kinda scaring.
I'll look forward to find a solution.

Best Regards.

Attachments: 
Shing Liu's picture

Hi, Rémi Loze,
I think the package StdPrs have all the presentation mode implementation code, such as wireframe mode, shaded mode, even in HLR mode. From there you can get all the representation data for the shape.

Rémi Loze's picture

Hi eryar,

I took a look in the StdPrs package and I found the StdPrs_WFDeflectionSurface::Add() method.
From what I saw, I am not sure I will be able to implement or reimplement it in a decent amount of time ( Tempus fugit ...).

I understood that, correct me if I am wrong, the AIS display methods in wire mode do a triangulation and build polylines from it, around the surface. I think I will spend some more time on a meshing system.
Or find a more appropriate visualization system.
Anyway, thanks for your replies.

Best Regards.