Hello,
I am basic user of c# language. I am trying to create Proximity3d component in c# grasshopper. Can someone guide me to the steps of logic it requires to create.
Thank you!
Hello,
I am basic user of c# language. I am trying to create Proximity3d component in c# grasshopper. Can someone guide me to the steps of logic it requires to create.
Thank you!
This is a basic implementation (not tested) to group (in branches) the neighboring points of each point within a minimum and maximum radius. It can be a starting point. GH has methods for spatial searching but I couldn’t give you an example.
DataTree<Line> prox = new DataTree<Line>();
for(int i=0; i<Pts.Count; i++){
Point3d p0 = Pts[i];
GH_Path path = new GH_Path(i);
for(int j=i+1; j<Pts.Count; j++){
Point3d p1 = Pts[j];
double d = p0.DistanceTo(p1);
if(d>minRad && d<maxRad){
prox.Add(new Line(p0,p1), path);
prox.Add(new Line(p1,p0), new GH_Path(j));
}
}
}
Thanks!.. I get the logic. It was tough for me to understand since i never scripted anything in c# involving Data Tree.
However for my project I need to group the branches, ( for example with 3 or 7 closest point) can you please elaborate on that. How it could be done?
Thank you for the time!
See attached.
Points_proximityEntryLevel_V1.gh (116.1 KB)
BTW: In case that you are in the AEC sector … DataTrees are a good thing IF you stay within the GH bandwagon. The bad news are that’s very rarely the case in real-life AEC BIM driven projects were lot’s of apps are used and Rhino/GH are not the primary ones.
Thank you for the script!
Right now I am just learning c# not particularly for AEC sector as such.
The script is pretty much advance for me. So I need time to understand it step by step.
Thanks alot!
Well … the next (and most important) step is to cluster the connections (Lines): use option 2 (prox on min/max distance) and observe that some times there’s “islands” of connections (i.e. “groups” not having any relation with others). Meaning that the results must being sampled in DataTrees instead of Lists.
If you want the solution drop a word