Message 1 of 23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I found below the old lisp routine in this forum.
this lisp counts specific blocks from the entire drawing. But want it to count only block which are in model space.
Link of the original post : LINK
(defun c:recount (/ block_list cnt env_name)
(setq block_list
(list
(cons '2 "1")
(cons '2 "2")
(cons '2 "3")
)
)
(foreach i block_list
(if
(setq ss (ssget "X" (list '(0 . "INSERT") i)))
(progn
(setq
cnt (itoa (sslength ss))
env_name (strcat "BLOCK_COUNT_" (cdr i))
)
(setenv env_name cnt)
(princ (strcat "\nSet " env_name " to " cnt))
)
(progn
(setq
cnt "0"
env_name (strcat "BLOCK_COUNT_" (cdr i))
)
(setenv env_name cnt)
(princ (strcat "\nSet " env_name " to " cnt))
)
)
)
(command "_REGEN") ;_refreshes field values
(princ)
)
Solved! Go to Solution.