This example shows how to create a mesh from a face. This example demonstrates the use of the ISkpFace::CreateMesh function, as well as working with the ISkpPolygonMesh object. This is typically done to triangulate a SketchUp face with one or more holes (inner loops) in it.
void CreateMesh(ISkpFace* pFace)
{
HResult hr;
CComPtr<ISkpPolygonMesh> pMesh;
hr = pFace->CreateMesh(PolygonMeshPoints | PolygonMeshUVQFront | PolygonMeshUVQBack | PolygonMeshNormals, &pMesh);
long numPoints = 0;
hr = pMesh->get_Count(&numPoints);
long index;
for( index = 1; index <= numPoints; index++ )
{
CComPtr<ISkpPoint3d> pSkpPoint;
hr = pMesh->get_Point(i, &pSkpPoint);
double x,y,z;
pSkpPoint->Get(&x,&y,&z);
printf("Point x, y, z: %g, %g, %g", x, y, z);
}
}