I hate doing things I can make my computer do for me. My adventures in customizing and automating computers. Primarily with AutoCAD and Microsoft Office.

Friday, March 27, 2009

Rename xrefs to match their filename

(vl-load-com)
(
setq
  
doc (vla-get-activedocument(vlax-get-acad-object))
  
blocks (vla-get-blocks doc)
)
(
vlax-for blk blocks
  
(if (not
    
(vl-catch-all-error-p
      
(vl-catch-all-apply 'vla-get-path (list blk))
    )
      )
    (
vla-put-name blk (vl-filename-base (vla-get-path blk)))
  )
)

No comments: