I don’t know if anyone cares but I felt like sharing my first working python script
I’m an architecture student who was introduced to Grasshopper last semester (with Gramazio-Kohler Research at ETH Zurich) and loved it, so I want to specialize in parametric design/scripting and therefore have started to learn to code in python. I’ve done some tutorials and basic codes, but this is my first one as a part of something useful!
So the basic setup is a bunch of points, the surrounding points are on the global xy plane and the central points on a higher xy plane. At first I projected them down to global xy plane, created a delaunay network and isolated the triangles. Now to the python code:
“PtA” is a list with the eight original points
“PtB” is a list with the eight projected points
“pts” is a tree with all the points, the 22 main branches referencing the triangles and the 3 sub-branches their respective controlpoints.
Now with the python code, the goal is to take the projected central points and replace them with the original referenced points.
At first (the inactive part of the code), I took the projected points (PtB) and for each one I looked for duplicates in the “pts” tree and when one was found, added it to the path of the grafted projected points (PtB) list (so all the paths of matching points in “pts” for point 0 of “PtB” were on the path {0})
Afterwords, I realised that the more efficient way was to just swap the point directly.
Sorry if I wasted anyones time with this, I’m just really excited to have my first functioning script. And if anyone has any feedback, tips on where I can best learn how to use python in Grasshopper or has any tutorial/ course recommondations that would be very much appreciated!
P.S. I didn’t write this code all by myself, I tried to work with ChatGPT but it never seemed to work, but I took the parts I understood and combined with the Rhino.Python Guide from McNeel was able to get it to work
Net experiments.3dm (49.4 KB)
Net experiments.gh (22.9 KB)