Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add Multiple Hyperlinks via lisp on AutoCAD objects

3 REPLIES 3
Reply
Message 1 of 4
mdhutchinson
1692 Views, 3 Replies

Add Multiple Hyperlinks via lisp on AutoCAD objects

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 "}")
            )
         )
         
      )
     )
 )
)

3 REPLIES 3
Message 2 of 4
_Tharwat
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)
)

 

Message 3 of 4
mdhutchinson
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).

Message 4 of 4
pbejse
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

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost