Is there a rhinocommon method as _BooleanSplit command?

Is there a rhinocommon method as _BooleanSplit command?

Hi @Petras_Vestartas, i guess no. But you might get there by making 2 boolean operations. Eg. if the object to split is a sphere and the cutter is a box, the first part is created by subtracting the box from the sphere and the second part is created using boolean intersection. Does that help ?

_
c.

Hi Clement,

The reason to ask is because the splitter is an open-surface.
I tried it other way by creating a series of solids, but this method with open ones would be helpful.

Hi Petras,

It should work the same eg. if in above example the box is an open plane, you get the same 2 results regardless of the plane normal direction.

_
c.

The situation I have is this:

I have one solid, and one open brep as splitter.
Using rhino command I can perform BooleanSplit,
but in rhinocommon there are only these options:

Brep.CreateBooleanDifference
Brep.CreateBooleanIntersection
Brep.CreateBooleanUnion

I assume the only way in rhinocommon is to perform a solid-sold but not solid-openBrep boolean operations.

Hi Petras, there is this in RhinoCommon: https://developer.rhino3d.com/wip/api/RhinoCommon/html/Overload_Rhino_Geometry_Brep_Split.htm

If I did not misunderstood this should work. You may try this Python example:
https://developer.rhino3d.com/api/RhinoScriptSyntax/#collapse-SplitBrep

This method create two open breps but not closed as rhino command

Ah sorry, I’ve missed that part. So you may also split the cutter, find the correct pieces and join it. Maybe there is an easier way with booleans…

Hi Petras, i get the same as _BooleanSplit using 2 booleans as described above (in Rhino before doing the same in code).

  1. Subtract the open cutter from the closed cylinder using BooleanDifference
  2. Create a BooleanIntersection, first set is the cylinder, second the cutter

I get two objects (both parts of the cylinder) both are closed. Next try it again with the same input as before but flip the normals of the cutter. The results are the same, 2 closed parts of the cylinder, the only difference i get is the order. Booleans should work with open objects too. Please try this script with your example (closed cylinder, open cutter).

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs

def DoSomething():
    
    id_a = rs.GetObject("Cylinder", 16, True, False)
    if not id_a: return
    
    id_b = rs.GetObject("Cutter", 16, False, False)
    if not id_b: return
    
    result_a = rs.BooleanDifference(id_a, id_b, delete_input=False)
    result_b = rs.BooleanIntersection(id_a, id_b, delete_input=False)
    
    if result_a: rs.SelectObject(result_a)
    if result_b: rs.SelectObject(result_b)
    
DoSomething()

You might try the same script with an open cylinder and compare the results with _BooleanSplit. I get the same results.

_
c.

I am totally confused but it works:

   Brep[] diff = Brep.CreateBooleanDifference(brep, splitter, 0.001);
    Brep[] inter = Brep.CreateBooleanIntersection(brep,splitter,0.001);
1 Like

Is it possible to multi-thread this operation?

I need to repeat the same procedure several hundread times and it takes 50 sec to process.

This should be possible, but I have a report of thread safety issues with CreateBooleanDifference that I still need to investigate.

Do you think it could be possible to do any time soon? :slight_smile:

I wouldn’t say that this will be fixed “soon”. I still need to reproduce the bug to begin with which may not be all that easy and then finding/fixing the actual problem is another project in itself. It is also not my top priority at the moment as we are trying to get Mac V6 released.