Array object for python script?

i wanted to create an array using python script

so how can i give multiple values to the i = x-axis points for example like i = ( 2 , 4 , 6 , 8 )

so a = rs.AddPoint(0,i,0) … there by creating 4 different points?

Hi Andrewsthekkathsachin

I’m not an expert in PY but maybe you could use the “range” command in a “for” loop

but then it will be continuous points like …1,2,3,4,5,6,7,8

but i want points with intervals like 2,4,6,8,10,12


for i in range(0, 4):
    rs.AddPoint(0, i * 2, 0)

the first time through, i = 0
the next time through, i = 1

it will do that until you reach 4 (the end number for range)…

for the point’s Y coordinate, it’s i * 2
which will make the even number sequence.



[edit]-

just realized this is a Grasshopper question…
so maybe something like this:

1 Like

That would be:

range(0,13,2)

range() has three parameters:

range(start,stop,step)
2 Likes