Define RH_OUT parameters in code

Hello,

I have a question about the RH_OUT: parameters in rhino compute. Is it possible to specify what data a script should have as outputs directly in code somehow?
The problem that we have is that we have multiple grasshopper scripts that are being run on a same server, and we use the same parsing for all of them, so it’s really important that all of them have the same structure and naming conventions for I/O parameters.

This is not an issue in itself since we can pick the outputs and their names, but when the number of scripts grow it becomes harder and harder to maintain. Therefore, I was thinking that maybe we could create a component that sets the RH_OUTs directly in code so that the same component can be used across multiple scripts and hence reducing the risk of human error.

Does anyone know if this is possible?

Best,
Erik

This is not currently possible. How would you envision this feature to work? Is there something that the client would pass to compute to request specific items to be returned?

Hi @stevebaer,

thanks for your response. I think this is an interesting topic since it’s a question about stretching the capabilities and use cases of compute. My original thought was that the RH_OUT: would be set as a flag on a piece of data and work much like the user data. This would for one mean that RH_OUT: parameters could be conditionally set. Let’s say I have a mesh called mesh, then I could say:

import Rhino.FileIO.Compute
if mesh.IsValid() and mesh != Null:
    Rhino.FileIO.Compute.SetRH_OUT(mesh, "mesh output")

and I’d know that whatever comes out is either nothing or a valid mesh. I don’t think this is a so important thing but for me it would primarily help by providing a way to control the output between multiple scripts and therefore make it easier to manage a common structure for lots of code.

Let me know what your thoughts are.
Best,
Erik

My two cents on this is that it there is some way to build this into a custom grasshopper component. When creating a grasshopper component there is a way to configure either RH_IN or RH_OUT in code. The purpose would be if you have multiple scripts where you want to have a common import or export.