Efeezy Posted April 28, 2010 Share Posted April 28, 2010 BURST=EXPLODES ATTRIBUTED BLOCKS AND KEEPS THE NUMBERS AND LETTERS THE BUST COMMAND WORKS FOR MY APPLICATION FOR KEEPING TEXT, BUT I NEED IT TO TO RETAIL THE BLOCK. FOR MY BLOCK LISTER FOR QUANTITIES. IS THERE A WAY I CAN RETAIN MY TEXT AND NUMBERS AND STILL HAVE A BLOCK? BLOCK LISTER: THIS MIGHT BE USEFUL FOR SOME OF YOU I LOVE IT!!! Default Lisp to count blocks on specific layers How do i manipulate this lisp to count blocks on specific layers only? All my layers start with "E_..." eg E_POWER, E_LIGHTS etc. I got this lisp from the site and it works like a dream... would help even more if if can be changed to recognise and count the blocks only on the layers with names starting with "E_..." Thanks Quote: ;************************************************* ****************************** ;* C:BlocksList.LSP * ;* * ;* * ;************************************************* ****************************** (defun C:BlocksList ( ; Command emulation; ( local variables / Option ; User option for output of block quantities (or exit) C_layer ; Current layer's name con'd with its assoc key ( Block_list ; List of block's table information Block_cons ; List of block's name con'd with 2 (its assoc key) Block_set ; Selection set of all blocks with given name (& on curr layer) Block_name ; Current block's name Block_srch ; Search criteria for finding/selecting blocks Count$ ; Quantity of selected blocks as a string value ) ; Close defun's local variables list (cond ; Begin routine--get user input first ( (initget "All Current eXit") ) ; Initialize options for user input ( (= "eXit" (setq Option (getkword (strcat "List [" "All occurrences/Current layer only/eXit" "] <Current layer only>: " ) ) ) ) ); Default is do blocks on current layer (T(textscr) (prompt "\nPlease wait...Counting block insertions...Found...") (if (/= Option "All") (setq C_layer (cons 8 (getvar "CLAYER")))) (while ; Inform user processing is starting (setq Block_list (tblnext "BLOCK" (not Block_list))) (setq Block_cons (assoc 2 Block_list) Block_name (cdr Block_cons) Block_srch (cond ; Step through entire block name database ( (= (ascii Block_name) 42) nil ); Ignore anonymous blocks: "*..." ( (= Option "All") (list Block_cons) ) (T(list Block_cons C_layer) ) ) ) ; Limit to current layer if All not opted (cond ; Now output (ignores unused blocknames) ( (and Block_srch (setq Block_set (ssget "X" Block_srch))) (setq Count$ (rtos (sslength Block_set) 2 0)) (prompt (strcat "\n" " " ; Build prompt string--pretty-print qty (nth (strlen Count$) '("" " " " " " " " " " " "")) Count$ " " Block_name ; Output qty & block name to screen ) ) ) ; Close cond's only opt & prompt-strcat ) ) ; Close processing while & its cond ) ) ; Close main cond & its T option (princ) ; Quiet exit ) ; The END (close defun C:BlocksList) (C:BlocksList) ; Auto-call @ actual, not dummy, load Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted April 28, 2010 Share Posted April 28, 2010 Someone had the same question over here and got some replies.... http://board.thaiblogonline.com/Lisp-to-count-blocks-on-specific-layers/autocad/71087 Quote Link to comment Share on other sites More sharing options...
alanjt Posted April 29, 2010 Share Posted April 29, 2010 Someone had the same question over here and got some replies.... http://board.thaiblogonline.com/Lisp-to-count-blocks-on-specific-layers/autocad/71087 RK, how in the world did you find this? 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.