Grasshopper

algorithmic modeling for Rhino

Hello,

We're newbies to vb.net. We have a list of vectors (with different directions) and what we want to have in the end is basically the mean vector (or the mass addition of the vectors), in order to be able to orient an object according to this.

Can you please help us out?

Thanks in advance

Views: 2716

Replies to This Discussion

The cool thing about the SDK is that they've overriden operators to be used on certain classes, mainly points and vectors. So adding vectors is pretty much as simple as you'd add two numbers.

Dim sumVec as New On3dVector()

For i as integer = 0 to myVectorList.Count - 1
sumVec += myVectorList(i)
Next
Thanks for the quick reply


The output in this case should be a vector right? but even so it doesn't show up... What did we do wrong?

Thanks again
I don't think GH is registering the output correctly. Try a different name for the output, then assigning sum vector to that. So in the default case (with the output variable named A) just add the line

A = sumVec

to the code.
Thanks a lot!

It's strange cause i tried it earlier but something must have been wrong, cause now it s working.
Incidentally, the next release of Grasshopper already has a Vector Mass Addition component build in.

--
David Rutten
david@mcneel.com
Poprad, Slovakia
Cool! When will it come out?
In the mean time you can decompose the vectors to their X,Y,Z values, use the mass addition component in each of the 3 lists of numbers and use the resulting 3 numbers to create the sum vector.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service