Feeding the correct parameters to RC Intersection.MeshMesh()

Can someone put up the correct format for the arguments?

First it wants at least 7 parameters… :grimacing:
Second, it wants an IEnumerable(meshes) - won’t accept a python list of meshes - but when I try with something like

ie_meshes = clr.StrongBox[List[Rhino.Geometry.Mesh]](meshes)

– where meshes is a list of mesh geometries, it doesn’t seem to like that either.

TIA…

Hi @Helvetosaur,

Does this help?

import System
import Rhino
import scriptcontext as sc

def test_meshmesh():
    filter = Rhino.DocObjects.ObjectType.Mesh
    rc, objrefs = Rhino.Input.RhinoGet.GetMultipleObjects("Select meshes", False, filter)
    if rc != Rhino.Commands.Result.Success:
        return
    if not objrefs:
        return
    
    in_meshes = System.Collections.Generic.List[Rhino.Geometry.Mesh]()
    for objref in objrefs:
        mesh = objref.Mesh()
        if mesh: 
            in_meshes.Add(mesh)
    
    tol = sc.doc.ModelAbsoluteTolerance
    ct = System.Threading.CancellationToken(False)
    rc, polylines, overlaps, out_mesh = Rhino.Geometry.Intersect.Intersection.MeshMesh(in_meshes, tol, False, False, None, ct, None)
    if rc:
        for p in polylines:
            sc.doc.Objects.AddPolyline(p)

if __name__ == "__main__":
    test_meshmesh()

– Dale

Hi @dale

Thanks for the sample, I’ll test.
Is there a reason in this instance to require the list of input meshes to be repackaged as a System.Collections.Generic.List? There doesn’t seem to be any kind of overload on this argument that would warrant this, why can’t it accept a normal list of meshes like most other methods?

2 Likes

Hi @Helvetosaur,

it seems to have changed in R8, i was able to pass a list created like below:

meshes = [objref.Mesh() for objref in objrefs]

do you have any clue how to use the CancelationToken in IronPython so i can press ESC to stop it ?

_
c.