Grasshopper

algorithmic modeling for Rhino

When I feed a list of list of points into GhPython, I find that the component detects what is being input, and will create the implied loops and output the result as a list of list of objects etc. They are "intelligent".

So my code in the GhPython is forced to operate on that sublist of points, rather than traverse the first list, then operate on that sublist of points. 

Can I remove this "intelligence" so I can just work with the raw data? 

Views: 1443

Replies to This Discussion

You shouldn't be handling GH_ObjectWrapper specifically, just IGH_Goo. If anybody outputs a type which implements IGH_Goo you can assign it directly to the output parameter without having to test to see if it is a collection or a tree.

GH_ObjectWrapper is just a class that allows you to turn whatever you want into IGH_Goo.

--

David Rutten

david@mcneel.com

Hey guys, I'm about to test this out, and see how it goes.

Thanks for the advice. I think in most cases you are correct, it is better to just use the simplest access type. The reason I'm asking is that (as in the example I've uploaded above) right now I can only work with L[0] in the ghpython editor. (Given L = [[x1,x2,x3],[y1,y2,y3]...]). It won't let me see/access L[1] although I understand that any code I write will work on L[1]. So in a situation where L[0] is a list of null values, and I need to write code that works with the values in L[1] - I'm essentially writing code blind. 

Hope that makes sense. Now I will test David's suggestion.

Saeran

Hey Saeran,

I don't know if you are still planning to work directly with the trees but a while ago I wrote a couple of things in scripting components which modified a tree based on the contents of the tree. They are in VB.net but, if you treat it like pseudo code, it should point you in the right direction. I'll try to dig them out today.

Dieter

Hey Dieter!

Yeah I'd be interested in looking at it. Never used VB.net but I feel like I'd be able to figure it out. Send it over. 

Thanks,

Saeran

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service