Hey Folks, I’ve been finding solutions on these forums for my Grasshopper questions for quite a while now, but I seem to be stuck now, so I will post my first thread ever (aka, a long time)
I want to generate a list of 160 numbers to label sections I am generating in Grasshopper.
The list has to be as follows:
B.01.01
B.01.02
B.01.03
B.01.04
B.01.05
B.02.01
B.02.02
…
B.02.05
B.03.01
untill we get at B.32.05, which will be the 160th and last entry of the list.
So it will always start with B., followed by first coordinate, (1-32), followed by a second coordinate (1-5)
This will be the input for a tag-component
I feel like there should be a simple way to make lists like this, but have not been able to find it. Could you help me out?
This is quite easy to do with a Python component. Here is one way:
a = list() # default output name, set up as a list
for num1 in range(1,33): # 1 included, 33 excluded
num1 = str(num1).zfill(2) # convert to string, add leading zero
for num2 in range(1,6):
num2 = str(num2).zfill(2)
label = 'B.'+num1+'.'+num2
a.append(label) # add label to the end of the list