algorithmic modeling for Rhino
Hi All,
I am just starting to use python in grasshopper and looking for some help. So I have a list of points in grasshopper and eventually I want to sort out the points based on their coordinates and cull the duplicates. I am trying to write a python definition for this. I am not able to understand how can I read each point and store it in an array. I tried list.append function with a for loop but eventually I either get only the last point or the entire list. Any help would be appreciated.
Apoorv
Tags:
Hi Apoorv,
Take a look at this topic, it offers an answer to your question.
There are two solutions present there: one which only culls the duplicates and another which both culls the duplicates and outputs their indices.
djordje,
thanks for your reply. That was helpful. however, i am looking for a slightly different solution. I think I explained wrong last time. So, I have a list of points (693 total). I want to read them in the python component, and store then in an array so that I can take each point one by one (using a loop), and compare the x,y,z coordinates with the point next next in line. based on the comparison, the value of a counter will be incremented or remain same. Eventually I want to cull the duplicate entries.
Its more of a python learning exercise for me. Thanks for the help!
You can set a flow control (if ...) and then use continue statement ( it stops further progress of looping and moves the control back to the top of the loop - which will in case of your for (or while if you add i += 1 before "continue") increment the i)
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