How to modify previous cutting operations

Hi all,

I need some advices to get what I need.
I want to know which is the best strategy I should follow.
I am developing a CAD system, but for better understanding I will change the example.

Imagine a wall, a window and a door (all of them TopoDS_Shape)

m_wall = BRepAlgoAPI_Cut(m_wall, m_window);
m_wall = BRepAlgoAPI_Cut(m_wall, m_door);

My doubts raise when user changes window or door properties:
-Should I change operation bodies and update something? Of course, It doesn't work if I only replace window or door with a new object.
-Should I repeat all the operations so I need to store original wall? (What if I have a lot of cutting operations?) The easiest but the slowest.
-Should I change door or window geometry exploring their points? The desired one but I cannot figure out how to start with it.

Other possibilities and other suggestions are welcome.

Paul Jimenez's picture

Actually, I need to achieve something like that. My current idea, which I haven't developed in code yet, is to add the outer wires of the extra elements (window, door, ...) as holes to the face/wall. After that, put the elements in another place (a TopoDS_Compound) and display it along with the original shape. The elements will fit into the holes, so you won't get a strange visualization. If you need to take an element out, just remove its wire from the face/wall and also take it out of the compound. Of course, that suggests that both the wall and the elements are co-planar. Maybe it fits your needs too.

arkoala's picture

I need to do it over shapes (bodies), not for faces (and not always co-planar), so I cannot use outer wires.

My approax will be as you told me: A compound covering all the shapes (different hole shapes), and if any hole changes or removes from the compound I will reapply boolean operation from the original shape. In case of adding, I will add it to the compound and apply individually for better performance.

When I get something, I will notify you my impressions.

At the end, the easiest but the lowest, but miracles don't exist.


Sharjith Naramparambath's picture

I think using OCAF will be the solution. It easily allows to modify, undo redo operations you do. But OCAF is a little bit difficult to get started with.

arkoala's picture

I wish I knew to use OCAF. I looks incredible for me, only for undo/redo funcitonality.

I guess our aim about modify cutting operations is handled in similar way than our manual method.

Ok, my impressions:

It works well, very easy to manage in the way I told I did, but...

Performance with boolean operations decreases exponently. After 50 cylinder-shape holes, to create the cut from the original shape spends 5 seconds even if those 50 shapes belong to a compund (I haven't tried to do it individually because I would expect worst performance).

You know the problem, we are waiting for a solution :)

OCC Team:
All the people know that if you manage collided shapes to create a cut operation you will get a good result (bad performance) if you do it individually. But if you create compound containing those collided shapes you will get unexpected results.
Why don't you deal this behavior as an incidence or a case study? From the occ user point of view, nothing is bad developed. Are there an official answer for that?