GHpython function, role of second argument "i"

Dear All

Please excuse my ignorance, I am trying to understand a GHpyhon code from a tutorial as attached.

I understood most of it, except that I couldn’t figure out what the “i” does in the function
def (r,i):

I guess the “r” can be replaced by a geometry to form a loop, but what is the role of the i?
if anyone can let me know in simple “English”(lol I am rather overwhelmed by codes ) I would really be grateful!

Thank you all!
yutaka

function i meaning.gh (2.7 KB)

The i input parametter is never called within the function, it therefore does nothing:

That, plus the extensive use of the ghpythonlib.components namespace, suggests that whomever wrote this code probably shouldn’t be making tutorials.

1 Like

Hi Anders!

Thanks for your answers, do you mean the ghpthon library should be used less?
Would you have any suggestions of where to learn ghpthon properly?
Thanks !

Correct, it’s basically a Python module that wraps the RhinoCommon node-in-code namespace, which in turn wraps parts of Grasshopper. That’s a whole lot of indirection, when one can usually simply implement RhinoCommon directly (i.e. import Rhino). That said, a lot of Grasshopper components go beyond RhinoCommon and therefor may require using ghpythonlib.components if one cannot implement their underlying functionality directly.

I see that the Rhino.Python Guides appear to have mostly removed its GhPython content. But there is still a lot of relevant learning material there. If you’re willing/able to pay for it I’d suggest enrolling in this class the next time it’s available. It would be great if it was made publicly available similar to the C# classes @LongNguyen has taught over the years.

This McNeel produced video content might also help:

  1. https://www.youtube.com/playlist?list=PLJCieDPc7Er4120VrqUOzpPO3Cs9pZ9v7
  2. GhPython Introduction | Rhino3D.Education

And some quite old, but maybe still relevant video series:

  1. Stephen Maher
  2. https://www.youtube.com/playlist?list=PLGV167zE8gnVhurBT46afZ1RlK9RzAsLx
  3. https://www.youtube.com/playlist?list=PLpuejoPydMLUK1DrsZFmx3UDNxUnVJJFk
  4. https://www.youtube.com/playlist?list=PL5Up_u-XkWgP7nB7XIevMTyBCZ7pvLBGP
  5. Rhino - Python Programming — Plethora Project
1 Like

Forgot about this old link too, might be relevant for your fractal funz:

http://atlv.org/education/ghpython/

1 Like

Thank you Anders for your knowledgeable guidance! I will certainly dive into those , glad I posted here !
You are a light house :+1:t2:

1 Like