Grasshopper

algorithmic modeling for Rhino

Converting GH_Structure(of IGH_goo) to GH_Structure(of GH_Integer)

Hallo,

 

I am trying to find the easiest way converting from GH_structure(of IGH_Goo) to GH_Structure(of GH_Integer). I tried this, which works fine but is there an easier way?

 

Private Function convertDTToInt(ByVal DT As GH_Structure(Of IGH_Goo)) _
                                             As GH_Structure(Of GH_Integer)

     Dim dtI As New GH_Structure(Of GH_Integer)
     Dim int As Integer

     For Each P As GH_Path In DT.Paths
          dtI.EnsurePath(P)
          For Each item As IGH_Goo In DT.DataList(P)
               If GH_Convert.ToInt32(item, int, GH_Conversion.Both) Then
                    dtI.DataList(P).Add(New GH_Integer(int))
               End If
          Next
     Next

     Return dtI
End Function

Views: 318

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2026   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service