Fusing shells of two solids with coincidental face

Hi!

I am trying to fuse the shells sorrounding two solids with a coincidental face. The common face is not recognised as the same, so I end up with 12 faces instead of the 11 I would expect. Is this a bug or somehow the expected result?

When fusing the shells of two solids with half a coincidental face the common new face (half of the original one) is recognised as the same and then I get 13 faces as expected.

Has someone come across this before? Is this a bug or the expected result?

Thanks for you help!

Laura

Evgeny Lodyzhehsky's picture

Dear Laura.

It is hard to understand what is the problem here, because all that I have is just your verbal message describing of the problem. In order to clarify the state of affirs it is necessary to have your the shapes you want to fuse.
As far as is known this resource unfortunately does not allow to attach some pictures or files to the message. At least it is strange, because all things here deal with the geometry and it is worth seeing the objects for analysis.
I think it will be not so hard for you to upload the shapes somewhere and send the link.

Laura's picture

Hi!

Thanks for your reply! The shapes are simply 2 cubes. For each cube, given its min and max coords I create 6 TopoDS_Faces which I sew to create a TopoDS_Shell. Then I use this shell to create a solid but anyway I fuse the shells (not the solids).

Cube1: (0,0,0)->(1,1,1)
Cube2: (1,0,0)->(2,1,1)

I include my print of the shapes.....

Type Name:SHELL
Number of Vertices: 8
Number of Edges: 12
Number of Wires: 6
Number of Faces: 6
Number of Shells: 1
Number of Solids: 0
Number of CompSolids: 0
Number of Compounds: 0

