Grasshopper

algorithmic modeling for Rhino

Hi,

I'm a beginner in creating python components.

I try to write a script in python component that would filter the cloud of points through the Z-value in a range between A and B.

In the screenshot, below the python component there is a grasshopper solution.

However, in python when I try to add all the Z-values to the list [] after printing it's like creating multiple lists, with each one having one more element than another.

When I print the first element [0] instead of one value from one list, it prints multiple times the value.

I need ONE list that would just combine all the Z-values, so I could test them against constraints and filter them.

Could someone explain me this multiple points/elements transition to python script and perhaps gives some suggestions?

Many thanks,

J.

Views: 1959

Attachments:

Replies to This Discussion

Hi Jacek, it would help if you upload your Grasshopper definition(s) as well. I suspect you're having an issue with setting the type hints on your input parameters (which is not obvious from a screenshot).

That's a better one!

Hi Jacek,

Please find the definition attached. Hope that's what you're trying to do.

-Dave

Attachments:

separate sorted list

Attachments:

Thank you for replies Mates,

especially thank you Devang for a cool piece of code and your time.

So I now I realized, that printing appended list will actually print every list, step by step, that was generated/iterated on the way. Printing the "point.Z" / "pt.Z" (or "i.Z" in my case) will simply print just the elements of the list [array].

I guess that's a clear lesson for me and anyone else who will encounter a similar issue.

Cheers!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service