Grasshopper

algorithmic modeling for Rhino

I have run into another small problem and I was hoping I could get some feedback on how to solve for a solid intersection in VB.  I have two data trees (let's call them WinterEndLoftList and WinterStartLoftList) where each path contains a number of Closed Breps.  Ideally, I'd like to solve for the solid intersection between the first brep on the first branch of one tree with the first brep on the first branch of the second tree... and so on and so forth.

When I put in the code below, Grasshopper throws an error that says "Unable to cast object of type 'Rhino.Geometry.Brep' to type 'System.Collection.Generic.IEnumerable1.[Rhino.Geometry.Brep]'".  Are there any thoughts on why this would be happening?

Here's the code:
        Dim shape As New List(Of Brep)
        Dim shape2 As New List(Of Brep)
        Dim WinterInt As Brep() = Nothing
        For p = 0 To WinterEndLoftList.BranchCount - 1
            Dim obj As Brep
            Dim obj2 As Brep
            For Each obj In WinterEndLoftList.Branch(p)
                shape.Add(obj)
            Next
            For Each obj2 In WinterStartLoftList.Branch(p)
                shape2.Add(obj2)
            Next
        Next
        For m = 0 To shape.Count - 1
            WinterInt = Brep.CreateBooleanIntersection(shape(m), shape2(m), GH_Component.DocumentTolerance)
        Next


        DA.SetDataList(2, shape)
        DA.SetDataList(3, shape2)
        DA.SetDataList(4, WinterInt)

Views: 291

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2025   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service