Wed, 07/14/2021 - 12:39
Forums:
Hello Guys,
I am confused by some simple issue.
I need to get connecting faces for all edges after BRepAlgoAPI_Section operation.
HasAncestorFaceOn1 returns false for every edge.
And I see it is Obsolete.
What is the way nowadays to get correspond faces?
I use OCCT 7.5.
Thanks in advance.
With respects, Eugene.
Wed, 07/14/2021 - 14:55
Use the history of modifications (BRepTools_History), see API of BRepAlgoAPI_BuilderAlgo.hxx. The section edge must hit into 'generated' set of corresponding faces.
Wed, 07/14/2021 - 15:28
Hello Mikhail,
My code returns r1 as empty and r2 the edge itself. There is no any face objects.
Handle(BRepTools_History) hHistory = op.History();
TopTools_ListOfEdge listEdges;
CollectEdges(resShape, listEdges);
for (TopTools_ListIteratorOfListOfEdge iter = listEdges; iter.More(); iter.Next())
{
const auto& r1 = hHistory->Generated(iter.Value());
const auto& r2 = hHistory->Modified(iter.Value());
}
Wed, 07/14/2021 - 16:48
You incorrectly understood what to do. You should iterate on all faces of all input shapes and for each face ask history for generated shapes. And here you can build a mapping of edges to faces.
Wed, 07/14/2021 - 17:41
This code also provides empty result
TopTools_ListOfFace listFaces2;
CollectFaces(s2, listFaces2);
Handle(BRepTools_History) hHistory = op.History();
for (TopTools_ListIteratorOfListOfFace iter = listFaces2; iter.More(); iter.Next())
{
const auto& listGenerated = hHistory->Generated(iter.Value());
const auto& listModified = hHistory->Modified(iter.Value());
if (listGenerated.IsEmpty() && listModified.IsEmpty())
{
// always here
continue;
}
}
Wed, 07/14/2021 - 18:05
As I see I have non-empty listModified in case check history for edges of original shells.
Could it be so? For example, in case all section edges were constructed by only edges of source shells?
Wed, 07/14/2021 - 21:26
The following code works:
Its output:
If a section edge was produced as a part of model edge then you should evaluate the history of that edge.
Thu, 07/15/2021 - 09:44
Yes, this example works.
But in case touching boxes:
TopoDS_Shape aBox1 = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 10, 10, 10);
TopoDS_Shape aBox2 = BRepPrimAPI_MakeBox(gp_Pnt(2, 2, 10), 5, 5, 5);
There is no any faces which helped to generate any edge.
There is only edges in set of Modified().
I expected some faces also in case of touching boxes.
Thank you, Mikhail for your time! It was really useful for me.
With respects, Eugene.