Input Python

Hi,

I’m starting now to use python + gh.
I have an object drawn on rhino composed of 88 curves. I would like to insert it in the script but I can not insert it as a group, but only as a list of curves.Also I do not understand why the polyline is also duplicated 88 times.
Since I’m a beginner, maybe the script is badly set.

Thank you

Imagine a tree of 3 branches each 10 items…

If you run a script and set an input on item access, the script runs 30 times.

If you run a script and set an input to list access, the script runs 3 times (for each branch).

If you run a script and set an input to tree access, the script runs 1 time.

Setting item access makes sense if each element is threaded the same way.

List access usually is used if you modify list items with other elements of that same list. For example you feed in a list of points and you want to connect them with a polyline

Tree access is rather rare. You shouldn’t do that as a beginner.

1 Like

As tree doesn’t works. Is it not possible to import a group as a single geometry?

You can import a group, but then its a group object, which is a list. You need to ungroup within the script then. This is the same as feeding in a list.
Furthermore I’ve added a tree example:

group.gh (5.3 KB)

Probably I got confused during the thousand attempts, but my problem was to go from the “image A” to “image B”. It seemed to me that the list access did not work, instead it works.

Thanks

nonetheless I do not understand why the list affects the final quantity of polylines since the list is not used.

thanks

Hi. It doesn’t matter if the list is used or not. When the component is set to ‘item access’ the script will run for each item in the list. A simple way to look at it:

1 Like