Missing ghpython documentation?

I can’t seem to find any documenation that makes reference to the ghenv functions/classes in ghpython. I’m talking about lines like the following:

ghenv.component.message
or
ghenv.component.params.input

or similar.

Where can I find the documentation? I would like to see what tools I have at my disposal. So far I have only found and figured out what these lines are by looking at the Ladybug/Honeybee code. I have looked all over all the Rhino Developer docuemntation, grasshopper documentaiton, and really anything linked from this page Rhino and Grasshopper Developer Documentation (rhino3d.com)

Thanks!

See the old Grasshopper forum post linked to here:

As I said in the original post, I have already looked over all these document for help and found no instance of the string “ghenv”. I have even download all the docuset available and found nothing in them.

Is there a specific documents I should look at? is it called something else beside “ghenv” in the documentation?

There is no documentation of ghenv. Did you read point number five in the post on the old Grasshopper by @piac? He explains it there.

1 Like

Hey @cameronbehning

Yes, you are correct. Some info, as @AndersDeleuran mentioned, is on this page. We do not encourage the modification of Grasshopper behavior via scripting components, and especially not UI modification. For this reason, we do not document ghenv. Sometimes, users request ways to modify Grasshopper behavior nonetheless, and therefore, we show them via this variable, that simply contains a reference to the current GH_Component instance (see documentation links below). The variable itself is open-sourced, so you can see what it does. It’s just a container, really.

The ghenv.Component part returns a GH_Component class instance. You access Params and then Input. Make sure you get capitalization right!

Thanks,

Giulio


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

EDIT: @dale added a YT issue at WWW-1442.

I would recommend this section of the Dev docs site and the section specifically a about Python in Grasshopper:

1 Like

Here is a new course on GHPython that is free:

Now I wonder whether the tutor is talking about the missing ghenv documentation? :thinking:

1 Like

Try to put ghenv aside for a moment… concentrating on geometry and shape construction will bear fruit.

I don’t trust low-hanging fruits! :yum:

1 Like

I am pretty confident already with ghpython coding geometry and shape constriction (or more specifically, lots of math to be quick, then a little bit of conversion of number to breps, lines, meshes, planes, etc).

We are trying to develop in house components and as myself and my team realize new input and output we need, we would like to automatically update those on our ghpython components instead of needing to go in manually. In looking at some example usage of the ghenv library, I determined that I could it it to execute the automatic creating on inputs and outputs. I see no reason why this documentation should be hidden/kept away from the development community because clearly there are good uses for ghenv. The Ladybug team uses it regularly and they had to learn of it from somewhere. Why can’t the rest of us have the same access? I’m not even the first person to ask this.

1 Like

Hi @cameronbehning

We don’t want to keep anything away, when you take responsibility, you are free to do anything. The cases you mention are evidence for that. We also generally only help in public. There is however a good reason not to encourage beginners’ experimentations just on this one – not without a word of warning.

The naive implementation will break Grasshopper definitions solving, might possibly lead to loss of data and doing the wrong operation to the Grasshopper graph at the wrong time might lead to users of the code that cannot open or cannot save files anymore. How good is that? Of course, we don’t want that to happen. And I’m sure neither do you.

In particular, regarding the usage that you are after, it’s possible or not, depending on the solution timing. You are allowed to change the topology of the solution, with all precautions, when it’s not computing. This means, not inside the script solver itself. This is all also already explained, publicly, in the discussions here below.

I hope this makes it a little clearer. There’s no “rest of us”. These are all examples. Like always, in code, there are hundreds of ways to get to similar outcomes. And all variables exposed by ghenv, mentioned above, are documented in the Grasshopper SDK. Thanks,

Giulio


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

2 Likes