These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Select nodes in 3D programatically

itsraghuin
itsraghuin's picture
Registered: Sep 8 2009
Posts: 18
Answered

Is there a way to select nodes in 3D programatically? I tried to use scene.selectedNode but I don't see anything in 3D area selected.

UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
Yes, and that method does work - but you have to pass it a mesh object collected from the scene list.

Example: scene contains a node called "box1"... attach this script to the 3D annotation:

[b]var boxmesh = scene.meshes.getByName("box1");
scene.selectedNode = boxmesh;[/b]


Note that disabling the default selection tool behavior doesn't stop you using the above method to select a node, and it still gets a highlight and bounding box.
itsraghuin
itsraghuin's picture
Registered: Sep 8 2009
Posts: 18
Thanks UVSAR! It helped. I was using it with node object. Another question though would be how do I unselect it? I mean when I select a node and then click on 3D area, the selection is lost. How do I do this using JavaScript?
UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
To clear the selection via JS, set it back to being undefined (which in JS is a real object)

[b]scene.selectedNode=undefined;[/b]

To prevent the mouse clicks from selecting things in the scene, override the default tool events:

[b]runtime.overrideSelection = true;[/b]