Tian Gao Thu, 06/28/2018 - 06:48 Forums: Modeling Data and AlgorithmsI want to remove a face from a shell used brepBuilder and reShape, but it didn't work. Thanks, Tian Andrey BETENEV Thu, 06/28/2018 - 06:56 Hello, ReShape is the right tool to use, just remember that it gives you a new shape which is a copy of the original one with requested substitutions made. Note that questions on OCCT usage (rather than development) are to be discussed on the user's forum, https://www.opencascade.com/forums Andrey Log in to post comments Tian Gao Thu, 06/28/2018 - 11:15 Hi, Abv Thank you for your reply. But I don't know how can I replace to new shape. Thanks, Tian TopExp_Explorer shellExplorer(partShape, TopAbs_SHELL); for (; shellExplorer.More(); shellExplorer.Next()) { TopoDS_Shape shellItem = shellExplorer.Current(); for (TopExp_Explorer faceExplorer(shellExplorer.Current(), TopAbs_FACE); faceExplorer.More(); faceExplorer.Next()) { TopoDS_Shape faceItem = faceExplorer.Current(); BRepTools_ReShape re; re.Remove(faceItem); re.Replace(shellItem, re.Apply(shellItem)); re.Apply(shellItem); } } OR TopoDS_Shape faceItem = faceExplorer.Current(); BRepTools_ReShape re; re.Remove(faceItem); TopoDS_Shape newFace = re.Apply(shellItem); BRepTools_Substitution substitution; TopTools_ListOfShape lists; lists.Append(newFace); substitution.Substitute(shellItem, lists); substitution.Build(shellItem); substitution.Build(partShape); Log in to post comments
Thu, 06/28/2018 - 06:56
Hello,
ReShape is the right tool to use, just remember that it gives you a new shape which is a copy of the original one with requested substitutions made.
Note that questions on OCCT usage (rather than development) are to be discussed on the user's forum, https://www.opencascade.com/forums
Andrey
Thu, 06/28/2018 - 11:15
Hi, Abv
Thank you for your reply.
But I don't know how can I replace to new shape.
Thanks,
Tian
TopExp_Explorer shellExplorer(partShape, TopAbs_SHELL);
for (; shellExplorer.More(); shellExplorer.Next())
{
TopoDS_Shape shellItem = shellExplorer.Current();
for (TopExp_Explorer faceExplorer(shellExplorer.Current(), TopAbs_FACE); faceExplorer.More(); faceExplorer.Next())
{
TopoDS_Shape faceItem = faceExplorer.Current();
BRepTools_ReShape re;
re.Remove(faceItem);
re.Replace(shellItem, re.Apply(shellItem));
re.Apply(shellItem);
}
}
OR
TopoDS_Shape faceItem = faceExplorer.Current();
BRepTools_ReShape re;
re.Remove(faceItem);
TopoDS_Shape newFace = re.Apply(shellItem);
BRepTools_Substitution substitution;
TopTools_ListOfShape lists;
lists.Append(newFace);
substitution.Substitute(shellItem, lists);
substitution.Build(shellItem);
substitution.Build(partShape);