AutoLISP to list Hyperlinks?

Discussion in 'AutoCAD' started by Chris Lovelock, Jul 26, 2004.

  1. Anyone got any code that will list an objects hyperlink description and
    address?

    I've been messing with...

    (vl-load-com)
    (setq ent (car (entsel "\nSelect Object: ")))
    (setq
    obj (vlax-ename->vla-object ent)
    hyprlnk (vlax-get-property obj 'Hyperlinks)
    )

    ....but the resulting "#<VLA-OBJECT IAcadHyperlinks 04faa8a4>" doesn't mean
    much to me!
     
    Chris Lovelock, Jul 26, 2004
    #1
  2. Chris Lovelock

    T.Willey Guest

    What happens when you dump that code like:
    (vlax-dump-object hyprlnk)
    I don't have any object with hyper links, but I would think this would give you a little more to go on.

    Tim
     
    T.Willey, Jul 26, 2004
    #2
  3. (vlax-for each hyprlnk
    (princ (vla-get-url each))
    )


    Look at URLDescription property also.

    --
    Ken Alexander
    Acad2004
    Windows XP

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein
     
    Ken Alexander, Jul 26, 2004
    #3
  4. Ken,

    Getting there...

    (vl-load-com)
    (setq ent (car (entsel "\nSelect Object: ")))
    (setq
    obj (vlax-ename->vla-object ent)
    hyprlnk (vlax-get-property obj 'Hyperlinks)
    )
    (vlax-for each hyprlnk
    (princ (vla-get-url each))
    )

    ...Returns the hyperlink for a line with a hyperlink attached to it. What it
    doesn't do, which I'm trying to do, is to get the hyperlinks within blocks.

    I'm going to do a little more digging.

    BTW I also found...

    (setq ent (car (entsel "\nSelect Object: ")))
    (setq entdata (entget ent '("PE_URL"))
    xd (cdr (assoc -3 entdata))
    xd (cdr (assoc "PE_URL" xd))
    $hyperlink (cdr (assoc 1000 xd))
    )

    ....again this doesn't get the hyperlinks from blocks.

    Thanks for the help.

    Cheers, Chris...
     
    Chris Lovelock, Jul 26, 2004
    #4
  5. Chris Lovelock

    T.Willey Guest

    Are you talking about getting the hyperlink of a line within a block? If so, try (nentsel.. instead of (entsel..

    Tim
     
    T.Willey, Jul 27, 2004
    #5
  6. Sussed it!

    (setq o (getstring "\nOutput .TXT File Name: "))
    (setq add (open (strcat o ".txt") "w"))

    (if (setq ss (ssget "x" '((0 . "insert"))))
    (progn
    (setq n (sslength ss))
    (while (> n 0)
    (setq n (- n 1)
    ent (ssname ss n)
    sub (entnext ent)
    )
    (while sub
    (setq entdata (entget sub '("PE_URL"))
    xd (cdr (assoc -3 entdata))
    xd (cdr (assoc "PE_URL" xd))
    $hyperlink (cdr (assoc 1000 xd))
    )
    (if $hyperlink
    (progn
    (setq blkn (cdr (assoc 2 (entget ent))))
    (princ blkn)
    (write-line (strcat blkn "," $hyperlink) add)
    )
    )
    (if (= (cdr (assoc 0 lis)) "SEQEND")
    (setq sub nil)
    (setq sub (entnext sub))
    )
    )
    )
    (close add)
    )
    )

    Cheers & thanks everyone who helped!

    Chris

    (time to sleep)

    so, try (nentsel.. instead of (entsel..
     
    Chris Lovelock, Jul 27, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.