Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

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

Add Multiple Hyperlinks via lisp on AutoCAD objects

674 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: 643
Registered: ‎07-02-2010
Message 2 of 4 (658 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,321
Registered: ‎11-18-2003
Message 3 of 4 (655 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,511
Registered: ‎11-24-2009
Message 4 of 4 (632 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

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.