Trim surface with surface ánd keep surfaces in original branches

Hi,

Its looks very easy, but unfortunately it isn’t :sweat_smile:

challenge;

There are 2 lists present;
List A: containing surfaces
List B: containing surfaces

  1. I would like to use the surfaces in List B to make ‘openings/holes’ in the surfaces of list A. (so cutting holes in the surfaces list A).

  2. Besides it is important that after this is done, the ‘what’s left of the surfaces’ List A is in the same branch as the origin of that surface in List A.

2020-06-17 Trim surface with surface ánd remain original branches.gh (134.6 KB)

I know there is the Region difference tool. It is possible to make the ‘openings’ with this tool correctly. However: The Region difference tool mixes the original surface, and sorts them based on the plane of the surfaces in List B. This I don’t want.

Any suggestions for a different Tool which simply makes openings without mixing the original surfaces? (or a workaround). I spend many hours but couldn’t find it.

Thank you in advance! :slight_smile:

Surfaces List A in Red, with corresponding branch names
Surfaces List B in green


2020-06-17 Trim surface with surface ánd remain original branches_re.gh (53.4 KB)

1 Like

Another, albeit less graceful way.

RE_2020-06-17 Trim surface with surface ánd remain original branches.gh (185.0 KB)

1 Like

@HS_Kim and @Rickson, Thank you very much. I am impressed! :slight_smile:

In the end I used both of you solutions, to come to ‘final’ solution which solves all my challenges;

  1. Solution of Kim: The solution did exactly what I asked. However, there is also a possibility that in 1 branch consists of surfaces which are not all in 1 plane. (my fault, I didn’t explain it). Because of this I I had to get rid of the RUnion command. (I replaces this part, with Collision command posted by Ricksen)!

  2. Ricksen’s solution, was almost perfect, except when there where multiple ‘openings’ touching same surface, as you can see in the printscreen, a part of the opening is not there.

By Combining your scripts together, I am very please with the result, shown below.
Thank you again very much! :+1: :+1:

(upload://18K6CijbNLeAxdt8Rbo9XLz0AL6.gh) (63.1 KB)

image

Hi,

Just came to the conclusion that my post is also not perfect :sweat_smile:.
Difficult to explain.
In fact I think your script is even closer to the solution!

Question in you script you use the collision command. unfortunately this tool select only the ‘first’ index of the coliding surface.
But if there are more surfaces colliding whithin the same surface it is going wrong.
Do you know a work around or a way o select not only the 1st colliding surface but also the others?

thanks again :slight_smile:

2020-06-17 Trim surface with surface ánd remain original branches_RE_solution_multiple collisions.gh (135.5 KB)

image

Personally i would use the HS_Kim definition, perhaps bounding box your objects and increase the tolerance (distance) to fix the out of plane variable.