Grasshopper

algorithmic modeling for Rhino

import random
L=[];x=0
while x<2:                             #‘2’can be changed.
    L1=[17,24,18]
    L2=[]
    for i in range(len(L1)):
        if L1[i]%2==1:
            L2.append(L1[i]/2-0.5)
            L2.append(L1[i]/2+0.5)
        else:
            L2.append(L1[i]/2)
            L2.append(L1[i]/2)   #it will get 'L2=[8,9,12,12,9,9]'
    x+=1                             #i  dont know how to replace the L2 to L1 ,realize the loop.
print(L2)

do loop like this:

when 'x<2',get the list [8,9,12,12,9,9],when 'x<3',get the list [4,4,4,5,6,6,6,6,3,3,3,3]

finally,L.append('all the list'),get the L=[[17,24,18],[8,9,12,12,9,9],[4,4,4,5,6,6,6,6,3,3,3,3]...and so on....]

-Carcassi

Views: 149

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2026   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service