Vbnet vector doc product

How can I find the dotproduct of vectors in VB net. … the methods available within the VB net script component is not have this…

Just multiply the vectors. Or alternatively you can use the Shared method on Vector3d.

Dim v0 As New Vector3d(4, 6, 7)
Dim v1 As New Vector3d(9, 2, 3)
Dim dp As Double = v0 * v1

Dim dp As Double =Vector3d.Multiply(v0, v1)

Hi David

Thank you. That works of course!

I want to explain what i am doing generally and hope you can give me some broad guidance.

I am an architect artist and many years ago found scripting really something that adds to my artwork.

I started with rhinoscript and studied your rhinoscript manual 2007 religiously and used it to do some artworks

Since then, i have moved on to grasshopper / Kangaroo and I use VB net within the grasshopper when i thought using just the grasshopper components was too cumbersome – i never used much geometry within the vb net as i could never get my head around finding the rhino methods for the geometry ( i thought was much simpler in rhinoscript but probably it is just that i haven’t found any tutorial manual which covers this).

Lately i wanted to retry some portion of the recursive script in the ‘Arc’ section of your rhinoscript manual but within grasshopper and with vb net script.

It dawned on me that i needed to work out creating geometries within vb Net or the recursive script cannot work. One cannot get out of vb net component to use other geometry grasshopper component, get its value and reload it back to the same script component to continue the recursive process!!!

I just discovered that rhino.geometry can bring up a lot of geometries and methods. Before i did not know how to invoke this. If you can give me any guidance or any other resources to refer to, that would be really great!!!.

Also for transforming geometries, something like as below works:

line.transform(transform.rotation(1.57, New point3d(0, 0, 0)))

yet this is far from obvious when I bring up the line transform method which states xform as transform as Boolean – what does this mean?

Many thanks

This is my first port of call when searching for functionality in RhinoCommon. I mean, after the autocomplete menus in the code editor that is. Mostly things are where I expect them to be, so “searching” is almost always just a matter of “looking”.

Transforming geometry in RhinoCommon almost always requires you create a transformation matrix. I.e. the Rhino.Geometry.Transform type. There are a lot of methods on Transform for setting up rotations, translations, inflections, dilations and more.

The boolean return value indicates whether the transformation was successful.

Thank you!

Then how can I create an arc using start point, end point and tangent

I can see the constructor in the SDK rhino.geometry – arc Structure – Arc Constructor but cannot script to get to it

Rhino.geometry.arc does not bring up the autocomplete menus as help

Many thanks!!!

There’s a big difference between instance, static (“Shared” in VB) and constructor methods. Instance methods require that you first have an instance of the data, and then you can call that method on that instance. For example if you want to know the length of a curve. You cannot measure the length until you first have an actual curve.

Most methods you’ll run into are instance methods, however there’s a fair number of shared methods as well. These work ‘out of the blue’ without being associated with any specific instance of a type.

If you wish to call a shared method, you do so on the type name:


Instance methods on the other hand are always invoked on variables:

Dim curve As Rhino.Geometry.Curve = ...
Dim length As Double = curve.GetLength()

If you type Rhino.Geometry.Arc. all you will see are the shared methods on Arc (there aren’t any). Once you have an arc you can call some of its methods, such as:

Dim arc As Rhino.Geometry.Arc = ...
Dim box As Rhino.Geometry.BoundingBox = arc.BoundingBox()

Lastly, constructors are methods used to create new instances of a type. They are always preceded by the New keyword:

Dim arc As New Rhino.Geometry.Arc(startPoint, startTangent, endPoint)
Dim box As Rhino.Geometry.BoundingBox = arc.BoundingBox()

The Arc type provides these constructors, among them tangent and 3-point methods.

Thank you very much for your time and patience

It will take me time to digest your info and hopefully will not have any more queries!!!

Yes, sometimes i have my hands over my face just like yours…

Thanks again.

I remember I once punched a dent into the wall next to my desk when I was trying to understand how VBScript arrays worked.

Actually i do get it generally but why does the following not bring up the constructor prompts

Dim arcTemp as New arc

arcTemp = rhino.geometry.arc()

But this does

Dim arcTemp2 As New rhino.Geometry.Arc(etc)

Thanks again.

Because a constructor is always associated with the New keyword. You have one line which invokes the default constructor, and then you do something illegal on line 2.

Thanks again

I think i get it…!