Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
H3D.org Feeds


Browsing this Thread:   1 Anonymous Users






Remove a node from python
#1
Not too shy to talk
Not too shy to talk


See User information
hey,

In our program we created a bunch spheres using createX3DNodeFromString (very similar to the code in spheres.py ) and we're using them as markers for touched points on another object. I'm trying to write python method that removes all the spheres. Does anyone have an example of removing nodes like this?

Thanks
Bryan

Posted on: 2008/10/3 4:15
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove a node from python
#2
Webmaster
Webmaster


See User information
The best and easiest way I could think of would be to add all spheres to the same group node and simply clear the children field of that group node when you are done with the spheres.

If they are not added to the scene graph in this way then the problem is a bit harder. I think you could write some kind of "scene graph traversal" and have a matching function to find your spheres (or the shape in which the spheres are) and then erase them from the children field of the parent to the shape. Remember that X3D is a directed scene graph so you would have to keep track of parents yourself, there is no field in any node that will give you the parent node.

Posted on: 2008/10/6 8:23
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove a node from python
#3
Not too shy to talk
Not too shy to talk


See User information
Thanks a lot i am still trying to learn a lot of this stuff and this forum is very helpful
Bryan

Posted on: 2008/10/9 1:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove a node from python
#4
Just popping in
Just popping in


See User information
HI,

How do you clear the children field of the group?

Posted on: 8/8 22:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove a node from python
#5
Webmaster
Webmaster


See User information
Hello,

If you have a reference to the group node in python and that reference is named g then simply do:
g.children.clear()

Posted on: 8/9 7:38
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top


Re: Remove a node from python
#6
Just popping in
Just popping in


See User information
Thank you so much

Posted on: 8/9 19:12
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong Top







You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create pdf.
You cannot get print page.

[Advanced Search]





(C) 2012 SenseGraphics AB    ---    Powered by XOOPS