
Wed, 03/11/2009 - 18:29
Forums:
Is there any way to set the planar tolerance for BRepBuilderAPI_MakeFace()?
I would like to be able to alter the tolerance for what is considered on and off the plane?
BRepBuilderAPI::Precision(Standard_Real xx) does not seem to do the trick.
Stephen
Wed, 03/11/2009 - 18:34
Hi Stephen,
maybe you could try ShapeFix_ShapeTolerance.
Pawel
Wed, 03/11/2009 - 18:42
Thanks Pawel,
I will try this. Its my (limited) understanding that ShapeFix_ShapeTolerance alters shape? Is this true?
For various reasons I am not allwoed to alter the data i simply want to treat it as a plane with a given tolerance.
Stephen
Wed, 03/11/2009 - 18:52
Hi Stephen,
I guess changing the tolerance of a face might alter the whole shape.
Refer to Roman's blog here: http://opencascade.blogspot.com/2009/02/continued.html
It might help.
Pawel
Wed, 03/11/2009 - 19:03
Thanks again,
That would be true only if you snapped vertices onto the face. Here i am refering to how cascade decides whether a shape is planar or not.
Provided all the vertices are within a tolerance distance of a plane i would not expect an error to be thrown. It may be true that as you add points the best fit plane is different.
Oracle 3D Validators manage to provide arbitrary tolerance for planes, I was looking for something similar.
Stephen
Wed, 03/11/2009 - 19:50
double myTolerance = 0.00001; // vary this
TopoDS_Vertex v1 = newVertex(0,0,0);
TopoDS_Vertex v2 = newVertex(0,1,0);
TopoDS_Vertex v3 = newVertex(1,1,0);
TopoDS_Vertex v4 = newVertex(1,1,0.0001);
TopoDS_Edge e1 = newEdge(v1,v2);
TopoDS_Edge e2 = newEdge(v2,v3);
TopoDS_Edge e3 = newEdge(v3,v4);
TopoDS_Edge e4 = newEdge(v4,v1);
BRepBuilderAPI_MakeWire mWire(e1,e2,e3,e4);
// create a tolerance object
ShapeFix_ShapeTolerance FTol;
// get the wide
TopoDS_Wire wire = mWire.Wire();
// set the tolerance for this shape.
FTol.SetTolerance(wire, myTolerance ,TopAbs_WIRE);
// make the face with this tolerance
BRepBuilderAPI_MakeFace mFace(wire);
if (mFace.IsDone())
{
cout << "Done" << endl;
}
else
{
cout << BRepBuilderAPI_NotPlanar << endl;
cout << mFace.Error() << endl;
cout << "Failed" << endl;
}
Wed, 03/11/2009 - 19:50
The example above (which i accidentally submitted) shows how to set the precision / tolerance for makeface or BRepBuilderAPI_MakeFace
Stephen
Thu, 04/12/2012 - 15:22
Setting Tolerance really worked for my case.
Thanks Stephen
Fri, 05/05/2023 - 09:40
when I use BRepBuilderAPI_MakeFace to define face from wire, the face sides have some little segments.
And, the shape of face is mostly different from wire.
i changed the tolerance of wire and no affects.
how to do???
Fri, 05/05/2023 - 11:26
Hello, can you share your wire as .brep file? Using "BRepTools::Write"
Can you make a look into: Wire to Face not working properly - Forum Open Cascade Technology
Best regards, Dmitrii.
Fri, 06/02/2023 - 12:33
I have fixed this mistake.
The wire order is wrong, which means edges of wire are not connected correctly.
using ShapeAnalysis_Wire::CheckOrder() to check order,
then ShapeFix_Wire::FixReorder() to repair it.