AdditionalHelpFromDocStrings for .ghpy

Is there a way to sort components inside Subcategories with dividers for compiled Python components?

ghenv.Component.AdditionalHelpFromDocStrings
self.AdditionalHelpFromDocStrings

Both options seem to be ignored in compiled .ghpy assemblies.
Am I missing something here?

Hi!

What is not working?
What are you looking for this to do?

It seems that you cannot:

You can however override the Exposure level attribute:

For Plug-ins distributed as User Objects containing ghPython component (ie. Ladybug, Honeybee, Gismo):

try: ghenv.Component.AdditionalHelpFromDocStrings = "*int*"
placed right after docstring was used to sort components into sections in SubCategories (in the same fashion as in your second link). However, it seems that this doesn’t translate for compiled components.

Thanks for the link, I will look into the Exposure attribute and report back.

Really strange that it works like that. That property is there only to provide storage for a “remarks” section in the Grasshopper “Help”.

Apparently I’m missing something here.

class getUTM(component):
    def __new__(cls):
        instance = Grasshopper.Kernel.GH_Component.__new__(cls,
            "1. Get UTM", "getUTM", """Downloads a WTK definition of UTM projection at given location.""", "DeCodingSpaces", "Util - Projection")
        instance.Exposure = Grasshopper.Kernel.GH_Exposure.primary
        return instance

On GH load I get “TypeError: Expected property for Exposure, but found GH_Exposure.”

Hi @ondrej-vesely

Gh_Component.Exposure is a read-only property. This means that you can only override it, but cannot assign a value to it.

To override it, just add a def that looks like this to the class:

@property #not required but looks good
def get_Exposure(self): #override Exposure property
    return Grasshopper.Kernel.GH_Exposure.primary

The error you see is because Python would allow you to override the ‘Exposure’ name also by using the property() function: http://www.ironpython.info/index.php?title=Overridable_Properties

For more info, see some IronPython books:

I can highly recommend the second.
To simplify, just always override properties in the way shown above and it will all work well.

Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com