I think I already have this question answered for myself (I think the answer is no), but I wanted confirmation from more experienced users than myself.
Is it possible to use the link tool in a 3D pdf? I have successfully linked to a 3D pdf, but I would like the ability to link from the 3D pdf to elsewhere in the document - or possible to activate a javascript command.
Here's what I have - screenshot below - a 3D pdf of a machine. I would like the ability to have the end-users of this machine, look at this PDF, click on a specific part (either in the model or from the tree on the left) and either take them to a detail drawing of the part - or initiate a "mailto". The goal here is to make it easier for customers to identify and order replacement parts.
BTW, I am running Windows 7 64-bit, and Adobe Acrobat 9 Pro Extended Version 9.4.1
I do not have a solution. But i´m working on. I want to have a online documentation for the endusers as well as a online ordering system. But i´m a mechanical designer, not a software developer.
I also tried some professional help, but they don´t want or have no time. Now my daughter, which is a software developer, will support me. But she is young and just finished her study.
To detect a selection in the 3D scene itself you must capture the mouse click and analyze if there is anything underneath it (there may be nothing, there may be a stack of meshes).
Foe example, add this JS code to your 3D scene (place it in a .js file and add it using the Advanced Properties panel for the 3D annotation) - it pops an alert with the name of the mesh, but you can easily change it to open a URL by calling host.app.launchURL() instead.
runtime.overrideSelection = true; // optional line to disable the default red highlight
var myMouseHandler = function( event ) {
if ( event.isMouseUp ) {
var myMesh = null;
if ( event.hits.length > 0 ) myMesh = event.hits[0].target;
if ( myMesh != null ) {
host.app.alert("You clicked on " + myMesh.name);
}
}
}
var mouseEventHandler = new MouseEventHandler();
mouseEventHandler.onMouseDown = false;
mouseEventHandler.onMouseMove = false;
mouseEventHandler.onMouseUp = true;
mouseEventHandler.onEvent = myMouseHandler;
runtime.addEventHandler( mouseEventHandler );
Note that you can check for a double-click via the event.isDoubleClick property.
thanks a lot. I have added this JavaScript with rigthclick -> Properties -> 3D -> Script and it works.
But running this with doubleClick does not work:
runtime.overrideSelection = false; // optional line to disable the default red highlight
var myMouseHandler = function( event ) {
if ( event.isDoubleClick ) {
var myMesh = null;
if ( event.hits.length > 0 ) myMesh = event.hits[0].target;
if ( myMesh != null ) {
host.app.alert("You clicked on " + myMesh.name);
}
}
}
var mouseEventHandler = new MouseEventHandler();
mouseEventHandler.onMouseDown = false;
mouseEventHandler.onMouseMove = false;
mouseEventHandler.onMouseDoubleClick = true;
mouseEventHandler.onEvent = myMouseHandler;
runtime.addEventHandler( mouseEventHandler );
And is it possible to access from this JavaScript a function of the document-JavaScript?
I tried to call the function like:
runtime.overrideSelection = true; // optional line to disable the default red highlight
var myMouseHandler = function( event ) {
if ( event.isMouseUp ) {
var myMesh = null;
if ( event.hits.length > 0 ) myMesh = event.hits[0].target;
if ( myMesh != null ) {
host.app.alert("You clicked on " + myMesh.name);
mydocumentFunction();
}
}
}
var mouseEventHandler = new MouseEventHandler();
mouseEventHandler.onMouseDown = false;
mouseEventHandler.onMouseMove = false;
mouseEventHandler.onMouseUp = true;
mouseEventHandler.onEvent = myMouseHandler;
runtime.addEventHandler( mouseEventHandler );
but this does not work.
Calling a document-JavaScript function from a button works with mydocumentFunction(); but not
out of the JavaScript from the 3D scene.
North America
Europe, Middle East and Africa
Asia Pacific