TheSwamp
CAD Forums => CAD General => Topic started by: Rob... on May 20, 2014, 08:52:14 AM
-
A quick search didn't reveal anything useful. Does anyone have a method or a LISP for saving blocks from a file out to separate files using the block name as the file name?
TIA
-
Here's a quickie:
(defun c:exportblocks (/ blk blks x dir)
(vl-load-com)
(if (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
(progn (setvar 'filedia 0)
(setq dir (strcat (getvar 'dwgprefix) "_ExportedBlocks\\"))
(vl-mkdir dir)
(vlax-for blk blks
(if (and (not (wcmatch (setq x (vla-get-name blk)) "*|*,*`**"))
(= (vla-get-isxref blk) :vlax-false)
)
(command "._-wblock" (strcat dir x) x)
)
)
(setvar 'filedia 1)
)
)
(princ)
)
-
Thank you, about to give it a test run. Will report back shortly.
-
It works like a charm! Thank you very much!
-
It works like a charm! Thank you very much!
Glad to help :)