Jump to content

seturl and geturl (Autocad 2006)


svorgodne

Recommended Posts

Can anybody please explain me what are the seturl and geturl "commands", "system variables", "autolisp function" or whatever they may be and how can I use them in Autolisp? If possible.

 

Thanks a lot in advance

Link to comment
Share on other sites

I'm glad you asked this question, as I can really use these. :beer:

 

Here's what I found (so far):

 

...

 

SETURL

 

Two handy functions when working with URLs and lisp are seturl and geturl.

(SETURL ename "URL string")   

The SETURL function expects two variables: the entity name and the URL string. Example:

(seturl (car (entsel)) "http:/www.autodesk.com")   

This example prompts the user to select an object. Once the object is selected' date=' the URL string is attached to that object.[/size']

 

GETURL

 

The counterpart to seturl is geturl.

(GETURL ename)   

The GETURL function expects one variable -- the entity name. GETURL returns the URL string from an entity. If no URL string is found, it returns nil. Example:

(geturl (car (entsel)))   

This example prompts the user to select an object. Once the object is selected, the URL string is displayed back to the user. If there is no URL string associated with the selected object, nothing happens.

 

...

 

linky (scroll down)

Link to comment
Share on other sites

These are merely the Vanilla AutoLISP equivalents of adding hyperlinks to the Hyperlinks Collection of an Object, except that you cannot add a Description or NamedLocation using these functions like you can with the Hyperlinks Collection.

 

Note also that the VL Hyperlinks collection is equivalent to, in Vanilla AutoLISP, xData (App: "PE_URL") appended to the entity - so this could be added using entmod.

 

Example, compare the entity DXF data (maybe using this) after using each of these functions:

 

(defun c:test1 ( / e )
   (if (setq e (car (entsel "\nSelect Object to Add Hyperlink to: ")))
       (seturl e "http://www.google.co.uk")
   )
   (princ)
)

(defun c:test2 ( / e )
   (if (setq e (car (entsel "\nSelect Object to Add Hyperlink to: ")))
       (vla-add (vla-get-hyperlinks (vlax-ename->vla-object e)) "http://www.google.co.uk")
   )
   (princ)
)

Link to comment
Share on other sites

I don't know why Autodesk perpetuates functionality of LISP functions that they ultimately UN-document. These functions WERE documented at one time... That's how I found the above information on my first Google search (top three results).

 

If they (Autodesk) have replaced these functions with newer 'more capable' functions, or simply made available the Hyperlinks Collection, so be it.

 

Svorgodne posed a specific inquiry, and I was able to (I hope?) answer their question, and learned something new myself along the way. I'm not asking anyone to use these functions, nor did I claim that they were comparable to the VL functionality. As a matter of fact, I boldly called them 'nice'. That's it.

 

If someone has an issue with the failings of these functions, write a letter to Autodesk. Just saying.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...