[Question] Setting default behavior of GH_Python component

As it appears lately I’m using more and more GH_Python components in SDK mode. Therefore, every time I have to rearrange the code and add the common method overriding.

Is one of the following possible?:

  1. Automatic re-arrangement of the code when toggling SDK mode?
  2. Separate button to run ghpython directly in SDK mode?
  3. Use right-click, or hold left-click or whatever (like rhino has left and right click could start different commands) to directly run in SDK mode?
  4. Have a template of the code for SDK mode just like “Set Template Code…” but a separate one for SDK mode?

Thanks

All of these can be achieved by creating a Grasshopper User Object with the component preset the way you want it.

The component is already doing what it reasonably can. More would be maybe technically possible, but really going beyond the purpose of a simple editor.

Thanks,

Giulio


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

1 Like

So I can simply change to SDK mode and rearrange the code then create UserObject. Never thought of using User Objects for just one component. Thanks for the hint. :slight_smile:

Yeah, I get that, but if you think about it SDK mode could be reasonable to be a separate (advanced) component. May be added to the wish list. If you want to allow your employees to code but not allow them advance coding and compiling then if they are separate components you can just forbid using the advanced (SDK mode on) editor.

This is a different wish from the above one. Specifically,

‘Forbidding’ a component is not high on the request lists, and there is indeed no SDK way to entirely ‘forbid’ a specific one.

Well if the simplified version of ghpython (with removed SDK mode and Compile buttons) and the advanced one (having SDK mode and compile and rearranged code) are added to GH as separate GHAs you could just restrict the user to not have the advanced one.

Anyways, as you said, not high in the wishlist, which is understandable.