algorithmic modeling for Rhino
Hi.
Somehow my GH.Python editor does not show the pop-up help functions for my datatrees anymore. Can i see the functions/attributes some other way? I only remember "Tree.Branches", "Tree.Branchcount" etc. But is there an attribute to remove a branch from a tree? Like with list.pop(i)?
Cheers Rasmus
Tags:
Hi Rasmus,
Yes that's really annoying. Happens whenever one types outside of the main scope it seems! There are two really useful Python commands which can help you a lot when figuring out which methods or attributes an item has, what's in a namespace and so on:
help(itemToCheck)
So if you have a GH datatree called myTree, you would go:
print dir(myTree)
print help(myTree)
Hope that helps.
/Anders
Hi Anders.
Thanks. Yeah it is pretty annoying. I haven't been able to find out when it happens yet. Cause sometimes it comes back. But I'll try and remember about the main scope.
Thanks for the advice. That is a great help.
Ps. another topic: do you know if it is possible to keep the path structure of a data tree when doing list operations within each branch?
Say cull list within a tree. If I have a tree[{4};{5};{6}], then after cull or similar operations I get tree[{0;1},{0;2}, {0;3}].
I can fix it with a pathMapper, but it would be nice I i didn't have to.
Do you mean if you are operating on datatrees within a Python component? If so I think it would need some example file to better understand what's going on. In general I would advice you to stick to using Python lists in your classes and defs within the Python script. Then, if you need it, you can write some small utility scripts to convert a GH Datatree to a nested Python list and back again for the input/output of the component.
I have also been trying to find out how to remove a branch from a tree, similar to list.pop(i). or del list[i];
-thanks
You can use the RemovePath() method. See attached file. Hope that helps..
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