Grasshopper

algorithmic modeling for Rhino

Hi, 

I am attempting to 'cull' through rows of points with the modulo operator. Essentially, I wish to partition the grid like in native GH. As can be seen in the screenshot, when I calculate y % 2, I am choosing the left column. Also, can this be made parametric?

When I adjust the step multiplier, the row selection becomes variable. 

#input 10 for x and y inputs


import rhinoscriptsyntax as rs

a = []
b = []

def grid():
for i in range(X):
for j in range(Y):
x = i*step
y = j*step

if x % X and y % (Y-8):
pt1 = rs.AddPoint(x,y,0)
a.append(pt1)
else:
p2 = rs.AddPoint(x,y,0)
b.append(p2)
grid()

Views: 545

Attachments:

Replies to This Discussion

Thank you Marcus.

Quite an interesting that approach definitely works. I appreciate the reference as well. I have been looking for something like this.

Best regards,
Erik

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