Page 1 of 1

Face normals from an .stl

Posted: Tue Sep 03, 2024 3:20 am
by Adbou Diouf
Hi, there.

I need to read face normals from an .stl. How can I read the normals of each facet?

Re: Face normals from an .stl

Posted: Wed Sep 04, 2024 4:49 am
by Kathy McKenna
This should work:

Code: Select all

myDgk.ModelPath = theStlPath;
IModle_DG model = myDgk.GetModel();
if (model.GetEntityCount() < 1) return;
IEntity_DG entity = model.GetEntityAt(0);
IMesh_DG mesh = entity.As<IMesh_DG>();

IList_DG simplexList = mesh.GetSimplexList();
uint posCurrentSimplex = simplexList.GetHeadPosition();
//..... Loop with:
simplexList.GetNext(ref posCurrentSimplex);
ISimplex_DG simplex = mesh.GetSimplex(posCurrentSimplex);
VectDg n = simplex.GetFaceNormal();
Cheers