Forum archiveIssue archiveOther usage issues

Archived discussion

BRepFeat_SplitShape: How to obtain the reverse of Left() function?

Other usage issuesTue, 08/30/2005 - 18:191 reply

Browse this forum
QuestionAuthor

Hi all!

If I split a face with a wire using BRepFeat_SplitShape, I can obtain the whole new Shape by BRepFeat_SplitShape.Shape() and all faces outside of the wire with the Left() function. How can I get hold of the faces that are not returned by the Left() function? Does anyone have an example for using the Modified() function?

Regards,

Author

Discussion

1 archived reply

Posts are displayed in their archived order.

01Author

For those who are interested I now tried this workaround, which is probably not the fastest and nicest one:

BRepFeat_SplitShape asplit(current_shape);

[...]

//result contains all faces including the ones we later want to extrude
TopoDS_Shape result = asplit.Shape();
//asplit.Left() delivers the faces which are not new, including the modified that lie outside the cutting wire...
//We need them later and for comparison
TopTools_ListIteratorOfListOfShape a_faces_iterator (asplit.Left());
//Build a shell out of left faces
TopoDS_Shell shellOfLeftFaces;
aBuilder.MakeShell(shellOfLeftFaces);
for(; a_faces_iterator.More(); a_faces_iterator.Next()){
aBuilder.Add(shellOfLeftFaces,a_faces_iterator.Value());
}

//Now find the faces that are in result and not in shellOfLeftFaces (i.e. the new faces)
TopoDS_Shell shellOfNewFaces;
aBuilder.MakeShell(shellOfNewFaces);
for(TopExp_Explorer aFaceExplorer(result , TopAbs_FACE) ; aFaceExplorer.More() ; aFaceExplorer.Next()){
TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current());
if (!IsChild (shellOfLeftFaces, aFace)){
aBuilder.Add(shellOfNewFaces,aFace);
}
}

Standard_Boolean IsChild (const TopoDS_Shape& theParent, const TopoDS_Shape& theChild)
{
for (TopExp_Explorer anExp (theParent, theChild.ShapeType()); anExp.More(); anExp.Next()) {
if (anExp.Current() == theChild)
return Standard_True;
}
return Standard_False;
}

Is there an easier solution?