algorithmic modeling for Rhino
Hi,
I am working with the python script to use GIS data in grasshopper. I am taking the center points of the geometry from GIS and connecting each of them to another set of points which I have specified myself (referenced in Rhino) through the closest point component. The result is like this:
and the definition is like this:
From there I want to group the GIS points based on which closest point they are connected to and so that each referenced point grouping is its own index. This might be getting into path mapper, with which I haven't had any success yet.
Any suggestions would be much appreciated.
Tags:
Graft the P input. Then the CP's will be grouped in branches per point.
Thanks for responding Hannes.
I wish it was that easy, however grafting it does not solve it.
Here is what happens when I graft the P input, as you suggest:
and here is the definition:
I think the error on the line is just from running out of memory.
Alternatively, if I graft the C input, which makes more sense to me since those are the points that I am trying to group around, I get a similar preview in Rhino and the definition is this:
The output of the CP is 27 branches, which is what I'm looking for since there are 27 points going in to C, however each branch has 4066 items (the total number of P inputs), whereas I'm looking for each branch to have a different number of items corresponding to how many of the P points are connected to each C point.
I didn't have a param viewer in my previous post, but all lists are flat.
Obviously, the A input to the line needs the same tree structure to match the now grafted points. So connect the grafted Centroids to A.
Maybe you could post the definition to let us better help you.
I am trying to do something similar. I have 2 sets of points (set1, set2) I want gh to find the the closest points in set2 for each of the points in set1, then have gh sort/group/list the closest points based on what point in set1 they are closest to. Eventually having those groups of geometry create individual enclosing circles, but i have that figured out, i just cant seem to figure out how to pull the right data out of the closest point box.
Ive attached a simplified version of what i am trying to do.
Thank you for the help.
see my last linked discussion. this should be excatly, what you are looking for,
sorry for my ignorance, but i dont think im understanding the linked discussion as it relates to my goal.
The topic discusses how to select the cloest/farthest points in relation to a set of reference points(set1) form a point cloud(set2). It starts with finding the minium/maximum distance values and end with finding the vector to the closest/farthest point... you could reduce from vector to point. The principle is always the same.
The result of the whole operation should be, what you are trying to feed into the enclosing circles.
The grafting as you suggested solved the crazy rhino preview issue, but I am still left with 4066 branches inherited from the grafted centroids, while what I am after is 27 branches from the referenced points. It seems like the grafting should come from that input instead. I tried swapping the P and C inputs for the CP with the other source grafted, but the preview was all wrong.
Here is an edited version of my definition. I've baked and referenced in the GIS geometry to extract the centroids.
The baked GIS geometry made the rhino file too large to upload, but here is the gh file and perhaps some other 2d geometry or cloud of points can be substituted.
Ok now I see...
It's a matter of reversing the logic. I'm not really sure how your first picture was created, because it doesn't look like you got a cloud of relly closest points to each of your 27 stations. The pattern should look more circular instead of interlocking starfish.
Grafting P input will search the the whole cloud C for each of the P. So if you want the 27 closest points to each of your 27 station. You need to input a grafted version of the stations to P and a flat version of the centroids to C. then connect the grafted station points with the results. But this will look nowhere near your first picture.
If you want to select all the closest points for each of the stations, kint of a voronoi pattern, then this discussion might be helpful.
Like this.
You have some duplicates in the point-cloud... I took the liberty to remove them.
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
© 2024 Created by Scott Davidson. Powered by