Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Mentor
mdhutchinson
Posts: 2,291
Registered: ‎11-18-2003
Message 1 of 4 (602 Views)

Add Multiple Hyperlinks via lisp on AutoCAD objects

602 Views, 3 Replies
01-11-2013 10:02 AM

The below adds a hyperlink to the selected object.

How might it have to change to add multiple hyperlinks?

 

(entmod
 (append (entget (car (entsel)))
     (list
      (list -3
         (cons "PE_URL"
            (list
             (cons 1000 "..\\..\\90 Submittals\\90-3 O&Ms\\fig83-clevishanger.pdf") ; Relative Path to a pdf file.
             (cons 1002 "{")
             (cons 1000 "fig83-clevishanger.pdf"); Tooltip
             (cons 1002 "}")
            )
         )
         
      )
     )
 )
)

Distinguished Mentor
_Tharwat
Posts: 600
Registered: ‎07-02-2010
Message 2 of 4 (586 Views)

Re: Add Multiple Hyperlinks via lisp on AutoCAD objects

01-11-2013 12:34 PM in reply to: mdhutchinson

Maybe this .....

 

 

(if (setq ss (ssget "_:L"))
  (repeat (setq i (sslength ss))
    (setq sn (ssname ss (setq i (1- i))))
    (entmod
      (append
        (entget sn)
        (list
          (list
            -3
            (cons
              "PE_URL"
              (list
                (cons
                  1000
                  "..\\..\\90 Submittals\\90-3 O&Ms\\fig83-clevishanger.pdf"
                )                       ; Relative Path to a pdf file.
                (cons 1002 "{")
                (cons 1000 "fig83-clevishanger.pdf") ; Tooltip
                (cons 1002 "}")
              )
            )

          )
        )
      )
    )
  )
  (princ)
)

 

____________________________________________________
Get learn and learn and practice , to become experienced guy .
Valued Mentor
mdhutchinson
Posts: 2,291
Registered: ‎11-18-2003
Message 3 of 4 (583 Views)

Re: Add Multiple Hyperlinks via lisp on AutoCAD objects

01-11-2013 12:38 PM in reply to: _Tharwat

oops... I didn't make myself clear.

What I was hoping for was to attach multiple hyperlinks to the same object... such that when you right click on the object you would see multiple hyperlinks with each link going to a different object (pdf file, word doc, excel file, etc).

*Expert Elite*
pbejse
Posts: 2,462
Registered: ‎11-24-2009
Message 4 of 4 (560 Views)

Re: Add Multiple Hyperlinks via lisp on AutoCAD objects

01-12-2013 08:43 AM in reply to: mdhutchinson

mdhutchinson wrote:

What I was hoping for was to attach multiple hyperlinks to the same object... such that when you right click on the object you would see multiple hyperlinks with each link going to a different object (pdf file, word doc, excel file, etc).


 

To date, i only worked on hyperlink with lisp code just once  and i'm not even sure you can assign mulitple HPlinks on a single object. thats why in the past i suggested to use a block and run a routine similar  to this :

 

(defun c:goto ( / tmp hp filetype URL)
 (cond ((and
          (setq tmp (vlax-ename->vla-object (Car (nentsel))))
 	  (> (vla-get-count (setq hp (vla-get-hyperlinks tmp ))) 0)
	  (setq filetype (last (fnsplitl (setq URL (vla-get-URL  (vla-item hp 0))))))
          (setq appfor (assoc filetype
                              '((".LSP" "NOTEPAD");| other file type and their apps"|;)))
      	  (startapp (cadr appfor) URL))
        )
       )
  )

 

It wont be like a the usual Hyperlink wherein you do a mouse-over to know which objects has a HP. but it works nonetheless 

 

So i guess , with the same line of reasoning you can assign multiple HP on an object granting its a block

 

 

HTH

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.