algorithmic modeling for Rhino
I want to add the text "graph one" to a datatree which I am outputting from a panel.
The code I am using to output this data is below.
load_Profileout.AddRange('Graph one',gh.Kernel.Data.GH_Path(0))
The issue as you can see is that I want graph one in element 0 of this list not spread over 8 elements like you can see in the picture below.
How do I do this?
Tags:
Hi Anton,
AddRange method requires a list of data for its first argument. So when you supplied your "Graph one" string, it took on of each of these and aligned it, as they are separate items (because a it's a list of characters).
Enclose your string in a list:
load_Profileout.AddRange(['Graph one'],gh.Kernel.Data.GH_Path(0))
Please attach your .gh/.3dm files next time.
Djordjie,
Thanks again for being so helpful after your comment I now understand what it means in the Grasshopper SDK that DataTree(t).AddRange method is takes an IEnumerable: it will iterate over every in the method.
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