Ah
I think I can answer my own question. There seem to be a couple of ways to go. The first is pretty direct:
Given an AcDbEntity *pEnt pointer:
AcDbSubDMesh *pMesh=(AcDbSubDMesh *)pEnt;
AcGePoint3dArray vertexArray;
AcArray<Adesk::Int32> faceArray;
Acad::ErrorStatus es = pMesh->getFaceArray(faceArray);
if(es==Acad::eOk){
es=pMesh->getVertices(vertexArray);
}
And then walk through the faceArray and Vertex array to extract the geometry. The above however doesn't do any smoothing, so that you end up with a large number of elements even for simple geometry. For example, for a simple default cube, this gives 54 (or 56 can't quite remember) faces. I don't know if someone has any suggestions on this.
In order to reduce the face count, all I can come up with is to go via a solid, and choosing the appropriate bConvertAsSmooth and optimize flags:
:
AcDbSubDMesh *pMesh=(AcDbSubDMesh *)pEnt;
AcDb3dSolid *pSolid=NULL;
pMesh->convertToSolid(false,true,pSolid);
if(pMesh!=NULL){
AcDbFaceterSettings faceter;
AcGePoint3dArray vertexArray;
AcArray<Adesk::Int32> faceArray;
AcGiFaceData* faceData=NULL;
Acad::ErrorStatus es=acdbGetObjectMesh(pSolid,&faceter,vertexArray,faceArray,faceData);
}
Going via a solid seems to be clumsy and so I'd be interested in any comments!