Script Editor Component Preview

I am trying to create a component using the context components in Grasshopper and the new script editor in Rhino 8. Is there a way return the geometry from a component?

Currently, I see only two components to get an output out of the component.

  1. Context print
  2. Context bake

None of them will help in previewing result geometry.

The answer is yes. But can you send us what you have so far? Most of it should be automatic.

@Devang_Chauhan Context Print and Context Bake do not have a specific geometry type. The way to choose a specific parameter for output is to group a parameter and name it RH_OUT: <name> where <name> is the output parameter name. This way the published component will adopt that type.

Source Grasshopper definition:

The published component:

HOWEVER! :smiley: There is a bug related to previews that I have on my list to fix:

RH-79902 Published contextual component does not preview output geometry

4 Likes

I would love to know when preview is fixed. Very powerful abstraction.

Well this is cool! Thanks for sharing

@eirannejad

I am also working on grasshopper components using the script editor with context components as @Devang_Chauhan was in April.

As an example, if my custom component outputs a line, it doesn’t appear in Rhino unless I attach a standard GH line component to the custom component output. Is there a way to make the custom component preview that line without having to attach a standard GH line component? Perhaps there is a method/syntax to make this possible?

Kindly,
Ben

This is an example of a context component (embedding a grasshopper definition with contextual inputs and outputs) that shows previews on the output (A, B, C, …)

Would you mind sharing a gh definition and published plugin that does not show preview?

Published Context Component in action. See the preview in Rhino viewport matching with image below from source gh definition

The original GH definition used to create the component:

1 Like

Thank you for the quick response!

I hopped on here to say that I hadn’t updated Rhino since July.
I updated it a moment ago, and now the context component previews geometry as I’d expect a component to preview! All I had to do was change the original definition to have a context bake for the output as you show above, instead of the RH_OUT group method.

I want to mention I got an error message when publishing using the group RH_OUT: method. The version I am running is the latest version, but the warning assumes I’m not? Regardless, I don’t see a need to use the RH_OUT method anymore, since its working with a context bake component.



Here is the error message, along with the current version I have installed.


Here is a quick and dirty example GH definition and the context component in one file, previewing like a dream.

I really appreciate your help and thorough response!