Multiline Description in New Script Component

I love the new script editor and its features. It’s great for adding short descriptions for components and their parameters.


But, I’m having trouble adding multi-line descriptions like this.

I used code in the script component and it worked at first. But when I finished making the component, the description was missing.

ghenv.Component.Params.Input[1].Description = (
    "Level of model complexity for the task, balancing accuracy and computational efficiency.\n"
    "https://storage.googleapis.com/mediapipe-tasks/image_classifier/labels.txt\n"
    "0- Lite0_int - 10.08ms\n"
    "1- Lite2_int - 19.43ms\n"
    "2- Lite0_float - 2.52ms\n"
    "3- Lite2_float - 44.17ms"
)

I like how the script editor generates the source code too. I finally got to push my own multi-line descriptions to the serialized script string. However, it wasn’t easy.
If we could enter text with line breaks directly inside quotes, it would be much easier.
@eirannejad

1 Like

Don’t triple double quotes do this?

"""
This is
a multiline
comment
"""
2 Likes

FWIW, I format the component docstring parameter documentation like so to get multi-line strings. Does that not work with the new Rhino 8 editor?


231119_MultiLineParameterDocs_00.gh (5.9 KB)

2 Likes

Tooltips can’t have line breaks even with triple quotes.

Unfortunately, that doesn’t work with the new Rhino 8 editor.

1 Like

Ah, well that’s not good (paging doctor @eirannejad). Does it also not work for an IronPython script?

2 Likes

Haha, good one calling for Dr. @eirannejad!:man_health_worker::smile:
Nope, it doesn’t work with IronPython either. Seems like it’s not meant to work that way anymore.

1 Like

@Mahdiyar @AndersDeleuran @Helvetosaur

Okay here is the YT

RH-79236 Script component to extract description from docstrings

I’d appreicate if any of you can give me a short list of expectations/wishes for the docstrings. Let’s add on to this list:

  • Consistent docstring convention for all languages
  • Docstring to show parameter name, pretty-name, description, type (hint)
  • Component updates docstring when parameters change
  • Component updates its own parameters from docstring. Pasting a script into a component should automatically update the component parameters (This currently works with SDK style scripts from RunScript signature)
<main description; multiline>

    Inputs:
        <name>[<type; optional>]: <description; multiline>

    Outputs:
        <name>[<type; optional>]: <description; multiline>

    Author: <author>
    Version: <script-version>
    Rhino: <min-rhino-required>
3 Likes

Hey, I really appreciate your consideration.

I myself don’t have any other expectations beyond what you’ve mentioned regarding the docstrings.

As for the menu items, I’m curious-are you planning to remove them? In my opinion, they have been quite handy. It would be nice to tweak them, by allowing multiline text as a tooltip.

I just wanted to mention It’d be really handy if we could change a component’s nickname right away, like what we currently have for parameters. Right now, we can only change the nickname and description through the menu.

Yeah I’m gonna keep those menus around and improve them. Right now they’re the default Grasshopper text input menus.

So you mean setting the component name from the docstring too?

I’m glad to hear that. I think this simple text input could just accept text with quotation contains line-breaks.

Yes, changing the component name would be handy.

1 Like