Brep - Brep list intersection

As a beginner in GH, I tried to write a script which intersects a Brep (fata) with each Brep in a list (casete). The result should be put in a list of Breps (fatada).
Can anyone tell me what is wrong with this (my first) VB script in GH?
As it runs, it adds nothing to ‘result’, despite the list ‘caseta’ - the Breps intersections’ is not always void.

Private Sub RunScript(ByVal casete As List(Of Brep), ByVal fata As Brep, ByRef fatada As Object) 
    Dim result As New List(Of Brep)
    print(result.count)
    For i As Int32 = 0 To casete.Count - 1
      If (casete(i) Is Nothing) Then Continue For
      Dim caseta As Brep() = Nothing
      caseta = CreateBooleanIntersection(fata, casete(i), 0.01)
      If (caseta IsNot Nothing) Then
        result.AddRange(caseta)
        print(result.count)
        print("Caseta")
      End If
    Next
    fatada = result
    print(result.count)
  End Sub

Can’t see a mistake, although if the array of breps returned by the CreateBooleanInrersection contains nulls those will end up in your final result. That method shouldn’t be returning nulls though, it should at worst return an empty array.

You’ll have to post the full data as well so I can test the code on my machine.

Thank you very much, David! I attach here the GH that include the code above. It is intended to work in an Archicad-Grasshopper connection, in order to get a facade partition. But I think you will understand…
Thank you again,
Nic
luftfac.gh (33.5 KB)

Can you please just internalise the inputs to the script? I don’t have all those plugins installed needed for this file.

See point #3 in this post on how to simplify a file.

Hi David,
I internalised the inputs (nu more Archicad).
I think you can run the script now .
Thanks
Nic
luftfac.intern.gh (25.8 KB)