Running MeshBooleanSplit from python

python
rhino5

#1

Hi, I am trying to perform the MeshBooleanSplit operation from a python script. When i try and run the program an error is kicked out:

Message: unable to convert 80c83d4d-c642-4e57-8cf7-e67e76f1d659 into Mesh geometry

I think this is because the input objects are Polysurfaces and not meshes. So my questions are:

  1. Is there a way to use the MeshBooleanSplit function with a polysurface like if you call it in the command window?
  2. If q1 is not possible is there a way to convert a polysurface to a mesh?

Any help would be really appreciated!!

My script is below:

import rhinoscriptsyntax as rs

def testObject():
    v1 = (-0.5,-0.5,0)
    v2 = (0.5,-0.5,0)
    v3 = (0.5,0.5,0)
    v4 = (-0.5,0.5,0)
    v5 = (-0.5,-0.5,1)
    v6 = (0.5,-0.5,1)
    v7 = (0.5,0.5,1)
    v8 = (-0.5,0.5,1)
    b1 = rs.AddBox([v1,v2,v3,v4,v5,v6,v7,v8])
    return b1

def splitPlane():
    v1 = (-1,-1,0)
    v2 = (1,-1,0)
    v3 = (1,1,0)
    v4 = (-1,1,0)
    p1 = rs.AddSrfPt([v1,v2,v3,v4])
    rs.MoveObject(p1,[0,0,0.5])
    return p1

def splitObs(arg1,arg2):
    rs.MeshBooleanSplit(arg1,arg2)

p1 = splitPlane()
b1 = testObject()
splitObs(b1,p1)

(NARUTO) #2

Hi Tom
You should call the SplitBrep function,Instead of using the MeshBooleanSplit function.

import rhinoscriptsyntax as rs

def testObject():
    v1 = (-0.5,-0.5,0)
    v2 = (0.5,-0.5,0)
    v3 = (0.5,0.5,0)
    v4 = (-0.5,0.5,0)
    v5 = (-0.5,-0.5,1)
    v6 = (0.5,-0.5,1)
    v7 = (0.5,0.5,1)
    v8 = (-0.5,0.5,1)
    b1 = rs.AddBox([v1,v2,v3,v4,v5,v6,v7,v8])
    return b1

def splitPlane():
    v1 = (-1,-1,0)
    v2 = (1,-1,0)
    v3 = (1,1,0)
    v4 = (-1,1,0)
    p1 = rs.AddSrfPt([v1,v2,v3,v4])
    rs.MoveObject(p1,[0,0,0.5])
    return p1

def splitObs(arg1,arg2):
    breps = rs.SplitBrep(arg1,arg2,True)
    if breps:
        for i in breps:
            rs.CapPlanarHoles(i)

p1 = splitPlane()
b1 = testObject()
splitObs([b1],[p1])

——NARUTO

  1. List item

#3

Naruto that works great thanks so much for your help!!

Cheers,
Tom