algorithmic modeling for Rhino
I'm Having a problem formatting the output of my Python Script. Below is a simplified example of what I want to accomplish vs the methods in Python I've tried. I am trying to split each item in the general list into 3 items within a branch. I've done some looking and it seems like I need to use the datatree class but I can't figure out how in pyton rather than vb or c. Does anyone now how to do this? Or another method that would work?
Thanks in advance,
Zach
Tags:
Hi Zachary,
it's probably simpler than you'd expect it to be, because the component should already be able to handle the iteration logic internally. If you anyways what to access y as list, you can still output DataTrees. This needs a little extra work, though.
On another note, please remember that string entities are immutable in Python (just as in .Net). This means that you will not be able to modify an instance, but just assign a new instance to the same variable...
my_string.Split(",") # this does nothing to my_string
my_split_strings = my_string.Split(",") # actually something happens here
See here for more info on the topic.
I hope this helps,
- Giulio
_______________
giulio@mcneel.com
McNeel Europe
I am no longer the maintainer of the GhPython project but here is an update for Gh 0.9 and GhPython addon 0.5.1.
Thanks for the Response Giulio and the great explanation. I will try it out tonight on the complex version and let you know. It looks like it should work perfectly.
Thanks again,
Zach
Giulio, It worked great! However I am having issues with maintaining dataTree branch index's from inputs to the output. Is there any documentation out there that explains in general how to use dataTrees in Python?
Thanks again for your help,
Zach
The documentation is the Grasshopper SDK help. You can download it using _GrasshopperGetSDKDocumentation Rhino command, after Grasshopper has loaded. There is also a menu entry: Help -> Download SDK Help. To set the path, you can use the GH_Path constructor with more than one input.
Or with an example maybe I can help.
- Giulio
_______________
giulio@mcneel.com
McNeel Europe
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by