Hello forum,
I already posted a question about adding edges to an STL geometry. I think I didn't explain clearly.
I would like to completely bypass the automatic - angle based - generation of edges in an stl geometry.

This because, in case of complex geometries, the stl edges generated using this criterion, differ from the
"topology" edges which are present in the - e.g. step file -, from which the .stl representation is generated
from.
In retrieving the stl mesh of a complex model using a "face by face" approach, it is possible to obtain
the exact sequence of points defining edges which exactly match the topology ones. So It would
be useful to define them (for example) using the already available Ng_STL_AddEdges(...) method.
However it seems that the Ng_STL_MakeEdges, Ng_STL_InitSTLGeometry, Ng_MakeEdges calls
sequence is not able to do that.

Consider the following steps:

  • Generate an stl mesh: See Fig. 1
  • Obtain the stl mesh points, for all the edges: see Fig. 2 & 3
  • Order the point (if needed) using the local curve parameter
  • Add the segments using the previous nglib calls sequence
  • Finally use netgen to mesh the .stl

The resulting mesh shown in Fig. 4. Not all the edges are well defined: some of them are not closed, and also
the number of points along the edge differs (it's smaller).
It seems that some of points provided with Ng_STL_MakeEdges() are not recognized,
or the automatic generation of edges through the angle criterion is changing something.

In nglib, the method:
Ng_STL_AddEdges(Ng_STL_Geometry * geom, double * P1, double * P2)

allows filling the array of:
Array<point<3>> readedges</point<3>

Then, in:
Ng_STL_InitSTLGeometry(Ng_STL_Geometry * geom)

the edges are added to the geometry:![]
[...]
STLGeometry geo = (STLGeometry)geom;
geo->AddEdges(readedges);
[...]

Finally, in NgSTLMakeEdges(NgSTLGeometry * geom, NgMesh * mesh, NgMeshingParameters mp)
internally calls:

STLMeshing(* stlgeometry, * me)

which in turns calls:

STLgeometry::BuildEdges() which contains the call FindEdgesFromAngles()

Probably FindEdgeFromAngles() should be replaced by a different call (or by a group of calls
dealing with "externalEdges"), but for the moment I cannot figure out which ones,
Any suggestion about that?
Thank you in advance
Giovanni