12 Replies Latest reply: Feb 13, 2015 8:26 AM by mengw73493206 RSS

    Link Tool in 3D PDF - possible?

    andspence Community Member

      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.

      screenshot-3D.jpg

      BTW, I am running Windows 7 64-bit, and Adobe Acrobat 9 Pro Extended Version 9.4.1

        • 1. Re: Link Tool in 3D PDF - possible?
          Yuri Kovalev Community Member

          You must use mouse_event_handler.

          • 2. Re: Link Tool in 3D PDF - possible?
            PeterKorz

            Hi,

             

            i have the same problem.

            Did you solve it ?

            • 3. Re: Link Tool in 3D PDF - possible?
              andspence Community Member

              @PeterKorz - No I never really came up with a solution.  What have you tried?

              • 4. Re: Link Tool in 3D PDF - possible?
                PeterKorz Community Member

                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.

                • 5. Re: Link Tool in 3D PDF - possible?
                  andspence Community Member

                  We are in the EXACT same boat.  I am a mechanical engineer for industrial automation equipment.  Technical publications have been placed in my department, so that is why I am investigating this.

                  • 6. Re: Link Tool in 3D PDF - possible?
                    Dave Merchant ACP/MVPs

                    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.

                    • 7. Re: Link Tool in 3D PDF - possible?
                      PeterKorz Community Member

                      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.

                      • 8. Re: Link Tool in 3D PDF - possible?
                        Dave Merchant ACP/MVPs

                        You need to use host.mydocumentFunction()

                         

                        The double-click mouse event handler doesn't work, sorry.

                        • 9. Re: Link Tool in 3D PDF - possible?
                          mengw73493206 Community Member

                          how do you make different meshes to open different pdf, for example, there is a ball and a box in the 3D scene, when you click on the ball, it opens a new PDF, and if the box is clicked, another pdf will be open.

                          • 10. Re: Link Tool in 3D PDF - possible?
                            Dave Merchant ACP/MVPs

                            You would use the name of the mesh to decide what action to take (see line 8 in my code example from reply #6).

                            • 11. Re: Link Tool in 3D PDF - possible?
                              mengw73493206 Community Member

                              Thanks Dave, I am no programmer, I am new to this thing, trying to learn, I suppose you use this host.mydocumentFunction() to call the open file action? can you point me to the right direction to find resources on how to use this funct. or example codes? all I have is the API reference found in the adobe's site.

                              • 12. Re: Link Tool in 3D PDF - possible?
                                mengw73493206 Community Member

                                Here is the working code:

                                 

                                 

                                runtime.overrideSelection = false; // 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);

                                  switch (myMesh.name) {

                                  case "Box":

                                  host.app.openDoc("Box.pdf");

                                  break;

                                  case "Ball":

                                  host.app.openDoc("Ball.pdf");

                                  break;

                                   }

                                              } 

                                     } 

                                var mouseEventHandler = new MouseEventHandler(); 

                                mouseEventHandler.onMouseDown = false; 

                                mouseEventHandler.onMouseMove = false; 

                                mouseEventHandler.onMouseUp = true; 

                                mouseEventHandler.onEvent = myMouseHandler; 

                                runtime.addEventHandler( mouseEventHandler );