Grasshopper

generative modeling for Rhino

# GH functions

is there any way inside a VB.net or c#.net node to call a GH function?

for instance, could I use the proximity node, in a loop?
such as rhino. bla... bla... .prox(points, int, int, int)

Tags: function, node, vb

Views: 160

### Replies to This Discussion

What GH functions are you looking for? I ask because most of GH functionality is just implemented directly from the Rhino SDK (with a lot of error trapping and sorting etc.).
for instance proximity3d.
i have my own vb function (from time ago) that does it, but i was wondering if there was the option of call it straight, in order to increase preformance.
This is really just a "fancy" distance function, so it doesn't really require anything special from GH and probably wouldn't be faster either (since GH and you would probably both use the DistanceTo function). Anyway, here's some basic psuedo code if you need it...

For each point
Find distance to all other points
Sort according to distance
Cull based on Min/Max dist if desired,
Find the N shortest distances and make lines.

If you're really looking for speed, distance functions are notorious for offering some good speed increases. Basically, since distance functions require taking the square root of a value, they tend to be very slow because of that. However, if you write your own distance function without the square root and account for that in the other places within your code (by squaring the test distances for instance) you can get around taking that square root and speed things up.

In the case of this function, you can easily scrap the square root, since you're only looking for how many points are the closest. Even if you do want to implement the min/max radius thing, squaring those values will still allow you to bypass the square root. HTH
Great! good trick for speeding it up!

according to the general question, i understand there's no way of using built up functions of GH.

thanks a lot.

e

• View All