Grasshopper

algorithmic modeling for Rhino

Error: Reference to a non-shared member requires an object reference.

Can someone tell me why the line "Dim vectQ As Vector3d = Quaternion.Rotate(vectIn)" throws the error "Error: Reference to a non-shared member requires an object reference."?

 

Private Sub RunScript(ByVal q1 As List(Of Double), ByVal q2 As List(Of Double), ByVal q3 As List(Of Double), ByVal q4 As List(Of Double), ByVal vectIn As Vector3d, ByRef vectOut As Object)

  Dim i As int32

  Dim lstOut As New List (Of Vector3d)
  For i = 0 To q1.Count - 1

    Dim Q As New Quaternion(q1(i), q2(i), q3(i), q4(i))

    Dim vectQ As Vector3d = Quaternion.Rotate(vectIn)

    lstOut.Add(vectQ)

  Next

  vectOut = lstOut

End Sub

Views: 669

Replies to This Discussion

The Rotate() method is not Shared, thus you need to call it on an instance of the Quaternion type:

 

Dim Q As New Quaternion()

Dim vQ As Vector3d = Q.Rotate()

 

But note that Quaternion is a new type in the Rhino5 SDK and you won't be able to use it while Grasshopper runs on Rhino4.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

A HA!

Right again you are.

 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service