I want to split a group of breps with two planes and keep the geometries within only one of the 4 quadrants, as shown below:
However, I’m unable to get the results correctly.
I can get the result of the first step correctly, i.e get the geometries above the horizontal plane:
However, I’m unable to get the geometries to the left of the vertical plane for the breps obtained in the previous step (those geometries circled out are the ones I want to obtain as final result).
I’ve tried two different ways to do this, and neither worked. GH test file attached, too.
Can I ask your suggestions on “splitting a group of breps with two arbitrary planes”?
split_breps_with_planes.gh (54.1 KB)
You could do something like this: problem is that the second plane doesn’t actually split anything: split_breps_with_planes_ME.gh (58.1 KB)
Thanks. However, according to this method, if a surface is intersecting with the vertical plane, it might be deleted if its x is smaller than the x of the point where the vertical plane is located.
What I want is a “precise” cut, i.e. for a surface intersecting with the vertical plane, the part in from of the plane will be kept and the part behind will be ignored. This means, the surface must be split first literally.
I started over and split the BReps with a plane. The process should be to first divide the group of BReps into those which cross the plane and those which don’t. For those that dont, divide them into those above the plane and those below. Then for those that do cross the plane, do a surface split on them to split them into two. You can then assign these to the groups above and below the plane.
In this instance here though none of your BReps cross the vertical plane, they just have one face which sits on the plane, so the srf split method doesn’t work as there is nothing to split. If you do have some which cross the plane, then just repeat the first two groups with the output of List B from the second group
split_breps_with_planes MBH.gh (91.7 KB)
Added a short section in to give you the BRep splitting functionality. I don’t love it as it gives an error when individual BReps aren’t split by the curve, but it does work (I just don’t like having red components on screen!)
Extra section is this:
split_breps_with_planes MBH.gh (97.7 KB)
Hi @Matt_Harwood, thank you very much for the detailed solution.
Following your suggestion, I added another solution, but using a solid boolean approach, which can deal with arbitrary position and direction of the cutting planes and isolate the parts of the input geometries within one of the four quardronbs defined by the two planes.
It still use the “plane coordinate” component as a filter to identify parts below the cutting planes, althought I can’t say that I fully undertand what this component is doing.
Thanks, again, for your illuminating suggestions.
split_breps_with_planes MBH_ZJ.gh (156.0 KB)
No worries, glad to help.
The plane coordinates component is super useful - it took me a while to discover it too but so glad I did. What it does it take a 3D point and tells you it’s coordinates in the local plane system. So image I have a point at 20,0,50 (in standard cartesian coordinates based on the XY plane). I now create a plane with that point as the origin and with the global X-axis as the normal. If I find the plane coordinates of this point in the plane I just created, it will show me 0,0,0 (because it is at the origin of that plane). The point will still be at 20,0,50 in the global system, but in the local system it is at 0,0,0.
Now if I have a point at 10,0,50, and test that in the local system I just defined, it will give me plane coordinates of 0,0,-10, because it is -10 in the z direction (global X axis) of that plane. See below:
I use this component quite often to determine where points are relative to planes I’ve created similar to how I used it in your script above. It is usually a much faster operation that other methods (point in BRep etc).
Plane Coordinates MBH.gh (11.8 KB)