For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

finding a closed volume

Maili's picture
Forums: 

Hi everyone, I want to select the smallest closed volume part of a shape (volume that my selected face belongs to) Is there an easy way to do this or should I find the volume by myself? I look for any API that helps me, makes it possible or easier.. Thanks in advance

Bearloga's picture

What is your shape? Is it a compsolid or a simple compound of faces. Are the faces in your shape sewed or not? Give more info, please.

Maili's picture

We can think of it as a shell of a closed shape (solid) that has faces in it so that it has more than one volume and I want to select the shell of the volume of the part that my selected face belongs to. Is it clear now or do you need any other info? Thank you

Lodyzhensky's picture

Dear Maili.

Lets us assume that "volume" means Solid. Than
1. Compute a map Face/Solids (MFS)using TopExp::MapShapesAndAncestors(...)
2. Find in MFS all solids that belong to your face F:
...
const TopTools_ListOfShape& LS = aMFS.FindFromKey(F);

Bearloga's picture

Dear Maili,
What you described is well represented by TopoDS_CompSolid. If so, then Evgeny's suggestion is exactly what you need.
If no, then you should obtain compsolid from your data first, and then follow that suggestion.

Maili's picture

Okey thanks but I have one more newbie question. Now that I have found my volume, how can I select and highlight that part of shape? I have an AIS_Shape for whole shape. Thanks

I have found similar but unanswered thread in forums:
http://www.opencascade.org/org/forum/thread_14120/

Maili's picture

I think I have problems when I convert my shell to solid since size of TopTools_ListOfShape& LS returns always 1. How can I convert a shell that has some faces inside to a comp_solid? It seems there is no MakeComp_Solid class of package BRepBuilderAPI

Lodyzhensky's picture

Dear Maili.

>I want to select the smallest closed volume part of a shape...

Don't hurry, please.
Could you explain exactly what is the "shape" in your case. I'm interested in what kind of a shape (vertex, edge, ...) you have.

Maili's picture

I have a shell like this :

_______________
/______/_______/|
| | ||
| | ||
|______|_______|/

Maili's picture

Sorry its not like I draw, its like two boxes merged with one face in common separating them..
It is a one big shell which has two volumes and I want to select faces of the right part (right volume) when I click one of faces from right part

Bearloga's picture

I hope your faces are well sewed, including the inner ones. It means all neighboring faces share common edges, and edges of inner faces are shared by boundary faces as well.

In this case you can manually (using the only tool BRep_Builder) build the compsolid as follows:

1. Build shells of all inside volumes, providing that common faces have different orientation in neighboring shells.
2. Build individual solid for each volume.
3. Build compsolid.

Of course, here the most hard is the 1st step, you must write your own algorithm for finding faces of each volume.

Maili's picture

Actually my question was whether Opencascade provides such an algorithm or not. Thanks for replies and now I should start to think about this most hard step :)

Lodyzhensky's picture

Dear Maili.

So,
1.you have a shell (or just a set of faces) aS;
2.you want to select some faces (subset of aS)that:
- contain given face F;
- can form a "volume";
Isn't it ?

If yes. I'am afraid that you'll need to write an algorithm, that can sepatate all possible "volumes" first.
Let us asume that "volume" is solid. Thus the algo will accept aS as input data and it will return list of solids (LSS).

Having LSS you can just follow the approach I've proposed above.

If no. Please clarify what is wrong here.

Maili's picture

Yes, forming a volume given a face, that I should write on my own. Thanks for time and patience

Cauchy Ding's picture

Hi Lodyzhensky,

Though it's a three years old topic, I am not sure whether it has been solved. I don't know how to write this algorithm or what's this algorithm. Can it be classified into a greed searching algorithm? If anyone can give me a hint or any paper reference, I will be appreciate.
Thanks in advance.

Ding

sergey zaritchny's picture

Hi Ding,

We would be pleased to help you in finding acceptable solution for your problem.
All our technical services are at your disposal - http://www.opencascade.org/support/.
You can make request for the dedicated customer support via next link - http://www.opencascade.org/about/contacts/.
Regards