How to Organize Components in a Compiled '.ghpy' - Python Plugin

in Order to determine place for each component, [in a Compiled .ghpy file, consisting several components], to my knowledge, there are two ways:

  1. in the script:
    ghenv.Component.Category = “Mesh” (or self.Category … )
    ghenv.Component.SubCategory = “Util”

  2. When compiling using ‘Ghpython Scripting Component’ use the menu to select, Catagory and Subcategory [ which I guess these settings will override the settings from method 1, right?]

and the Question is:
there is a subset inside each category, divide with a horizontal line (picture below)
image

how to determine each component’s place in these Subsets? (or how to draw these horizontal lines?)


@AndersDeleuran , @piac

You see, the goal of this code is to ultimately assign a category and subcategory during component creation. If it happens later, it’s still OK, but the Grasshopper SDK expects these values during the creation already: Simple Component (C#)

  • If you write the component code manually, you assign these values in the constructor.

  • If you use the help of the wizard, method 2 is the fundamental method. You can see how the wizard will fill these values in the constructor if you choose to copy the compilable code that the wizard writes.

  • If you use “Method 1”, all that will happen is that the component is created with the category set in the dialog (using that same constructor functionality), and then it will be reset later during the “solve” step of the GH definition. So it will be set twice.

About that tab, it’s the Exposure property/attribute of the component that controls that. GH_DocumentObject.Exposure Property
See this topic: AdditionalHelpFromDocStrings for .ghpy - #7 by piac about a way to override it.

2 Likes