Grasshopper

algorithmic modeling for Rhino

Hello, I would appreciate any help on this:

I have a <List of On3dPoint lists>.  (I also tried this as a List of Object, where Object is a 2 dimensional array and I get the same result).

I generate 2 lists (nList, fList) as reference, and produce this fnList <List of List of On3dPoints> - when I output the resulting Object, it gives me the Object Type, not the value and therefore unusable.  Please see image for the output.  In the code below, I think the only lines one would need to evaluate is the bold lines.

Am I getting confused with referencing or something?

 

Thanks in advance,

 

kat

 

Private Sub RunScript(ByVal wPt As List(Of On3dPoint), ByRef NodeList As Object, ByRef FacetList As Object, ByRef FacetNodeList As Object)

    Dim xlApp As Object
    Dim i As Integer

    ' override language
    Dim oldCI As System.Globalization.CultureInfo = system.Threading.Thread.CurrentThread.CurrentCulture
    System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")

    'Grab a running instance of Excel
    xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")

    Dim wb As Object = xlApp.ActiveWorkbook
    'Dim sheet As Object = wb.ActiveSheet
    Dim xlshNode As Object = wb.Sheets("Nodes")
    Dim xlshFacet As Object = wb.Sheets("Facet Table")

    Dim nList As New List(Of On3dPoint)
    Dim fList As New List(Of On3dPoint)
    Dim fnList As New List(Of List(Of On3dPoint))

    Dim rowBegin As Integer = 3
    Dim col_name As Integer = 1
    Dim col_1 As Integer = 2
    Dim col_2 As Integer = 3
    Dim col_3 As Integer = 4

    If Not IsNothing(xlshNode) Then
      nList = readIntoPoints(xlshNode, rowBegin, col_1, col_2, col_3)
      NodeList = nList
    End If

    If Not IsNothing(xlshFacet) Then
      fList = readIntoPoints(xlshFacet, rowBegin, col_1, col_2, col_3)
      FacetList = fList
    End If

    If Not IsNothing(nList) And Not IsNothing(fList) Then
      For i = 0 To fList.Count - 1
        Dim pt1Name As Double = fList(i).x
        Dim pt2Name As Double = fList(i).y
        Dim pt3Name As Double = fList(i).z
        Print("pt1Name : " + CStr(pt1Name))
        Print("pt2Name : " + CStr(pt2Name))
        Print("pt3Name : " + CStr(pt3Name))

        Dim ptList As New List(Of On3dPoint)
        Dim ptOne As On3dPoint = nList(CInt(pt1Name) - 1)
        Dim ptTwo As On3dPoint = nList(CInt(pt2Name) - 1)
        Dim ptThree As On3dPoint = nList(CInt(pt3Name) - 1)


        ptList.Add(ptOne)
        ptList.Add(ptTwo)
        ptList.Add(ptThree)

        Print(" ptList : " + ptList.ToString)
        fnList.Add(ptList)

      Next
      FacetNodeList = fnList
    End If
  End Sub

Views: 471

Attachments:

Replies to This Discussion

never mind. no list of lists in grasshopper. good to know.

 

Dim points As New Grasshopper.DataTree(Of On3dPoint)
For i As Int32 = 1 To x
    For j As Int32 = 1 To y
        Dim nPoint As New On3dPoint(i, j, 0)
        'points.Add(nPoint, New Grasshopper.Kernel.Data.GH_Path(i))
     Next
Next
A = points

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service