Grasshopper

algorithmic modeling for Rhino

Hi,

Im having an issuing trying to join curves in C# and return them from the node.

when i join some curves and return just that new curve everything works as predicted (see) below

Now if i try to return a Rhinolist<Curve[]> of joined curves. it doesnt return usable geometry (see below). does anybody know how i can turn a Curve[] into something usable?

Thanks in advance!

Views: 385

Replies to This Discussion

The problem is that grasshopper's script component only "automatically" breaks apart one level of list nesting. If you pass out a list, you get the items of that list. That means if you pass a list of lists, or a list of arrays, as you have here, you get back the arrays. You have a few options - you can construct your own DataTree to pass out (if you need to preserve info about which group each list of results came from) or you can just pass the curves into a flat list (make it a List<Curve> and use AddRange instead of Add). Finally, you can even create a SECOND script - that just says "A = x;" - and pass the output of the first script into x. The new script will process each array as its own item, and thus automatically convert the contents of each array into its own branch of output (I think). 

Hope that helps!

Ah!

Im pretty sure the Data Tree solution would be much more elegant, but i ended using your List<Curve> idea. It works great. Thank you.

M

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service