Sounds like a new custom routine is needed.
1) Construct a list of blocks in your database
(setq blk_db_list (dos_dir "<path>*.dwg")); DOS_DIR is a function defined within DOSLIB from Robert McNeel & Associates (free) here: https://wiki.mcneel.com/doslib/home
2) Construct a list of blocks in your drawing.
(progn
(setq dwg_blk_list (list (cdr (assoc 2 (tblnext "block" T)))))
(while (setq next_blk (tblnext "block"))
; (if
; (you will likely want to filter out some types of blocks here and only ad those that remain to your dwg_blk_list)
; nil
(setq dwg_blk_list (append dwg_blk_list (list (cdr (assoc 2 next_blk)))))
; )
)
)
3) execute the insert command using the "=" method to redefine the blocks in the drawing that are also in your block database list.
(foreach n dwg_blk_list
(if (member n blk_db_list
(COMMAND ".INSERT" (STRCAT n "=") "Y" nil)
)
)
Like this:
(DEFUN c:updblks ()
(setq dwg_db_list (dos_dir "L:\\Util\\*.dwg")); put the location of your block database (folder) here.
(setq blk_db_list (mapcar '(lambda (x) (strcase (nth 2 (dos_splitpath x)))) dwg_db_list))
(progn
(setq dwg_blk_list (list (strcase (cdr (assoc 2 (tblnext "block" T))))))
(while (setq next_blk (tblnext "block"))
; (if
; (you may want to filter out some types of blocks here and only add those that remain to your dwg_blk_list)
; nil
(setq dwg_blk_list (append dwg_blk_list (list (strcase (cdr (assoc 2 next_blk))))))
; )
)
)
(foreach n dwg_blk_list
(if (member n blk_db_list)
(progn
(princ "\n")
(PRINC (STRCAT n "="))
(PRINC)
(COMMAND ".INSERT" (STRCAT n "=") "Y" nil)
)
(PROGN
(princ "\n")
(PRINC (STRCAT n "= Not updated! "))
(PRINC)
)
)
)
)
AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
8.6.52.0 AutoCAD Architecture 2024