Wrong result when fusing two solids

Hi everybody,
I'm adding boolean operations to a simple software used to model solids and surfaces.
In some cases, when I perform a fuse operation

result = BRepAlgoAPI_Fuse(shape1,shape2);

I obtain the result of a Common operation and no error is given.
In the attatched files you can see the two solids and the fuse result.

Has anyone already seen something like that?
How could this be solved?

Thanks very much!

Silvia

Evgeny Lodyzhehsky's picture

Hi, Silvia

The things can be much worse.
It will be wise to attach *.brep files instead of pictures
because it is difficult to cure teeth with only their photo.

Best wishes

Silvia's picture

Hi Lodyzhensky,
thanks for your answer, I exported the brep files you can find them attatched.
The result of the boolean operation seems to have an open wire, indeed printing information about the shape I get the following

//Shape Analysis// NB COMPOUNDS: 1
//Shape Analysis// NB SOLIDS: 1
//Shape Analysis// NB SHELLS: 1
//Shape Analysis// OPEN SHELLS: 1
//Shape Analysis// CLOSED SHELLS: 0
//Shape Analysis// NB FACES: 6
//Shape Analysis// NB WIRES: 6
//Shape Analysis// NB EDGES: 12
//Shape Analysis// NB VERTEXES: 8

so the shape is a solid but has an open shell.

Any advice would be highly appreciated!

Cheers,

Silvia

Evgeny Lodyzhehsky's picture

Hi, Silvia

1.
The result of fuse (XF): it is correct.

A shell is a set of faces.A shell is not closed when it has free boundary
edges that have no connection with the other faces.
XF does not contain the shells above.

The information //Shape Analysis// OPEN SHELLS: 1 is wrong.
To check the shapes use conventional way (i.e. the class BRepCheck_Analyzer).

2.
The shapes you've sent are: firstShape.brep (X1), secondShape.brep (X2).
The solid X1 has value of the volume: -1.1665e+8
The solid X2 has value of the volume: -8.38912e+7
The negative value of the volume means that the solid covers
the whole 3D-space without the parts bounded by the faces of the solid.

Do you really want to work with the solids of such exotic kind ?
I very much doubt. Although,... I never know.

There are two ways improve the things:
A. Find the reason of the negative volumes, and fix the problem (the best way);
B. Invert X1, X2 to provide regular solids with positive volumes.
How to do this: have a look the function:
static Standard_Integer invert (Draw_Interpretor& ,
Standard_Integer n, const char** a) in the file DBRep.cxx .

Regards

Silvia's picture

Dear Lodyzhensky,
thank you VERY much for your answer and your help!

You are right about the very "strange" (at the very least) nature of solids I'm working with, unfortunately I'm only developing a .dll to compute boolean operations, solids are provided by an external code which I cannot modify and it does very weird things.

Anyway I did not realized that I was having negative volumes, thank you very much for this information and all the others you provided in your answer.

I'll follow your advice and I'll let you know how it goes.

Thanks a million, cheers

Silvia

Silvia's picture

Dear Evgeny Nicolaich,

the bad orientation of my solids was due to a sewing that I need to do because these solids are given to me as a set of separated faces, the sewing operation is successful but sometimes I end up with normals pointing inward.

As you suggested, I checked the volume and I reversed the solid when it is negative, and now the boolean operation result is as expected.

Thank you again, without your help I wouldn't be able to figure out what was going on.

Cheers,

Silvia