Confusion about how python script is applied to list of input

testCat.3dm (53.8 KB)
testCat.gh (13.8 KB)

My apologies since this is doubtless a newbie question.

I have a python script that is fed a stream of x and y scaling factors and a text object selected from a Rhino document.

Out the other side I was expecting to get a stream of text objects, each scaled to one of the sets of input transforms.

Instead, I’m getting a stream of objects all at the same scale.

I’m clearly not understanding how the inputs are matched up and would much appreciate some guidance. I did look through previous questions on the forum and found some that are tantalizingly similar but not quite solving my problem I think.

Thanks!
Mary

Hi Mary,
“expecting to get a stream of text objects”
You “cat” geometry is a group of 3 trimmed surfaces, scaling them will not convert them into “text” object, they still will be surfaces. (maybe you intended it)

Your script is working fine, the only problems i see are:
-your first “xCat” scale factor is zero! so you are not seeing 3 surfaces (you can see a vertical “line” instead); make it a positive non-zero value.
-the script convert your group object to a branch (a “list” with the object contained by the group)… but it seems it works fine anyway… you can “fix” this by using again group component to the input.(see second pic)
(Groups are not often used in grasshopper, them are probably useful for a new entry, but lately you’ll use trees and prefer them)

Another thing you need to know is how inputs lists are managed in grasshopper, look at this:
lists
A and B lists have different lengths. The shorter (B) grow by repeating its last element until it reach the same length of the longest (A), then the component do its job.
This happens also when there are 3 or more lists, and with trees it became more complex… even to explain.

That said, in your python script there are 3 lists: xCat, yCat and cat.
If you want to see better what is going on, you can manually adjust lists length by using “longest list” or “shortest list” component.
Also, it would be useful to set the same “count” for your “series” component.
(otherwise, if you want ALL the combinations between xCat and yCat … you should use cross product component … and so on…)

Your script is working fine to me.
cats

same results by using trees instead of group:
cats2

I suggest you to learn how trees/paths works in grasshopper.

I hope it was useful, cya!

1 Like

Thanks so much, Riccardo! This looks very useful indeed. Yes, the “text” is supposed to be surfaces right now for later extrusion. But despite reading everything I could find about trees/lists I was still confused. Neither shortest nor longest list made sense to me to use here since I wanted to alternate and couldn’t figure out how. I think your examples and suggestions will help a lot. I will go work with them!

Thanks again!

The longest and shortest list components solve all my other grasshopper problems as well. I’d seen longest and shortest list as settings on other components but hadn’t realized they had separate components all for themselves.

Thanks again,
Mary