IsDeleted, Modified and Generated functions in BRepAlgoAPI_BooleanOperation class

Hi all,

I have some issues with IsDeleted, Modified and Generated functions in BRepAlgoAPI_BooleanOperation class.

Suppose, I created a two boxes using the topology.
i.e,(1). I created Vertices. Class used "BRepBuilderAPI_MakeVertex".
(2). I created Edges using the created Vertices. Class used "BRepBuilderAPI_MakeEdge".
(3). I created Faces using the Edges. Class used "BRepBuilderAPI_MakeFace".
(4). I sewed all the faces to create a Shell. Class used, "BRepBuilderAPI_Sewing".
(5). I created a Solid using the Shell. Class used "BRepBuilderAPI_MakeSolid".
(6). I also Fixed the Solid with "BRepBuilderAPI_MakeSolid"

Now, After performing the Boolean Operations between the two created solids, I want to check which face is deleted, modified or generated.

I used the function IsDeleted(Face1ofBox1); It is always returning 1. i.e., For each and every single face it is saying the Face is being deleted.

But when i take solid which i passed into the Boolean Operation, extract the faces using explorer and pass into IsDeleted function, then i get the correct answer.

Can somebody please tell me, why this is happening? I dont want to extract the faces again from the solid, because i already have the list of faces.

Thanks and Regards,
Sharad Verma

Forum supervisor's picture

Dear Sharad,
It happens because Boolean operations algorithm uses 'history'(history of modifications) approach to track modifications. I.e. it uses paradigm "old_shape =>(modification)=> new_shape".
For details see chapter "5. OCAF Shape Attributes" from the "Application Framework User’s Guide".
Regards

Sharad Verma's picture

Dear Forum Supervisor,

I read the complete chapter No. 5. But still clue less.

Do I need to register each face for its evolution?

A small code snippet will be really helpful.

Thanks,
Sharad Verma

Forum supervisor's picture

Dear Sharad,
You need to register shapes (in terms of Chapter N0.5) only if you are going to use parametric approach. If not, it is extra.
API which is mentioned by you (IsDeleted(),..) designed exactly for this approach.
BooleanOp algorithm supports history of modifications.
Result = BoolOp(A, B);
where Result is a 'newShape' and 'A' & 'B' are old shapes.
So, there is sense to speak about history of modifications only for these set of shapes (and corresponding set of sub-shapes) in context of Boolean operation algorithm (i.e. for the last modeling step).
If you want to learn it in more details the next documents are available for you:
1)"Application Framework White Paper"
2)"Application Framework User’s Guide"
3)"Application Framework Function User's Guide"
Training and e-learning courses (as well as "Advanced OCAF Sample") are also at your disposal - http://www.opencascade.org/support/training/.
You may contact us via the Contact Form http://www.opencascade.org/about/contacts/.
Regards

Sharad Verma's picture

One more query.

While creating label for faces, it needs parent label. so that the label contain a Tag.

TDF_Label labelFace1 = labelSolid1.FindChild(1, Standard_True);

In my case as above, I don't have the "labelSolid1".. i.e., Solid is not created yet.

For Top Down approach, this works fine. How can i use it for Bottom Up approach?

Please provide me some code snippet.

Regards,
Sharad Verma

Sharad Verma's picture

I think after sewing the faces and fixing the solid, new faces are generated that is why? when i put old faces, IsDeleted is not returning the actual result.

Is there any other way out in OCC so that we can find the deletion, modification and generation of old faces?

I also named each face using OCAF, but no solution found.

Please help.

Sharad Verma's picture

Finally I found out where the problem was.

After Sewing faces, OCC changes the TShape of the Faces, that is why i was unable to find the modified and deleted faces after performing Boolean Operation.

Track your modified shape after performing SEW.. Like

//Sewed Shape
const TopoDS_Shape sewedShape = sewFaces.SewedShape();

for(int j=0; j(m_Surfaces[j]);

const TopoDS_Face face = pSurface->GetOCCTFace();
Standard_Boolean isModified = sewFaces.IsModified(face);
if(isModified)
{
TopoDS_Shape modifiedFace = sewFaces.Modified(face);

// Do Something
}
}