Rhino.Common-Command crashes program

Hello people,

I need some help

I try to achieve a valid closed Mesh without clashing Faces.

I wrote a little PY-Script to get the appropriate indices and culled them in Grasshopper and it works.
buuuut I also want a single Blackbox-Solution with repair for this Problem, so I tried to get the mesh with the culled Faces inside the ghpy-comp, but there is the problem.

Every time I try to make the “new mesh” with “CreateFromFilteredFaceList”, Rhino closes and shows an error. You can find this command in the last comment in the ghpy-comp.

Can you make me understand what exactly my mistake is?

Any help is appreciated.

Greetings

import Rhino as rh

b= x.Faces
c=b.GetClashingFacePairs(0)

i_p=[]
j_p=[]
IndList=[]

for i,pairs in enumerate(c):
    i_p.append(pairs.I)
    j_p.append(pairs.J)
    IndList.append(rh.IndexPair.I.GetValue(pairs))
    IndList.append(rh.IndexPair.J.GetValue(pairs))

IndList=list(dict.fromkeys(IndList))
l=[]

for i,k in enumerate(b):
    if i in IndList:
        l.append(False)
    else:
        l.append(True)

# Here comes the error
#a=rh.Geometry.Mesh.CreateFromFilteredFaceList(x,l)

Before:

After:

cull_clashing_mesh_faces_Discourse.gh (170.3 KB)

I came across this yesterday trying to implement the Mesh.CreateFromFilteredFaceList Method in a C# script component.

Here’s a simple test case:

Point3d[] cornerPoints =
{
    new Point3d(0,0,0),
    new Point3d(25,0,0),
    new Point3d(25,25,0),
    new Point3d(0,25,0),
    new Point3d(0,0,25),
    new Point3d(25,0,25),
    new Point3d(25,25,25),
    new Point3d(0,25,25)
};
A = cornerPoints;   // <<< out

var mesh1 = Mesh.CreateFromBox(cornerPoints, 1, 1, 1);
B = mesh1;  // <<< out

bool[] filteredFaceList = {false, true, true, true, true, true};
C = filteredFaceList;   // <<< out

if (enable)
{
    var mesh2 = Mesh.CreateFromFilteredFaceList(mesh1, filteredFaceList);
    D = mesh2;  // << out
}

221110_CreateFromFilteredFaceList_Crash.gh (8.6 KB)

-Kevin

2 Likes

Thank you for the detailed crash report. I can reproduce this, I created a work item to get this fixed by the developer: RH-71267 Crash in Rhino.Geometry.Mesh.CreateFromFilteredFaceList(…)