did you check if the 3 pnts are colinear ?
S.
Archived discussion
For some reason, I'm having problems creating faces with particular sets of points.
Here's an example:
gp_Pnt point1 = gp_Pnt(0.95915532112121582, 0.39877992868423462, 0.020832687616348267);
gp_Pnt point2 = gp_Pnt(0.84645986557006836, 0.39877998828887939, 0.020832687616348267);
gp_Pnt point3 = gp_Pnt(0.82415747642517090, 0.39877998828887939, 0.020832687616348267);
TopoDS_Wire wire = BRepBuilderAPI_MakePolygon(point1, point2, point3, Standard_True);
TopoDS_Face face = BRepBuilderAPI_MakeFace(wire, Standard_True);
BRepCheck_Analyzer analyzer(face);
~~~~~~~~~~~
When the last line of code executes, it causes the following error:
008DB86C : Standard_NullObject
It seems that the face wasn't created correctly.
I can't even call face.Closed() without getting an exception.
Does anyone have any ideas why this is failing?
I have 2 other examples of points to add that cause this. If that would help, I'll post these as well.
Discussion
Posts are displayed in their archived order.
did you check if the 3 pnts are colinear ?
S.
Z is constant, delta Y is about 6.0e-8. I assume that Precision::Confusion or a similar constant says, that the three points are collinear and thus the triangle is degenerated.
Either reduce the corresponding tolerance or filter your mesh data before creating TopoDS_Faces's. (Filter each triangle with a side shorter than Precision::Confusion, while collapsing triangles you ought to update neighbouhood informations.)
Author,
One more hint. Before casting to a TopoDS_Shape you might want to check if the shape has really been created (see BRepBuilderAPI_Command::IsDone()).
BRepBuilderAPI_MakeFace aMF (wire, Standard_True);
TopoDS_Face face;
if (aMF.IsDone()) {
face = aMF; //or aFace = aMF.Shape() for better readability if you want
BRepCheck_Analyzer analyzer(face);
}
Commenter-3
---
opencascade.blogspot.com - blog on Open CASCADE
Roman,
That's a good tip, and has helped me in debugging.
I resolved this issue by lowering the overall precision by calling:
BRepBuilderAPI::Precision(precision);
Thanks.
Actually, I'm still having to call IsDone() and discard faces.
Setting the precision did help with other issues- e.g. performing boolean operations.