Meaning of IsDeleted, Modified and Generated

Hi!

I want to find a mapping from the faces of two shapes S1, S2 to the faces of the shape S that has been created by a boolean operation of the shapes S1 and S2.

Several threads in this forum state that one can use the three methods IsDeleted, Modified and Generated of the class BrepBuilderAPI_MakeShape to solve this problem.

So I first tried to tried to realize the meaning of these methods by the following example:

First I construct two cylinders and fuse them:

BRepPrimAPI_MakeCylinder makeCylinder1(1.0, 5.0);
BRepPrimAPI_MakeCylinder makeCylinder2(0.5, 5.0);

TopoDS_Shape cyl1 = makeCylinder1.Shape();
TopoDS_Shape cyl2 = makeCylinder2.Shape();

gp_Vec vec(0.0, 0.0, 5.0);
gp_Trsf translation = gce_MakeTranslation(vec);

BRepBuilderAPI_Transform transform(cyl2, translation);
cyl2 = transform.Shape();

BRepAlgoAPI_Fuse op(cyl1, cyl2);

The unfused cylinders cyl1 and cyl2 look like this:

|--| - Face1
| |
| | - Face0 Cyl2
| |
|--| - Face2
|----| - Face1
| |
| | - Face0 Cyl1
| |
|----| - Face2

And the fused cylinder (op.Shape) looks like this:

|--|
| |
| |
| |
| |
|- -|
| |
| |
| |
|----|

So I would say that Face2 of Cyl2 has been deleted and Face1 of Cyl1 has been modified. Additionally some face should have been generated.

When I use the methods IsDeleted, Modified and Generated I get the follwing results:

IsDeleted: Only Face2 of Cyl2 has been deleted. This is like I expected.

Modified: Face1 of Cyl1 and Face0 of Cyl2 has been modfified.
Face1 of Cyl1 is correct but why has Face0 of Cyl2 been modified?

Generated: No faces have been generated.

These results look strange to me cause of the result of Modified and the missing generated faces. How shall I build my mapping function with just the above information?

So can someone explain the exact meaning of the three methods and how to use their results to build the mapping function?

Thanks in advance
- Rene

Rene's picture

The formatting of the "drawings" have been corrupted.
I hope this is one is better. The dots have to be removed:

The unfused cylinders cyl1 and cyl2 look like this:

.|--|...... Face1
.|..|
.|..|...... Face0 Cyl2
.|..|
.|--|...... Face2
|----|..... Face1
.|..|
.|..|...... Face0 Cyl1
.|..|
|----|..... Face2

And the fused cylinder (op.Shape) looks like this:

.|--|
.|..|
.|..|
.|..|
.|..|
|-..-|
.|..|
.|..|
.|..|
|----|

- Rene

sas's picture

Hi Rene!
How to get the data hierarchy of the model to get printed. Suppose if i have a box created by TopoDS_Shape B1 = BRepPrimAPI_MakeBox (200.,150.,100.); this function.

After that i like to know details about the faces and vatex of each faces. Do u know how to get these details?

Is it posible to print these details out and their relationship? Pls help me with this one.

Rgs
Sas

Rene's picture

Hi Sas!

Have a look at the class TopExp_Explorer. This will give u access to subshapes of the box like faces, edges, vertices.

Then there are other classes which will give u more information of these subshapes. Which information do u need in detail?

You can get the relationship by asking the subshapes for its own subshapes, e.g. u can ask the faces of the box for its edges (by TopExp_Explorer) and then compare these edges. So u will know when two faces share an edge.

I think u have to print the gained information on your own. I do not know any classes that print such information.

Hope this helps.

- Rene

Rene's picture

I have found this function to print the topological structure to a stream: BRepTools::Dump(const TopoDS_Shape& Sh, Standard_OStream& S);

- Rene

sas's picture

i tried, but can't able to make that perfect. Can you pls make simple program and extract faces and vertex and print them out.
if possible pls send the code.
thanks
sas

sas's picture

Hi Rene!
How to get the data hierarchy of the model to get printed. Suppose if i have a box created by TopoDS_Shape B1 = BRepPrimAPI_MakeBox (200.,150.,100.); this function.

After that i like to know details about the faces and vatex of each faces. Do u know how to get these details?

Is it posible to print these details out and their relationship? Pls help me with this one.

Rgs
Sas

Jane Hu's picture

Your Face0 of Cyl2 is now using a different Edge on Face1 of Cyl1. This is what I guessed from the model you provided. So all above you mentioned same to be reasonable.

Jane