Face normals from an .stl

Everything DG Kernel: Technical discussions and issues
Post Reply
Adbou Diouf
Posts: 1
Joined: Tue Sep 03, 2024 3:14 am

Face normals from an .stl

Post by Adbou Diouf »

Hi, there.

I need to read face normals from an .stl. How can I read the normals of each facet?
Kathy McKenna
Posts: 1
Joined: Wed Sep 04, 2024 4:34 am

Re: Face normals from an .stl

Post 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
Post Reply