Grasshopper

algorithmic modeling for Rhino

Hi all,

I have a small problem using the Print Function (Reflect too). When I have a custom class like this: I wont be able to use print function inside that sub. Error Returned: Reference to a non-shared member requires an object reference.

 Thanks A lot.

Victor

 


 

Public Class VertPackage

    Public PosH As Integer

    Public PosV As Integer


    Public Sub New(ByVal PosH_IP As Integer, ByVal PosV_IP As Integer)

      PosH = PosH_IP

      PosV = PosV_IP

    End Sub


    Public Sub PrintPosH()

      Print(PosH)

    End Sub

End Class

Views: 336

Replies to This Discussion

Hi Victor,

The Print method belongs to the Script_Instance class. In order to access it within a custom class you could pass the current instance of Script_Instance as an argument to your PrintPosH method.

Public Sub PrintPosH(ByVal sI as Script_Instance)

      sI.Print(PosH)

 End Sub

 

Use the "me" keyword to pass the current instance of Script_Instance as an argument within RunScript.

Dim vP as new VertPackage()
vP.PrintPosH(me

Hi David,

 

Thank you very much for the explanation. I thought about the me, but had no idea how to use it in this case.

 

Victor

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