I need some help with the Shape Healing functions of OpenCascade, please.
I am loading in shapes from STEP files. Most of them are OK, but some of them need a little fixing - getting rid of tiny faces, ensuring that wires are closed, that sort of thing.
I need to do this at a Shape level (rather on each face in isolation ), as I need to get the face/edge adjacency information when I'm done.
I have looked at the notes here:
And tried several approaches, with partial success, but i'm not getting quite the results I want.
I have one particular STEP file, that has the two problems I want to fix:
1) There is a tiny triangular face that I want to merge with a large face that it is co-planar with.
See the attached screenshot
2) Several of that faces have wires that don't quite join up,
eg the first point of the first edge and the last point of the last edge are very close, but not quite the same.
What is the best way to fix these problems?
To fix 1), I have done the following:
The trianlge has a max dimension of approx 0.4
TopoDS_Shape inputShape;// This is loaded in from the step file
TopoDS_Shape aResShape = aFixSmallFaces.FixShape();
This works in that it merges the small face with the larger, but this new face has 2 wires;
one edge with the new perimeter (good!) and another that edge has no Geom_Curve associated with it (bad!)
I was expecting just the first wire.
Is it even valid to have an edge without an associated curve?
Is there any way to remove this edge from the shape?
To fix 2) I have done the following:
fix_tool.ModeDropSmallEdges() = Standard_True;
TopoDS_Shape new_shape = fix_tool.Shape();
This usually works, but sometimes does not close the wire, even when the gap is less than SetPrecision().
Is there a standard approach to fixing shapes loaded files?
Are there any good examples? (I can't find any!)
Should I be using ShapeFix_Shape, ShapeFix_Face ShapeFix_Wire?
Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape();
Handle(ShapeFix_Face) sff = sfs->FixFaceTool();
Handle(ShapeFix_Wire) sfw = sfs->FixWireTool();
sfs->FixSolidMode() = 1;
//parameters for ShapeFix_Face
sff->FixWireMode() = 1;
//parameters for ShapeFix_Wire
sfw->ModifyTopologyMode() = Standard_True;
TopoDS_Shape resShape = sfs->Shape();
If so, which of the many parameters should I be using?
What is the relationship (if any) between the classes ShapeFix_FixSmallFace and ShapeFix_Shape ?
Is ShapeFix_FixSmallFace contained anywhere in ShapeFix_Shape?
Sorry, that's a lot of questions - help with any of them appreciated!