Shaded with Edges - for STL

hi, I'm working on a Shaded with Edges version for displaying STL files in my program, but with sharp edges. My goal is to achieve edge display similar to CAD Assistant. I'm using the Open3D library, but my results aren't satisfactory. CAD Assistant - do you know how this is done? Maybe it uses an open-source library? Thank you Piotr

Dmitrii Pasukhin's picture

CAD Assistant purely based on OCCT CAD kernel. You can have similar results with OCCT.

Best regards, Dmitrii.

Piotr Dusiński's picture

Thank you,
I'm working on a Shaded with Edges version for displaying STL files in my program, but with distinct edges.
Please tell me how to approach this task, what C++ objects from OpenCascade should I use to achieve a good result?
Maybe OCCT itself can do this well?
Pd

Angelo Bartolome's picture

Hey Piotr.

You can explore the Edges of a Solid/Shape and render them by yourself on your renderer of choice, that is one option.

However STL files are Mesh-like and not B-REP, so I'm not sure exactly you can extract "hard edges" from a mesh.

Piotr Dusiński's picture

Hey,
This isn't a simple task. In its simplest form, you can analyze triangles and angles to see if they're smaller than specified.

But there are exceptions, and these require significant work to eliminate unnecessary lines.

It would be best to rebuild the model's face structure and extract the edges.

CAD Assistant, based on Opencascade, does this excellently, but what libraries does it use?

Piotr

gkv311 n's picture

The tool Poly_MergeNodesTool merges/splits unstructured triangle nodes from STL file (which doesn't supports structured/indexed triangulation) by simple criteria of angle between triangles. It doesn't perform any advanced analysis of the model, but provides good results on many kinds of models.

RWStl_Reader relies on above-mentioned tool on reading STL files and can be configured via RWStl_Reader::SetMergeAngle property.

Visualization relies on StdPrs_ShadedShape::FillFaceBoundaries() tool to collect sharp edges in trianglation - by sorting out triangle edges without neighbors.