Quantcast
Viewing all articles
Browse latest Browse all 5785

GhPython: Multiple Inputs are all given same list length when input to functions

@D.Ronald wrote:

I am struggling to understand how Grasshopper and GHPython are handling multiple inputs. I need to understand this before I can really build out a lot of my script.

Context

  • I want to build a function (example: area calculations) that can be used across multiple inputs: devs, plots, buildings.
  • I will be writing a bunch of similar functions that need to be applied in a similar way across all the geometry inputs.

Problem:

  • The 3 inputs are all “cycled” over in the ghPython component to the longest list length.
  • example: devs = 3 items, plots = 4 items, buildings = 8 items. But They all get the function applied 8 times (longest set of items) meaning that the last item is duplicated repeatedly.

Hunch
I suspect I’m misunderstanding something fundamental about multiple input treatment in the ghPython component. I’ve written the function to be encapsulated, but this might not be working. Do i need to make it a class in python?

I already referred to the post by @piac about accessing item/list/tree. However I tried writing functions for ITEM and LIST and the problem wasn’t solved.


MassDataMaker_SentOut.gh (20.7 KB)

Posts: 4

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 5785

Trending Articles