13 Replies Latest reply on Apr 15, 2016 6:47 AM by EtsGrenier

    Link Tool in 3D PDF - possible?

    andspence Level 1

      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

          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 Level 1

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

              • 4. Re: Link Tool in 3D PDF - possible?
                PeterKorz Level 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.

                • 5. Re: Link Tool in 3D PDF - possible?
                  andspence Level 1

                  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 MVP & Adobe Community Professional

                    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 Level 1

                      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 MVP & Adobe Community Professional

                        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

                          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 MVP & Adobe Community Professional

                            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 Level 1

                              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 Level 1

                                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 ); 

                                • 13. Re: Link Tool in 3D PDF - possible?
                                  EtsGrenier

                                  Hi mengw73493206 and Hi Dave,

                                   

                                  I know this thread is a bit on the old side, But I really need help... I'm really a begininer in the javascript world... and I need Help please...

                                   

                                  The thing is I've been able to use the working code of mengw73493206, and change the values for my project... At this point everything is working fine... when I click on specific part of my 3D a pdf file is open in a different window... But the problem is, I need to sent this file by email to some clients...and when I sent the file and/or somebody open it from another computer I got a message error in the debugger (Code: 24(0x18))... I know it's probably because the openDoc app is taking the file locally in my comptuer and when someone else open it from another computer the file isn't retracable... 

                                   

                                  I try to use the exportDataObject but I know too little about javascript to adequatly code this up....

                                   

                                  So please. help me on this....  If you cand give me a example of the code I need....

                                   

                                  P.S: It's not something I really need, but it would be pretty cool that if the pdf file that is open when I click on specific part of my 3D would open in a smaller window than the original file. 

                                   

                                  I'm waiting for your answer Dave and/or mengw73493206

                                   

                                  A big thanks in advance