Author Topic: Hyperlinks?  (Read 2325 times)

0 Members and 1 Guest are viewing this topic.

CHulse

  • Swamp Rat
  • Posts: 504
Hyperlinks?
« on: November 10, 2010, 06:51:37 AM »
Can y'all help me with this please? I would like to add a hyperlink to an object (block).
I found this in help, but have never understood how to translate this into lisp?

Quote
A URL and URL description.

VBA class name: AcadHyperlink
 
Create using: Hyperlinks.Add
 
Access via: Hyperlinks.Item
 

URL and URL descriptions are stored within the XData of their corresponding object. The Hyperlink objects themselves are not stored with the drawing. This means that every time you request the Hyperlink object for an object, a new Hyperlink object is created and the URL and URL description for that hyperlink is read out of the XData. Because of this, you should be careful to avoid creating multiple Hyperlink objects to reference the same URL information. Updating one of these Hyperlink objects would not update the second object.

To create a hyperlink use the Add method. To edit or query a hyperlink, use the following methods and properties:

Methods
     Delete   

Properties

     Application

     URL

     URLDescription

     URLNamedLocation 
 


I see how this works in VBA, but have no idea how to do the same thing in lisp. Please help

Thanks
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Hyperlinks?
« Reply #1 on: November 10, 2010, 08:11:05 AM »
As an example:

Code: [Select]
(defun c:test ( / e )
  (vl-load-com)

  (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"
      "Google"
    )
  )

  (princ)
)

The information for the hyperlink is stored in the XData of the object:

Code: [Select]
   (-3
      (
         "PE_URL"
         (1000 . "http://www.google.co.uk")
         (1002 . "{")
         (1000 . "Google")
         (1002 . "{")
         (1071 . 0)
         (1002 . "}")
         (1002 . "}")
      )
   )

I believe the argument order in the VLIDE Help files regarding adding the Hyperlink is incorrect, it should be:

Code: [Select]
(vla-Add <Hyperlinks Collection> <URL> <Description> <Name>)
« Last Edit: November 10, 2010, 08:17:04 AM by Lee Mac »

CHulse

  • Swamp Rat
  • Posts: 504
Re: Hyperlinks?
« Reply #2 on: November 10, 2010, 08:33:17 AM »
Thanks Lee, I'll give that a try.

Nice new website by the way...
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Hyperlinks?
« Reply #3 on: November 10, 2010, 08:36:36 AM »
Thanks Cary, glad you like it  :-)

CHulse

  • Swamp Rat
  • Posts: 504
Re: Hyperlinks?
« Reply #4 on: November 10, 2010, 09:04:38 AM »
How might I go about adding a hyperlink to an attribute (in a field within an attribute)?

This is assuming it's not possible to add multiple hyperlinks to one block object...?
What I am trying to get is a link to 2 photos from a single block...
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Hyperlinks?
« Reply #5 on: November 10, 2010, 09:15:16 AM »
I suppose you could add the hyperlink to the Attribute itself, using nentsel... maybe someone else has a better idea  :|

CHulse

  • Swamp Rat
  • Posts: 504
Re: Hyperlinks?
« Reply #6 on: November 10, 2010, 10:17:31 AM »
I think what I will do is use your method to add a single link to the block itself, to the file folder where the pics are located instead of the actual picture files. This seems to be working. Thanks for all your help.
Cary Hulse
Urban Forestry Manager
Wetland Studies and Solutions

Civil 3D 2020 & 2023

GDF

  • Water Moccasin
  • Posts: 2081
Re: Hyperlinks?
« Reply #7 on: November 10, 2010, 10:30:26 AM »
Nice new website by the way...

Nice website Lee
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Hyperlinks?
« Reply #8 on: November 10, 2010, 11:11:53 AM »