Grasshopper

algorithmic modeling for Rhino

Hi Guys,


I am starting to create a custom 0.7 grasshopper component with Visual Basic 2010 Express following the guide from Ben Sitler. 


Most stuff is working fine but my custom Icon is not properly showing up in Grasshopper. There is just a transparent hole where it should be (in tab menu & on the component box & etc).


I listed a schematic/simplified version of my component below. The icon was added to the project resource file and with the name 'ICON'. 


The mentioned guide is supposed to be for 0.6 ... might that be the problem and i have to register the custom icon differently?


Thank you for your help

Ciao

KT


-----


Imports Grasshopper.Kernel

Imports Grasshopper.Kernel.Types


Public Class MyClass

   Inherits Grasshopper.Kernel.GH_Component


   Public Sub New()

      MyBase.New("ButtonName", "Abbreviation", "Description", "TabName", "SubTabName")

   End Sub


   Protected Overrides Sub RegisterInputParams(ByVal pManager As GH_InputParamManager) 

      pManager.Register_SurfaceParam("Surface", "S", "Surface", GH_ParamAccess.item)

   End Sub


   Protected Overrides Sub RegisterOutputParams(ByVal pManager As GH_OutputParamManager)

      pManager.Register_SurfaceParam("Surface", "S", "Surface")

   End Sub


   Protected Overrides Sub SolveInstance(ByVal Da As IGH_DataAccess)

      Dim Surface As Rhino.Geometry.Surface

      Da.GetData(Of Rhino.Geometry.Surface)(0, Surface)

      

      [...Component Code...]

      

      Da.SetData(0, Surface)

   End Sub

   Public Overrides ReadOnly Property ComponentGuid() As Guid
      Get
         Return New Guid("{11111111-1111-1111-111-111111111111}")
      End Get
   End Property

   Protected Overrides ReadOnly Property Internal_Icon_24x24() As System.Drawing.Bitmap
      Get
         Return My.Resources.ICON
      End Get
   End Property

End Class

Views: 2012

Attachments:

Replies to This Discussion

Hi KT,

this looks correct. Can you upload the image file that is ICON to this thread as an attachment?

--
David Rutten
david@mcneel.com
Poprad, Slovakia

ps. I hope your ID is not really "{11111111-1111-1111-111-111111111111}"
Hi David,

Thank you for your quick response. I attached the icon to my original post. I added this to the resource file of my project and gave it the name ICON. Its a 24x24 pixel png file with transparent background but i also tried it with the same file saved as bmp and gif.

So probably the problem is hidden somewhere else... in some visual studio setting or settings file I am going to check now.

Anyway. I was actually surprised that its so easy to write own components for GH and have an own gha file to incorporate this custom functionality. Great work! :)

Ciao
KT

ps: No the id was changed before posting so no one else takes it :)
Hi KT,

very strange indeed. I'd like to get to the bottom of this. Can you email me the entire project + resource files via email? ( david@mcneel.com )

--
David Rutten
david@mcneel.com
Poprad, Slovakia

I have a little diferent problem here, if I add the lines with (in correct place):

 

    Protected Overrides ReadOnly Property Internal_Icon_24x24() As System.Drawing.Bitmap

        Get

            Return My.Resources.ICON

        End Get

    End Property

 

Then the working plugin is no more in GH tabs. If I delete this lines everything works fine and I have my plugin with its custom tabs, etc.

Anybody knows...:(

Hi Angel,

 

did you put a breakpoint on that line (Return My.Resources.ICON)? Is there an exception that gets thrown when you hit it?

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

No exception, no breakpoint...:S...

 

I have not read your answer here and I just created a new post, sorry. We could stay here or go to new post, whatever you want.

 

http://www.grasshopper3d.com/forum/topics/i-cant-add-icons-to-my-pl...

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