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

Can I link parts in the model tree to datasheets (pdf)?

JChong
JChong's picture
Registered: May 25 2010
Posts: 2

Hi all,

I find 3D pdf extremely useful for my application. Is it possible to write a 'macro' to link parts in the model tree to their respective specification sheets (pdf) stored in a designated folder? Something like "right click" a part and select a "retrieve specification" option.

Thanks!
Jon

My Product Information:
Acrobat Pro 9.3.1, Windows
UVSAR
UVSAR's picture
Expert
Registered: Oct 29 2008
Posts: 1357
Yes and no - it's possible to use JavaScript to intercept mouse clicks within a 3D scene, and from the name of the "node" under the mouse to take some kind of action - including opening a new document - but you can't add your own context menus.

The JS code to intercept mouse clicks is a little bit complicated, so here's an example:

/* Example of how to capture the object a user clicks on from the 3D scene. The "hits" array sent by the mouse click event contains all the meshes underthe mouse cursor, starting with the one closest to the camera. In most cases

you will therefore only want the top one - hits[0].

 Note that if the handler is doing something in the PDF, it has to use "host"to talk to the main API - as shown in the "host.app.alert" lines below... */
  // first, stop the default select action (the thing that makes it run red) runtime.overrideSelection = true;   // now define a new mouse event handler function newMEH (e) {var clickedNode = null;//if (e.isMouseUp) var clickedNode = null;if (e.hits.length > 0) clickedNode = e.hits[0].target;if (clickedNode != null) {// do whatever you want with the info... for examplehost.app.alert ("You clicked on: " + clickedNode.name,3);} else {// Nothing found under the cursor locationhost.app.alert ("You clicked on nothing!",3);}}   // Now register our event handler, in this example just for mouse up events var myEH = new MouseEventHandler();myEH.onMouseUp = true;myEH.onMouseDown = false;myEH.onMouseMove = false;myEH.onEvent = newMEH;runtime.addEventHandler( myEH );

Attach this script to your 3D annotation.