algorithmic modeling for Rhino

By default the subcategories go in alphabetical order. Anyone know how to override this in C#? For instance, like GH's Params subcategories which are not in alphabetical order (Geometry, Primitive, Input, Util). Thanks.

Views: 1646

Replies to This Discussion

Ah no I know how to set Exposure level(split the tabs). I mean the sub categories. For instance, the sub categories of the params tab are - Geometry, Primitive, Input, Util. 

As you will see those are not in alphabetical order but by default they are when making a plug in. So if I made those categories they would be ordered like - Geometry, Input, Primitive, Util.

So I am looking for a way to override the alphabetical order.

you cant!

I knew it was some Rutten magic :D

Last I heard, David has some method to control tab order for vanilla Grasshopper components, *BUT* whatever it is is not available to plugin developers. I'll try to find the thread where I read that and post a link.

Thanks for the link, so yea it is not exposed. 

Grasshopper.GUI.Ribbon.GH_LayoutTab have the Panels property as list of Grasshopper.GUI.Ribbon.GH_LayoutPanel, perhaps by changing the order of this list from Grasshopper.Kernel.GH_AssemblyPriority you can produce this change.

Something like (not tested):

public class SetupPanelOrder : Grasshopper.Kernel.GH_AssemblyPriority

public override GH_LoadingInstruction PriorityLoad()

GH_ComponentServer server = Grasshopper.Instances.ComponentServer;
Grasshopper.GUI.Ribbon.GH_Layout ribbon = server.CompleteRibbonLayout;

Grasshopper.GUI.Ribbon.GH_LayoutTab tab = ribbon.Tabs[IndexOfYourTab];

//Change order in some way, here swapping panel0 by panel1
Grasshopper.GUI.Ribbon.GH_LayoutPanel temp = tab.Panels[0];
tab.Panels[0] = tab.Panels[1];
tab.Panels[1] = temp;

return GH_LoadingInstruction.Proceed;


Or perhaps subscribing to the Instances.CanvasCreated event.
I have no idea if this can work, but try. 

Thanks Daniel, I'll give it a try. It's not super important but was just thinking if it makes sense to sort a plugin category by relevance vs alphabetical. At the end of the day, it's not a deal breaker. 

There's actually an easy way to do this: put spaces in front of the subcategory names.  The spaces will be accounted for when sorting alphabetically (so, the more spaces you put in front the earlier it will be) but will automatically be trimmed out when displaying the name.  So, instead of "Geometry", "Primitive", "Input", "Util" use "   Geometry", "  Primitive", " Input", "Util".

Thanks! That's a nice trick






  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service