WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Iterate through node3d children (https://forum.worldviz.com/showthread.php?t=2968)

migoloco 09-16-2010 08:23 AM

Iterate through node3d children
 
Is there any way to obtain the list of childs from a node3d object?

I have been trying to use list = .getChildren() to obtain such a list, as I need to attribute a value to each i in list.

On your documentation it clearly says that: "NOTE: This command does NOT return a list of the underlying scene graph nodes and does NOT create new Vizard node3d objects. It will only return existing node3d objects" ... but it never mentions how to actually do these things.

ideas?

Jeff 09-16-2010 04:37 PM

The command .getChildren() will return the list of children for an object that you have defined in the Vizard script. It will not return the list of sub-objects for that object as defined in the modeling software.

If you want to get a list with all sub-objects you could first get all the sub-object names and then use getChild() to get the handles to the sub-objects passing in their names. This prints out all sub-object names:
Code:

model = viz.add('gallery.ive')

for name in model.getNodeNames():
        print name


Renato Lima 09-22-2010 03:43 PM

Thank you, this solved my problem. And this is my new code:

for name in world.getNodeNames():
abc = world.getChild(str(name))
abc.appearance(viz.DECAL)


All times are GMT -7. The time now is 07:27 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC