attaching hyperlinks to object.

Nauman M

Usenet Archive
Joined
Aug 11, 2003
Messages
9
Reaction score
0
I did a search but could not find my answer. I would appreciate if someone can show me how to attach a URL and the URLdescription to an MTEXT object, or any object as most all abjects have the hyperlink property. I am having some issues trying to do it via vlisp.
thanks

(setq obj (nm_ent2vla (entlast))
(setq hyprlnkobj (vlax-get-property obj 'Hyperlinks))

after that I cannot figure out how to add a URLdescription and the link.
thanks
 
This should get you started:

(defun setHype (/ obj hStr objLinks)
(setq obj
(vlax-ename->vla-object
(car
(entsel "\nSelect object to attach Hyperlink: ")))
hStr (getstring t "\nEnter hyperlink: ")
objLinks (vla-get-hyperlinks obj)
)
(vla-add objLinks hStr)
)

HTH,
Jeff
 
thanks for your replies, check whether I am not doing something wrong.

this is what I came up with
(setq pathurl (strcat (getvar "dwgprefix") "keynotes.txt")) (setq mtextobj (nm_ent2vla (entlast)) ;;get the reference to the Hyperlinks object (setq hyprlnkobj (vlax-get-property mtextobj 'Hyperlinks)) ;now add the Hyperlink URL. if the count is 0 it will automatically create one (vlax-invoke-method hyprlnkobj 'Add.Hyperlinks pathurl) ;;get the first hyperlink object ; number of hyperlinks ;; (vlax-get-property hyprlnk 'Count) ;;since I am creating the object new, I dont have to worry about count being more than 0. ;get the first hyperlinkobject (setq hyprlink1 (vla-item hyprlnkobj 0)) ;;now put the URLdescription in the (vlax-put-property hyprlink1 'URLDescription leadertext)

;;release the objects
(mapcar 'vlax-release-object (list mtextobj hyprlnkobj hyprlink1))
 
(setq newlink "MyURLlink")
(setq ent (car (entsel)))
(setq obj (vlax-ename->vla-object ent))
(setq hy (vlax-get-property obj 'hyperlinks))
(vlax-invoke-method hy 'Add newlink )

This adds the URL needs some extra work to add the description.

Murph
 
see my post before yours.
(setq newlink "MyURLlink")
(setq ent (car (entsel)))
(setq obj (vlax-ename->vla-object ent))
(setq hy (vlax-get-property obj 'hyperlinks))
(vlax-invoke-method hy 'Add newlink )

This adds the URL needs some extra work to add the description.

Murph
 

Latest threads

Back
Top