Grasshopper

algorithmic modeling for Rhino

Hi all, first of all: Happy newyear everyone!

So, I'm finally trying to learn VB, but I'm really struggling with the (jagged) array.
My current blackout makes me think: time for a break, and admit I need some help with this:)


Here's the array:

    Dim arr0() As Integer = {0}
    Dim arr1() As Integer = {1}
    Dim arr2() As Integer = {2}
    Dim arr3() As Integer = {1, 2}
    Dim arr4() As Integer = {3}
    Dim arr5() As Integer = {1, 3}
    Dim arr6() As Integer = {2, 3}
    Dim arr7() As Integer = {1, 2, 3}
    Dim arr8() As Integer = {4}
    Dim arr9() As Integer = {1, 4}
    Dim arr10() As Integer = {2, 4}
    Dim arr11() As Integer = {1, 2, 4}
    Dim arr12() As Integer = {3, 4}
    Dim arr13() As Integer = {1, 3, 4}
    Dim arr14() As Integer = {2, 3, 4}
    Dim arr15() As Integer = {1, 2, 3, 4}


    'Create the JAGGED array:
    Dim jarr()() As Integer = {arr0, arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8, arr9, arr10, arr11, arr12, arr13, arr14, arr15}
    
    
What I got as input is a single character hexadecimal value, that I allready converted to an integer.
My goal is to use that integer to get the corresponding (sub)array's elements to a list.

For instance: if my hex value was "C" (thus the integer is 12)
it should output the content of the array named arr12 as a list(Of Integer) :
3
4


I purposely created the array this way to be able to get the "subarrays", without having to go in the jagged array(jarr), but still no luck.

Since I'm just beginning with VB, I might be approuching this all wrong...


Can anybody please help me with this?

------------------------------------------

As an example: this functionality in Grasshopper (+see attchment):

With regards,

Pieter.

Views: 302

Attachments:

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service