Hi, I’m working on writing code that will make a rectangular grid of points and have them be manipulable and moveable relative to each other. What I’m envisioning is that there would be a number of “anchor points”(say 5 points along the perimeter of the grid) that when I move them, the rest of the grid points will move according to their distance from the anchor points. So, if I move an anchor point, the farther a grid point is from that anchor, the less it will move. I’ve started some lines of code to make the grid and how to move a point, but I have no idea how to tackle the rest. I imagine I would need to sort the collection of grid points by their distances from the anchor points, which would have to be excluded from that list (or would it be a dictionary?) And the function would work through the list of points and evaluate them with some expression (like 1/x) and create vectors to move them.
Can anybody help or offer advice?
My first attempts:
####creating a grid of points that responds to manipulating individual vertices ####an initial point is moved and the remaining points are subsequently affected import rhinoscriptsyntax as rs import math #creates the grid of points grid =  origin = rs.GetPoint("Select the origin of the grid.") origin = rs.AddPoint(origin) x = range(0,8) y = range(1,8) for i in x: row = rs.CopyObject(origin, [i,0,0]) for i in y: column = rs.CopyObject(row, [0,i,0]) #moves the initial point def move_point(): point = rs.GetObject("Select a point to move.", 1) new_point = rs.GetPoint("Select where to move the point.", point) rs.MoveObject(point, new_point - rs.PointCoordinates(point)) move_point()