* Sorry for the last mail I accidentally pressed send button (I wanted to use the tab key to move some text but is went to the send button). Question: But what happen if the Scene is live and the capability of the Shpe3D is not set to ALLOW_GEOMETRY_READ. How can you get the Geometry now, because you can not set capability of a live or compiled objects. I will very happy if some one can help me on this I been on the same problem for the past 4 weeks. If you want to see my code plese mail me Thanks, Bye. On Mon, 10 Jan 2000 08:25:01 -0800, Decker, Scott D <[EMAIL PROTECTED]> wrote: >Well, if you have the shape DEF'd in the vrml file, it will be easier =) > >Let us say that the DEF'd object's name is CubeShape > >do >Hashtable hash = Scene.getNamedObjects(); > >Object rootObj = hash.get("CubeShape"); > >//now you must start doing some testing >//usually the rootObj will be a branchgroup, test it first > >if (rootObj instanceof BranchGroup){ > BranchGroup bgRoot = (BranchGroup)objRoot; > > //next, the next child is usually a transform group, but again, > //it could also be the shape right underneath it > > Object childObject = bgRoot.getChild(0); > if (childObject instanceof TransformGroup){ > TransformGroup tgRoot = (TransformGroup)childObject; > //now, again, the next item should be the child > Object tmpObject = tgRoot.getChild(0); > > if (shapeObject instanceof Shape3D){ > Shape3D shapeObject = (Shape3D)tmpObject; > > //now get the geometry > Geometry geomShape = shapeObject.getGeometry(); > //yeah, you now have the geometry > } > } >} > >now, the problem here is that, you never know if the child to parent >relationships are going to be like this. You could use Daniel Selman's tree >object, load up the vrml object, see how the tree structure looks to get to your >vrml shape, and then write the code to get to it. Or, you could do almost >exactly what he did in code and just build tree traversers, so you get the main >object from the hashtable, then start testing to see if it is a shape3D. If it >isn't cast it to it's object type, then get all of it's children and go >recursively through them until you find a shape3d. Once you find the shape3d you >can get the geometry. > >Hope that helps >Scott > > >Scott Decker >Research Scientist >Pacific Northwest National Labs >[EMAIL PROTECTED] >please feed the squirrels =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
Re: [JAVA3D] getting shape from vrml and finding the points
SUBSCRIBE JAVA3D-INTEREST Nazrul Wed, 12 Jan 2000 18:26:07 -0800
- Re: [JAVA3D] getting shape from vrml and ... Decker, Scott D
- Re: [JAVA3D] getting shape from vrml... Decker, Scott D
- Re: [JAVA3D] getting shape from vrml... SUBSCRIBE JAVA3D-INTEREST Nazrul
- Re: [JAVA3D] getting shape from ... Dean Keeler
- Re: [JAVA3D] getting shape f... Daniel Selman
- SUBSCRIBE JAVA3D-INTEREST Nazrul