ahank Posted April 1, 2014 Share Posted April 1, 2014 I've tried several lisp routines to help count blocks that are color coded and also have a given attribute; but all the routines require me to select each block. Is there a lisp routine that will count all blocks/ attributes within model space (only) and export to a table (or even better an Excel sheet)? I want to include in the lisp routine what blocks to look for... I'm a novice looking for a lot of help and would be greatly appreciated!!! Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 2, 2014 Share Posted April 2, 2014 You hinted you looked at various lisps but using a filter will do what you want when selecting blocks looking at this snippet of code it has its filter set to a block of a certain name and must be in Modelspace. Once you have the selection set you can delve deeper and check the attribute value and count up. (defun getblk (bname / ss1) (setq ss1 (ssget "x" (list (cons 0 "INSERT") (cons 2 bname)(cons 410 "Modelspace")))) (princ (sslength ss1)) ; total number of blocks with that name found (do something here total up attributes) ) ;This will get all blocks called Fred (getblk "Fred") ; multiple runs (getblk "Fred") (getblk "Part56") (getblk "Obj32") Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.