Bulk Updating Hyperlinks

Bulk Updating Hyperlinks

nbrafford
Community Visitor Community Visitor
572 Views
5 Replies
Message 1 of 6

Bulk Updating Hyperlinks

nbrafford
Community Visitor
Community Visitor

I am trying to update the individual and distinct hyperlinks on 40-60 objects on about 15 different drawings. They all look to the T:\ drive and I need them looking to the C:\ drive in the file path.

 

I have tried creating a lsp to execute the drive letter change, but cannot get it functioning. 

 

Is there another way to do this? Or does anyone have a script for this that works?

0 Likes
573 Views
5 Replies
Replies (5)
Message 2 of 6

Sea-Haven
Mentor
Mentor

Post sample dwg and your code.

0 Likes
Message 3 of 6

hmsilva
Mentor
Mentor

@nbrafford wrote:

I am trying to update the individual and distinct hyperlinks on 40-60 objects on about 15 different drawings. They all look to the T:\ drive and I need them looking to the C:\ drive in the file path.

 

I have tried creating a lsp to execute the drive letter change, but cannot get it functioning. 

 

Is there another way to do this? Or does anyone have a script for this that works?


@nbrafford make a copy of one file and test this code

(defun c:demo (/ acdoc hyp hyp1 nurl url)
    (vl-load-com)
    (or acdoc (setq acdoc (vla-get-activedocument (vlax-get-acad-object))))
    (vla-StartUndoMark acdoc)
    (vlax-for blks (vla-get-blocks acdoc)
	(if (= (vla-get-isxref blks) :vlax-false)
	    (vlax-for blk blks
		(setq hyp (vla-get-hyperlinks blk))
		(if (= 1 (vla-get-count hyp))
		    (progn
			(setq hyp1 (vla-item hyp 0))
			(setq url (vla-get-url hyp1))
			(if (wcmatch url "T:\\*")
			    (progn
				(setq nurl (vl-string-subst "C:\\" "T:\\" url))
				(vla-put-url hyp1 nurl)
				(vla-put-urldescription hyp1 nurl)
			    )
			)
		    )
		)
	    )
	)
    )
    (princ)
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 4 of 6

fstechUWW4U
Participant
Participant

Have something similar to apply this solution to. Looking forward to seeing a solution.

0 Likes
Message 5 of 6

lukasz_stasiak2XH89
Observer
Observer

Worked fine for me. Many thanks!

Due to migration to another windows account i had to update links within my drawings. Edited lisp in attachement.

 

0 Likes
Message 6 of 6

paullimapa
Mentor
Mentor
0 Likes