Grasshopper

algorithmic modeling for Rhino

Automatically/Dynamically listing new variable input parameters in GHPython component

Forgive my foray into the depths of GH programming, I'm a little lost:

I'm trying to enable a python component to automatically read newly inserted input parameters, following on from this discussion:

http://www.grasshopper3d.com/forum/topics/variable-input-parameters...

This is all new to me however as I've never worked with the GH SDK itself... When I try to list out the items in enumerate(ghenv.Component.Params.Input), I get GH objects rather than the data itself (eg  <Grasshopper.Kernel.Types.GH_String object  ... >)

Can someone guide a newbie through this? 

Thanks!

Views: 1853

Attachments:

Replies to This Discussion

Hi Daniel,

What your "out" output parameter shows is a print of "Attributes" list of lists. It does not output the content of "Attributes" list of lists.
If you have assigned the "Attributes" to some output parameter (say b = Attributes), you would get the following:

IronPython.Runtime.List
IronPython.Runtime.List
IronPython.Runtime.List
IronPython.Runtime.List

That's because grasshopper does not support python's list of list (or any other subarray type).

So the way to overcome this is to create a data tree, where each its branch will contain one of python's upper sublists. Which is what has been done in the .gh file you opened.
Hope this makes sense. If not, let me know.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service