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.
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.
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
I think i know what happen.
(strcat (cadr hpt) (car hpt) "*.dwg)
(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
It is still not replacing the existing hyperlinks. This means if a drawing reference changes, it will still point to the prior hyperlink. hmmmm.....
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.
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
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!
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
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.