Shell orientation = FORWARD

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = REVERSED (1.000000,1.000000,0.000000) --> (1.000000,0.000000,0.000000)
Edge orientation = REVERSED (1.000000,0.000000,0.000000) --> (1.000000,0.000000,1.000000)
Edge orientation = REVERSED (1.000000,0.000000,1.000000) --> (1.000000,1.000000,1.000000)
Edge orientation = REVERSED (1.000000,1.000000,1.000000) --> (1.000000,1.000000,0.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = REVERSED (0.000000,0.000000,1.000000) --> (1.000000,0.000000,1.000000)
Edge orientation = FORWARD (1.000000,0.000000,1.000000) --> (1.000000,0.000000,0.000000)
Edge orientation = REVERSED (1.000000,0.000000,0.000000) --> (0.000000,0.000000,0.000000)
Edge orientation = REVERSED (0.000000,0.000000,0.000000) --> (0.000000,0.000000,1.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = REVERSED (0.000000,1.000000,0.000000) --> (0.000000,1.000000,1.000000)
Edge orientation = REVERSED (0.000000,1.000000,1.000000) --> (0.000000,0.000000,1.000000)
Edge orientation = FORWARD (0.000000,0.000000,1.000000) --> (0.000000,0.000000,0.000000)
Edge orientation = REVERSED (0.000000,0.000000,0.000000) --> (0.000000,1.000000,0.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = FORWARD (0.000000,1.000000,1.000000) --> (0.000000,1.000000,0.000000)
Edge orientation = REVERSED (0.000000,1.000000,0.000000) --> (1.000000,1.000000,0.000000)
Edge orientation = FORWARD (1.000000,1.000000,0.000000) --> (1.000000,1.000000,1.000000)
Edge orientation = REVERSED (1.000000,1.000000,1.000000) --> (0.000000,1.000000,1.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = FORWARD (1.000000,0.000000,1.000000) --> (0.000000,0.000000,1.000000)
Edge orientation = FORWARD (0.000000,0.000000,1.000000) --> (0.000000,1.000000,1.000000)
Edge orientation = FORWARD (0.000000,1.000000,1.000000) --> (1.000000,1.000000,1.000000)
Edge orientation = FORWARD (1.000000,1.000000,1.000000) --> (1.000000,0.000000,1.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = FORWARD (1.000000,0.000000,0.000000) --> (1.000000,1.000000,0.000000)
Edge orientation = FORWARD (1.000000,1.000000,0.000000) --> (0.000000,1.000000,0.000000)
Edge orientation = FORWARD (0.000000,1.000000,0.000000) --> (0.000000,0.000000,0.000000)
Edge orientation = FORWARD (0.000000,0.000000,0.000000) --> (1.000000,0.000000,0.000000)
-------------First shape end ------------

-------------Second shape------------
Type Name:SHELL
Number of Vertices: 8
Number of Edges: 12
Number of Wires: 6
Number of Faces: 6
Number of Shells: 1
Number of Solids: 0
Number of CompSolids: 0
Number of Compounds: 0

Shell orientation = FORWARD

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = REVERSED (2.000000,1.000000,0.000000) --> (2.000000,0.000000,0.000000)
Edge orientation = REVERSED (2.000000,0.000000,0.000000) --> (2.000000,0.000000,1.000000)
Edge orientation = REVERSED (2.000000,0.000000,1.000000) --> (2.000000,1.000000,1.000000)
Edge orientation = REVERSED (2.000000,1.000000,1.000000) --> (2.000000,1.000000,0.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = REVERSED (1.000000,0.000000,1.000000) --> (2.000000,0.000000,1.000000)
Edge orientation = FORWARD (2.000000,0.000000,1.000000) --> (2.000000,0.000000,0.000000)
Edge orientation = REVERSED (2.000000,0.000000,0.000000) --> (1.000000,0.000000,0.000000)
Edge orientation = REVERSED (1.000000,0.000000,0.000000) --> (1.000000,0.000000,1.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = REVERSED (1.000000,1.000000,0.000000) --> (1.000000,1.000000,1.000000)
Edge orientation = REVERSED (1.000000,1.000000,1.000000) --> (1.000000,0.000000,1.000000)
Edge orientation = FORWARD (1.000000,0.000000,1.000000) --> (1.000000,0.000000,0.000000)
Edge orientation = REVERSED (1.000000,0.000000,0.000000) --> (1.000000,1.000000,0.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = FORWARD (1.000000,1.000000,1.000000) --> (1.000000,1.000000,0.000000)
Edge orientation = REVERSED (1.000000,1.000000,0.000000) --> (2.000000,1.000000,0.000000)
Edge orientation = FORWARD (2.000000,1.000000,0.000000) --> (2.000000,1.000000,1.000000)
Edge orientation = REVERSED (2.000000,1.000000,1.000000) --> (1.000000,1.000000,1.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = FORWARD (2.000000,0.000000,1.000000) --> (1.000000,0.000000,1.000000)
Edge orientation = FORWARD (1.000000,0.000000,1.000000) --> (1.000000,1.000000,1.000000)
Edge orientation = FORWARD (1.000000,1.000000,1.000000) --> (2.000000,1.000000,1.000000)
Edge orientation = FORWARD (2.000000,1.000000,1.000000) --> (2.000000,0.000000,1.000000)

Face orientation = FORWARD
Wire orientation = REVERSED
Edge orientation = FORWARD (2.000000,0.000000,0.000000) --> (2.000000,1.000000,0.000000)
Edge orientation = FORWARD (2.000000,1.000000,0.000000) --> (1.000000,1.000000,0.000000)
Edge orientation = FORWARD (1.000000,1.000000,0.000000) --> (1.000000,0.000000,0.000000)
Edge orientation = FORWARD (1.000000,0.000000,0.000000) --> (2.000000,0.000000,0.000000)
-------------Second shape end ------------

Evgeny Lodyzhehsky's picture

Dear Laura.

In order to build a box you can use the class BRepPrimAPI_MakeBox instead of
sewing handmade faces. For me this way is more reliable and less error prone.
In fact I've reproduce your case using Draw application.

The corresponding commands are:

Draw[78]> box b1 1 1 1
Draw[79]> box b2 1 0 0 1 1 1
Draw[80]> explode b1 sh
b1_1
Draw[81]> explode b2 sh
b2_1
Draw[82]> bop b1_1 b2_1
Draw[83]> bopfuse r
Draw[84]> nbs r
Number of shapes in r
VERTEX : 12
EDGE : 20
WIRE : 11
FACE : 11
SHELL : 1
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
SHAPE : 56

As you can see
the result of fuse between two shells b1_1 b2_1 contains 11 faces.

Laura's picture

Hi!

Thanks for your reply!

In general I do not use BRepPrimAPI_MakeBox because I could have any solid shape, not only cubes. My nice little cubes were just a test case.

But the most interesting thing is what I got reproducing your test commands in DRAW (see below). I got 12 faces and not 11 as you did.

Draw[2]> box b1 1 1 1
Draw[3]> box b2 1 0 0 1 1 1
Draw[4]> explode b1 sh
b1_1
Draw[5]> explode b2 sh
b2_1
Draw[6]> bop b1_1 b2_1
Draw[7]> bopfuse r
Draw[8]> nbs r
Number of shapes in r
VERTEX : 12
EDGE : 20
WIRE : 12
FACE : 12
SHELL : 1
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
SHAPE : 58

What version of Open Cascade are you using? It looks very much as a bug then, which was fixed in the version you are using or introduced in the one I am using (6.2.0). I believe this is the lastest public version available. Is there a later version or a patch I could apply?

Laura

P G's picture

Hi
I also tested in THarness.

But please check the validity of the resultant shape (FAULTY)
though the count of faces is 12.

=================================
Draw[15]> checkshape r
On Shape faulty_1 :
BRepCheck_InvalidMultiConnexity

Faulty shapes in variables faulty_1 to faulty_1

Draw[16]> nbs r
Number of shapes in r
VERTEX : 12
EDGE : 20
WIRE : 12
FACE : 12
SHELL : 1
SOLID : 0
COMPSOLID : 0
COMPOUND : 1
SHAPE : 58

Laura's picture

Hi,

Thanks for your reply!

I am very interested to hear about versions, why we are getting one result while the previous reply got a different one.

In my particular case I do not particularly mind about the result shape being faulty as I am more interesting in the fact that the common face is recognised as the same. I post-process the resulting topods_faces and from this I will identify 3 shells, one for each of the uncommon parts in the fuse result and a third shell for the common face. I use this common shell with different orientations to make up the shells of the original solids.

Laura

Evgeny Lodyzhehsky's picture

Dear PG.

Yes.
BRepCheck_Analyzer have found defects of type BRepCheck_InvalidMultiConnexity.
In fact the result "r" is compound containing a shell.
The algorithm implemented in BRepCheck_Analyzer contains the set of specific requirements
for shells only.
These requrements are based on assumptions that a shell can be used to build a solid. IMHO:These assumptions are not right to put it mildly, because in fact the shell is just a set of faces and nothing more.
Among them there is the one that requires of a shell to not have shared faces, (because a solid can not contain shared faces).
So, we have BRepCheck_InvalidMultiConnexity in this case, althogh the shell is Ok.

Evgeny Lodyzhehsky's picture

Dear Laura.

I'm using 6.2.0 too. But only as a base.
I've modified some code for my own purposes.
Sorry, in pure 6.2.0 I've obtained the same result as you did.
You are right, it is the bug.