algorithmic modeling for Rhino
Have a look a this thread over on the Rhino.Python forum for how to build DataTrees, and, this thread for how to read them. Hope that helps..
Thanks! I'm still having trouble with the lists-of-lists thing. It returns IronPython.Runtime.List
But I came up with a funky solution for this. Two GhPython Components! See attached.
Also includes some unPickling.
Ideally I want to be able to send it a fairly complicated list of of lists of lists... Turtles all the way down.
Hi Chris,
For some reason I can't seem to download your files. However check out the attached file, it might help. The Python component uses two functions: One which converts a GH DataTree to a nested Python list and one which does the opposite. As far as doing lists of lists of lists, I'm pretty sure that this type of data processing won't be possible using Grasshopper DataTrees as they only allow one level of nesting (as far as I know?). But hey, that's where scripting components comes into play right :)
I've heard of pickling and unpickling before, but never really got around to looking into it. Would you mind giving me a brief description of what you might use it for?
Best,
Anders
Here's your file using what I was saying above. I didn't check your data so if it goes beyond one level of nesting it won't be correct. Hope that helps.
Okay. Yes. This looks awesome. Much more elegant and less crazy.
I think you have to right click on the txt file and "Save link as...". Inside, you will find some weird looking text. That's the pickled data. It's just Python data encoded in a way that Python can read the file later and unpickle it into Python-readable objects. I'm doing numbers, but you could also use geometry. You could have a pretty elaborate structure. At least until you want Grasshopper to read it. ;)
I am using it to store some relationships about objects from a straight python script I wrote outside of Grasshopper, just in Rhino, where I can do more things. Then I need Grasshopper for visualizing the relationships I've mapped in Python. Hence all the pickle juice.
I think it was actually just my internet that crapped out! Ah I see, so pickling is for serializing Python objects. I usually just store/pass around data using basic text files (txt or sv). So this might come in handy, thanks for the notes :)
Hi, the first link is not working anymore. i have same problem. How to make data tree with numbers or strings? DataTree[Rhino.Geometry.Point]() ?thanks
Thanks! These are great building blocks.
Really helpful, tks
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by