algorithmic modeling for Rhino
Hello,
I have a python script that will output a list of points (x-, y- and z-coordinates) (see image). Now I want to delete the points that lie between certain x- and y-values. For instance if a point lies between a x-value of 2750-3000 AND a y-value 1500-1750 the point has to be deleted, in this example point nr. 13 has to be removed from the list.
Thanks in advance
Tags:
Have a look at this.
class MyPoint:
X = 0
Y = 0
def __init__(self, x , y):
self.X = x
self.Y = y
def __repr__(self):
return "({0}, {1})".format(self.X, self.Y)
Points= [MyPoint(0,1),MyPoint(2751,1600),MyPoint(3001,1600), MyPoint(3000,1500), MyPoint(2999,1749)]
XRange = (2750,3000)
YRange = (1500,1750)
filtered = [p for p in Points if XRange[0] < p.X < XRange[1] and YRange[0] < p.Y < YRange[1]]
print(filtered)
I managed to solved it by meself via another method. However this is an even more efficient method, thanks.
Just to show up a python-syntax which is great ;)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by