I will get all faces from a solid, but i get only triangles. No Polygons.
here the sample.
// pSolid is the used Solid
AcBr::ErrorStatus esBr;
AcBrMesh2dControl meshCtrl;
//----------------------------------------------
// i use the following settings
// AcBr::kAllTriangles ...... i get triangles
// AcBr::kAllPolygons ...... i get triangles
//---------------------------------------------
meshCtrl.setElementShape(AcBr::kAllPolygons);
AcBrBrep brep;
esBr = brep.set(*pSolid);
AcBrBrep brepOwner;
esBr = brep.getBrep(brepOwner);
// make the mesh filter from the topology entity and the mesh controls
AcBrMesh2dFilter meshFilter;
const auto *pMeshEnt = (AcBrEntity *)&brep;
meshFilter.insert(make_pair(pMeshEnt, (const AcBrMesh2dControl)meshCtrl));
AcBrMesh2d brepMesh;
esBr = brepMesh.generate(meshFilter);
AcBrEntity* meshOwner = NULL;
esBr = brepMesh.getEntityAssociated(meshOwner);
AcBrMesh2dElement2dTraverser meshElemTrav;
esBr = meshElemTrav.setMesh(brepMesh);
for (; !meshElemTrav.done(); meshElemTrav.next())
{
AcGeVector3d vector;
AcBrElement2dNodeTraverser elemNodeTrav;
elemNodeTrav.setElement(meshElemTrav);
elemNodeTrav.getSurfaceNormal(vector);
int countpoint=0;
while (!elemNodeTrav.done() && (elemNodeTrav.next() == AcBr::eOk))
{
AcBrNode node;
esBr = elemNodeTrav.getNode(node);
AcGePoint3d nodePoint;
esBr = node.getPoint(nodePoint);
countpoint++;
}
// here countpoint is alwas 3 ?????
}
Solved! Go to Solution.
Solved by tbrammer. Go to Solution.
I can reproduce your findings with the <ARX>\utils\brep\samples\brepsamp project.
Using kAllPolygons produced triangles in nearly all cases I tried. The only exception was a sphere. It produced a mix of triangles and quadrangles. Even a box and a polygon region produced triangles. I never saw a polygon with more than 4 edges.
This is what is written in the header brglb.h:
enum Element2dShape {
kDefault = 0, // use system defaults (i.e., by surface type)
kAllPolygons = 1, // attempt to only produce ngons, where n>4
kAllQuadrilaterals = 2, // attempt to only produce 4gons (complete quadrangles)
kAllTriangles = 3 // attempt to only produce 3gons (approx. equilateral)
};
Well, "attempt" apparently doesn't mean that the attempt will ever succeed.
So if you need i.e. the largest possible 2D polygons you have to stitch the triangles and quads together to polygons yourself.
Can't find what you're looking for? Ask the community or share your knowledge.