Grasshopper

algorithmic modeling for Rhino

Hi (David)

 

I would like to add a panel button to my custom GH toolbar.

I which .dll does the panel code reside? I would like to help myself by copying bits from your code David.

 

cheers!

 

Views: 4906

Replies to This Discussion

Hi Jes,

 

toolbar? Rhino toolbar or Grasshopper toolbar?

 

Components are automatically added to the Grasshopper toolbar when they are loaded. All you have to do is supply a Category (the name of the tab), a subcategory (the name of the panel), the Exposure (the group within the panel, as separated by etches) and an icon (24 x 24 pixels).

 

--

David Rutten

david@mcneel.com

Turku, Finland

Right.. Grasshopper custom coponent Category and Subcategory it is.

I use reflector to learn from your coding of different components, but have not managed to find the Params->Special subcategory in the .gha files.

So basically, I would like a hint as to where in the grasshopper installation files do I find that?

- More specific, I would like to see the code of the "panel" component.

 

cheers

Isn't that outside the bounds of the license agreement?

It is indeed. Don't tell me you didn't read the license agreement?! :)

 

Tabs and Panels are created whenever they are needed. So if you create a Component tht defines Category=Humbug, SubCategory=Poppycock, then the Humbug Tab and the Poppycock panel will be automatically added to cater for your icon.

 

--

David Rutten

david@mcneel.com

Turku, Finland

I allways read the license agreement... :-)

 

All I wanted was to see how the panel component was scripted (the little yellow box that you can enter text in when placed on the canvas, -see the image) - If that is outside any sort of licensing, copyright bounds, I apologize.

Attachments:

Ah, the Text Panel object! I thought you were talking about the Ribbon panels (the little frames with black bars at the bottom).

 

Panel is quite a complex piece of work. It certainly doesn't serve well as a case study regarding custom objects. You might want to look at the Boolean Toggle or Colour Swatch components, those are fairly easy.

 

Most of these special objects are defined in the Grasshopper.Kernel.Special interface if you feel you must look at the code. As long as you realise it is a violation of the license agreement to decompile/disassemble any part of Grasshopper.

 

Note that all of the clever mouse interaction and display stuff happens inside the attributes of an object, not the object itself. So you'll find both a GH_ColourSwatch and a GH_ColourSwatchAttributes class and they work together.

 

--

David Rutten

david@mcneel.com

Turku, Finland

 

Just in case I missed the point entirely yet again, if you want to add the existing panel object to your toolbar... you can't. Objects can only appear once in the Grasshopper tabs. But you can make a UserObject out of a panel and put that one in your toolbar.

 

--

David Rutten

david@mcneel.com

Turku, Finland

 

 

That path is what I was looking for. Thanks.

And I just saw that my first post gives a rather undesired impression. It should have said something along the lines of:

"I would like to help myself by LOOKING and LEARNING from your code David." (mods, feel free to change or delete the original text)

cheers

and yes... I see that the panel object is rather complex!

In building components with the GHA wizard, how does one go about setting the exposure?  Category and Subcategory are part of the MyBase.New, but I can't find any method for setting the exposure...

David,

You have to override the default exposure of the component and set your own.

Public Overrides ReadOnly Property Exposure() As GH_Exposure
.

.

.
End Property

Best,

M.

 

outstanding.  Thanks Marios!

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