Grasshopper - Interpolation of data in a tree through Python

Hi,

I have a list X of positions along an axis and a list Y containing the values of a parameter at those positions.
I also have a tree S which contains some values along the same axis as X.
I want to determine a tree with the parameter values for each position in S through linear interpolation.
However I get an error stating S is an ‘int’ object whereas I would think it is a tree.
Do I overlook something or can anybody tell me what I am doing wrong?
All help is really appreciated, thanks in advance!

Hi,

Have you set the S input to Tree Access?

If not, it’s interpreted as item by item, by default.

1 Like

assuming S input is set to Tree Access already :upside_down_face: line 3:
S = th.tree_to_list(S, None)

that None wouldn’t be needed if paths were not simplified, like:

1 Like

It was a combination of both:

  • I did not know I could/should change the input type, I guess I assumed Python knew what kind of input it was getting.
  • Adding the ‘None’ is also necessary in my case

Thanks both for helping me so quickly!

1 Like