
Wed, 02/15/2023 - 23:41
Hello,
I'm trying to use the Shape Healing package to remove some tiny strip faces. I've included the code that I'm using below. The shape I get back after calling ShapeFix_FixSmallFace::FixStripFace() is NULL so I assumed it was deleted. However the number of faces in my solid doesn't change.
Can anyone see the error or problem with my logic?
Thank you,
Blair Downie
TopoDS_Shape FixSmallStripFaces(TopoDS_Shape theShape)
{
ShapeAnalysis_CheckSmallFace chkSmallFace;
ShapeFix_FixSmallFace aFixSmallFace;
double thePrec = 1.0e-03;
ShapeAnalysis_ShapeContents shContents;
shContents.Perform(theShape);
int after, before = shContents.NbFaces();
TopExp_Explorer fExp;
fExp.Init(theShape, TopAbs_FACE);
for ( ; fExp.More(); fExp.Next() ) {
TopoDS_Face cf = TopoDS::Face(fExp.Current());
TopoDS_Edge E1,E2;
if (chkSmallFace.CheckStripFace (cf,E1,E2,thePrec)) {
aFixSmallFace.Init(cf);
aFixSmallFace.SetPrecision(thePrec);
aFixSmallFace.FixStripFace();
TopoDS_Shape aResShape = aFixSmallFace.Shape();
if (aResShape.IsNull()) {
printf("Face was deleted!");
}
break;
}
}
shContents.Clear();
shContents.Perform(theShape);
after = shContents.NbFaces();
return theShape;
}
Tue, 02/28/2023 - 07:33
Try to use the following code snippet
aFixSmallFace.Init(cf);
aFixSmallFace.SetPrecision(thePrec);
aFixSmallFaec.Perform();
TopoDS_Shape resShape = aFixSmallFaec.FixShape();
After removing strip faces from your geometry, the "resShape" will give you the resultant shape. Ensure the tolerance value you give the API is larger enough to identify the defect shapes.
Check this code snippet and let me know the result as well.
Cheers!
Wed, 03/01/2023 - 00:25
Thanks for the input. It seems that calling Perform() before FixShape() was the key!!
I have a follow up question.
Rather than iterating over all the faces, I called the FixSmallFace operator on just the
input shape.
aFixSmallFace.Init(theShape);
aFixSmallFace.SetPrecision(thePrec);
aFixSmallFaec.Perform();
TopoDS_Shape resShape = aFixSmallFaec.FixShape();
When I checked the number of faces in the new shape 'resShape', it had 6 fewer faces.
I also modified my routine to return the new shape. However when I did the same check in the calling routine.
it had the original number of faces. Is there an additonal call that needs to be made in order to apply the changes and
update the shape before I return from the FixSmallStripFaces function?
Thank you.
Wed, 03/01/2023 - 05:16
Try to use a larger tolerance value.
Wed, 03/01/2023 - 23:09
The issue that I'm having is with the result.
TopoDS_Shape resShape = aFixSmallFace.FixShape();
The small faces do get removed from resShape. I then return the shape to my calling routine. However when I process the shape
in the calling routine the small faces are still there. I don't understand how a larger tolerance would help? Thank you.