hmmm.. toughy.
Are the branch groups above it allowed to be detached?
then you could detach the BranchGroup, and then look at the geometry, because it
is no longer live.
Now, I am not sure about this, but (maybe others could help on this one) can you
stop the view, and does that make the scene not live?
So,
View.stopView()
check geometry
View.startView();
Other than that, well.. You might be out of luck trying to find the geometry.
Scott
-----Original Message-----
From: SUBSCRIBE JAVA3D-INTEREST Nazrul [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 12, 2000 11:47 AM
To: [EMAIL PROTECTED]; Decker, Scott D
Subject: Re: getting shape from vrml and finding the points
* 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".