C# help for shell (access List)

Hi, SHELL, remove holes is the problem of accses list and are red, according to the previous method, but the redhead was red. Why?
@Mahdiyar

shell-remove holes.gh (36.1 KB)

https://developer.rhino3d.com/wip/api/RhinoCommon/html/M_Rhino_Geometry_Brep_RemoveHoles.htm

https://developer.rhino3d.com/wip/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateShell.htm

//Shell
private void RunScript(Brep brep, List<int>  facesToRemove, double distance, ref object A)
{
  A = Brep.CreateShell(brep, facesToRemove, distance, RhinoDocument.ModelAbsoluteTolerance);
}

Shell.gh (7.3 KB)

//RemoveHoles
private void RunScript(Brep brep, List<int> indices, ref object A)
{
  var loops = brep.Loops;
  var inner = new List<int>();
  for(var i = 0; i < loops.Count; i++)
    if (loops[i].LoopType == BrepLoopType.Inner)
      inner.Add(i);
  var componentIndices = new List<ComponentIndex>();
  foreach(var index in indices)
    componentIndices.Add(loops[inner[index]].ComponentIndex());
  A = brep.RemoveHoles(componentIndices, RhinoDocument.ModelAbsoluteTolerance);
}

RemoveHoles.gh (15.6 KB)

1 Like