Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sweet!
I'll try it out soon and let you know how it goes!
Right now, I'm thinking of starting my weekend early, so it might not be until Monday that I check it out.
thanks for the code, I'm sure I will get it to work.
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I tried it out this morning....the program works using my drawing list, however it is not deleting the existing hyperlinks.
Have you tested that part out? As an example, make a small drawing list with values, then change it and rerun the program.
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Of course I did, ![]()
granting the attribute a "clean" one or just one count of hyperlink , tell you what
(defun c:givemethecount nil (vl-load-com) (print (vla-get-count (vla-get-hyperlinks (vlax-ename->vla-object (car (nentsel)))))) (princ) )
Hit the attribute with this one and tell me what it says
or better yet.. post the drawing in here
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
oops. ![]()
my bad
I think i know what happen.
Change this
(strcat (cadr hpt) (car hpt) "*.dwg)
to
(strcat (cadr hpt) (car hpt) ".dwg")
with the code before when you pick the attribute with givethepath thingy. i would show you a string with filename *.dwg
If by somehow you get a value more that 1 with givemethecount, i think i have an idea how to fix that
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
It is still not replacing the existing hyperlinks. This means if a drawing reference changes, it will still point to the prior hyperlink. hmmmm.....
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I ran that program. The count is 5. There must be some links ontop each other.
It can erase all hyperlinks for the matching attribute. That would be fine with me.
Also, if the attribute has no value, the hyperlink should be erased. (that way if a reference is removed, the hyperlink will go away).
attached is the sample drawing.
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Got the file, tested it a dozen times for you
(defun c:HyperL (/ blks dwglist str nw_lst blk hpt htp)
(vl-load-com)
(if (setq blks (ssget '((0 . "INSERT") (66 . 1))))
(progn
(setq DWGLST (open "c:/scripts/drawings/dwglst.txt" "r"))
(while (setq str (read-line DWGLST))
(if (not (eq str "EOF"))
(setq nw_lst (cons (list (strcase str) (read-line DWGLST)) nw_lst))))
(close Dwglst)
(while (setq blk (ssname blks (setq cntr (1+ cntr))))
(foreach
at_str (vlax-invoke
(vlax-ename->vla-object blk)
'GetAttributes)
(if
(setq hpt (assoc (strcase (vla-get-textstring at_str)) nw_lst))
(progn
(if (> (vla-get-count
(setq htp (vla-get-hyperlinks at_str)))
0)
(vlax-for cn htp
(vla-delete cn))) ;if Hyperlink Exist
(vla-add
(vla-get-hyperlinks at_str)
(strcat (cadr hpt) (car hpt) ".dwg")
"File Hyperlink"))) ;if
);foreach
);while
);progn
);if ssget
(princ))
I think now its all good ![]()
Re: using Lisp to add a hyperlink to a specific attribute
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
![]()
That did it!!!! I just need to modify it, so it will simply make a selection set of all symbols on the drawing (no picking required).
This is something I'll work on in the next week. It is the least I can do.
Very nice so far!
How to add filepath in the cad drawing attribute using lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
How to add filepath in the cad drawing attribute using lisp ?
Can anyone help me in this?
Re: How to add filepath in the cad drawing attribute using lisp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You mean the path of the current drawing?
(defun c:AddPrefix (/ String)
(vl-load-com)
(cond (
(and
(setq sTring (car (nentsel "\nSelect Attribute:")))
(eq (cdr (assoc 0 (entget String))) "ATTRIB")
(vla-put-textstring
(vlax-ename->vla-object String)
(strcat
(getvar 'Dwgprefix)
(vla-get-textstring (vlax-ename->vla-object String)))))
)
)
)Hope this helps
You need to invoke regen


