It is currently 23 Apr 2014, 09:07

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Getting nodes in a ICEtree
PostPosted: 09 Jul 2012, 20:42 
Offline
Moderator
User avatar

Joined: 21 Jul 2010, 00:33
Posts: 583
Im trying to get get a collection of nodes in a ICEtree and look through them individually. I can get a collection with 4 items, but when I try to access the elements individually I get nothing... Any ideas?

Code:
oNode = xsi.Dictionary.GetObject("PolyIsland_Control.pointcloud.ICEtree")
oNode = oNode.NestedObjects
log(oNode.Count)


returns
Code:
# INFO : 4


Code:
oNode = xsi.Dictionary.GetObject("PolyIsland_Control.pointcloud.ICEtree")
oNode = oNode.NestedObjects
log(oNode.Item)


returns
Code:
# ERROR : Traceback (most recent call last):
#   File "<Script Block >", line 9, in <module>
#     log(oNode.Item(1))
# TypeError: 'NoneType' object is not callable
#  - [line 9]

_________________
Gustavo Eggert Boehs
Blog: http://www.gustavoeb.com.br/blog | Training: http://gustavoeb.com.br/blog/?cat=16&lang=en_us


Top
 Profile  
 
 Post subject: Re: Getting nodes in a ICEtree
PostPosted: 09 Jul 2012, 21:08 
Offline
User avatar

Joined: 09 Jun 2009, 11:02
Posts: 677
Location: Montreal Canada
I would use ICETree.Nodes

_________________
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage


Top
 Profile  
 
 Post subject: Re: Getting nodes in a ICEtree
PostPosted: 09 Jul 2012, 21:31 
Offline
User avatar

Joined: 09 Jun 2009, 11:02
Posts: 677
Location: Montreal Canada
And to access the actual NestedObjects of an ICETree, don't use the Item method.

Code:
from sipyutils import si         # win32com.client.Dispatch('XSI.Application')
from sipyutils import log      # LogMessage

si = si()

n = si.Dictionary.GetObject( "pointcloud.pointcloud.ICETree" )

x = n.NestedObjects.Item
log( x )
# INFO : None

x = n.NestedObjects( 0 )
log( x )
# INFO : pointcloud.pointcloud.ICETree.Name

for x in n.NestedObjects:
   log( x )
# INFO : pointcloud.pointcloud.ICETree.Name
# INFO : pointcloud.pointcloud.ICETree.DescendantNodes
# INFO : pointcloud.pointcloud.ICETree.port1



In Python, we often avoid using Item.

_________________
// Steve Blair
// "You're not a runner, you're just a guy who runs" -- my wife
//
// My Blogs: Arnold | Softimage


Top
 Profile  
 
 Post subject: Re: Getting nodes in a ICEtree
PostPosted: 09 Jul 2012, 21:51 
Offline
Moderator
User avatar

Joined: 21 Jul 2010, 00:33
Posts: 583
Thank you very much Stephen!

IT WORKS!

_________________
Gustavo Eggert Boehs
Blog: http://www.gustavoeb.com.br/blog | Training: http://gustavoeb.com.br/blog/?cat=16&lang=en_us


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group