Output a GH Python variable as 'Empty Generic Data Parameter'

Hi Rhino Enthusiasts,

I have a very small, and hopefully simple, question: How can I export a variable from a GH python component as an ‘Empty Generic Data Parameter’?

Why would I want to do this? I have several different scenarios in my GH template and in one case I would like it to be ‘empty’, because otherwise components that are further down the pipeline do not what I want them to do.

Assigning a non-existing variable to the output variable does the trick, but the component becomes red and is not very nice.

Best regards,
Bart

Couldn’t you just make the output in question conditional? If this or that happens, declare the output, otherwise don’t declare it.

I usually output an empty list or None, which will both output as an empty orange wire:

Edit: For context, I’ve developed this practice over the years for structuring GHPython code. Where steps 5 and 6 are the relevant ones here (i.e. empty outputs and check inputs before running any code):


211102_GH103_GHPython_BestPractice_Deleuran.pdf (174.9 KB)

2 Likes

Props, for the nice graphical breakdown! :+1:

1 Like