Dec 15, 2006 #1 CJJS Structural Jan 23, 2006 154 0 0 US Does anyone know what is the short command for counting blocks in a drawing? We are using AutoCad LT 2002. Thanks in advance.
Does anyone know what is the short command for counting blocks in a drawing? We are using AutoCad LT 2002. Thanks in advance.
Dec 15, 2006 #2 Exxit Computer Aug 18, 2003 804 0 0 DE CJSchwartz, counter question: Do You know a long command for AC LT? Lothar ADT 2004 ACAD 2002 Upvote 0 Downvote
Dec 15, 2006 #3 borgunit Mechanical Jul 26, 2002 1,153 0 0 US Does LT have a QSELECT command? If so, select all block refs with a certain name. The qty should get selected and show up. "Everybody is ignorant, only on different subjects." — Will Rogers Upvote 0 Downvote
Does LT have a QSELECT command? If so, select all block refs with a certain name. The qty should get selected and show up. "Everybody is ignorant, only on different subjects." — Will Rogers
Dec 15, 2006 Thread starter #4 CJJS Structural Jan 23, 2006 154 0 0 US The QSELECT Command works. How about a way to count all the blocks and list them. It seems that QSELECT only allows you to list/count blocks with a given name. Upvote 0 Downvote
The QSELECT Command works. How about a way to count all the blocks and list them. It seems that QSELECT only allows you to list/count blocks with a given name.
Dec 15, 2006 #5 borgunit Mechanical Jul 26, 2002 1,153 0 0 US You can select all blocks (in the Qselect operator choose Select All) but the names would need to be listed. "Everybody is ignorant, only on different subjects." — Will Rogers Upvote 0 Downvote
You can select all blocks (in the Qselect operator choose Select All) but the names would need to be listed. "Everybody is ignorant, only on different subjects." — Will Rogers
Dec 16, 2006 #6 Exxit Computer Aug 18, 2003 804 0 0 DE Hi, the problem is the LT-version. You can count blocks only with lisp, but it don't run on LT, except You have the LT-Extender... http://www.lt-extender.com/LT-Extender/englisch/default.htm Lothar ADT 2004 ACAD 2002 Upvote 0 Downvote
Hi, the problem is the LT-version. You can count blocks only with lisp, but it don't run on LT, except You have the LT-Extender... http://www.lt-extender.com/LT-Extender/englisch/default.htm Lothar ADT 2004 ACAD 2002
Dec 22, 2006 #7 Rodrigo71 Electrical Jun 21, 2006 9 0 0 US I have a lisp that counted and listed blocks, but it stopped working after installing 2006. Can you guys tell me what to fix in the code below? (defun C:COUNT ( / blocks ss) (princ "\nPress <CR> to select entire drawing or,") (cond ( (not (setq ss (cond ((ssget)) (t (ssget "_x" '((0 . "INSERT"))))))) (princ "\nNo objects selected.")) (t (princ "\nCounting block insertions...") ( (lambda (i) (repeat i (count_block (ssname ss (setq i (1- i)))))) (sslength ss)) (cond ( (not blocks) (princ "\nNo block insertions found.")) (t (table-print blocks "Block" "Count" "-" 8 "." nil 'itoa))))) (princ) ) (defun table-print (alist title1 title2 headsub coltab padchr car-form cdr-form / maxlen maxline padstr ) (setq car-form (cond (car-form) (t '(lambda (x) x))) cdr-form (cond (cdr-form) (t '(lambda (x) x)))) (setq maxlen (mapcar '(lambda (pair) (cons (strlen (car pair)) (strlen (cdr pair)))) (setq alist (mapcar '(lambda (pair) (cons (apply car-form (list (car pair))) (apply cdr-form (list (cdr pair))))) alist )))) (setq maxlen (+ -2 (apply 'max (mapcar 'car maxlen)) (apply 'max (mapcar 'cdr maxlen))) maxline (+ maxlen coltab) padstr (count_repl padchr 70)) (cprinc-init) (cprinc (strcat title1 " " (ctab (cons title1 title2) maxline (count_repl " " 70)) " " title2)) (cprinc (count_repl headsub (+ maxline 2))) (mapcar '(lambda (pair) (cprinc (strcat (car pair) " " (ctab pair maxline padstr) " " (cdr pair)))) alist ) ) (defun count_repl (chr len / res) (apply 'strcat (repeat len (setq res (cons chr res)))) ) (defun ctab (pair max padstr) (substr padstr 1 (- max (strlen (car pair) (cdr pair)))) ) (defun cdr++ (key alist) ( (lambda (x) (cond (x (subst (cons (car x) (1+ (cdr x))) x alist)) (t (cons (cons key 1) alist)))) (assoc key alist)) ) (defun get (k l) (cdr (assoc k l))) (defun entgetf (k e) ( (lambda (l) (mapcar '(lambda (x) (cdr (assoc x l))) k)) (entget e)) ) (defun count_block (ename) (apply '(lambda (etype name) (cond ( (and (eq "INSERT" etype) (or (assoc name blocks) (zerop (logand 45 (get 70 (tblsearch "block" name))))) (setq blocks (cdr++ name blocks))))) nil) (entgetf '(0 2) ename)) ) (defun cprinc-init () (setq *console-lines* (cond (*console-lines*) (t 25)) *cprinc-msg* (cond (*cprinc-msg*) (t "--- Press any key ---")) *cprinc-rubout* (cond ( (or textpage *clear-screen*) "") (t (strcat "\r" (count_repl " " (strlen *cprinc-msg*)) "\r"))) *cprinc-line* -1) (cond (textpage (textpage)) (*clear-screen* (*clear-screen*)) (t (textscr) (terpri))) ) (defun cprinc-page () (princ *cprinc-msg*) (grread) (cond (textpage (textpage)) (*clear-screen* (*clear-screen*)) (t (textscr))) (princ *cprinc-rubout*) (setq *cprinc-line* 0) ) (defun cprinc (s) (cond ( *cpage-disable*) ( (not *cprinc-line*) (cprinc-init)) ( (eq (setq *cprinc-line* (1+ *cprinc-line*)) (1- *console-lines*)) (cprinc-page))) (write-line s) ) ; ############################ eof COUNT.LSP ################################ (princ "\nC:COUNT loaded. Start command with COUNT. ") (princ) </PRE> Upvote 0 Downvote
I have a lisp that counted and listed blocks, but it stopped working after installing 2006. Can you guys tell me what to fix in the code below? (defun C:COUNT ( / blocks ss) (princ "\nPress <CR> to select entire drawing or,") (cond ( (not (setq ss (cond ((ssget)) (t (ssget "_x" '((0 . "INSERT"))))))) (princ "\nNo objects selected.")) (t (princ "\nCounting block insertions...") ( (lambda (i) (repeat i (count_block (ssname ss (setq i (1- i)))))) (sslength ss)) (cond ( (not blocks) (princ "\nNo block insertions found.")) (t (table-print blocks "Block" "Count" "-" 8 "." nil 'itoa))))) (princ) ) (defun table-print (alist title1 title2 headsub coltab padchr car-form cdr-form / maxlen maxline padstr ) (setq car-form (cond (car-form) (t '(lambda (x) x))) cdr-form (cond (cdr-form) (t '(lambda (x) x)))) (setq maxlen (mapcar '(lambda (pair) (cons (strlen (car pair)) (strlen (cdr pair)))) (setq alist (mapcar '(lambda (pair) (cons (apply car-form (list (car pair))) (apply cdr-form (list (cdr pair))))) alist )))) (setq maxlen (+ -2 (apply 'max (mapcar 'car maxlen)) (apply 'max (mapcar 'cdr maxlen))) maxline (+ maxlen coltab) padstr (count_repl padchr 70)) (cprinc-init) (cprinc (strcat title1 " " (ctab (cons title1 title2) maxline (count_repl " " 70)) " " title2)) (cprinc (count_repl headsub (+ maxline 2))) (mapcar '(lambda (pair) (cprinc (strcat (car pair) " " (ctab pair maxline padstr) " " (cdr pair)))) alist ) ) (defun count_repl (chr len / res) (apply 'strcat (repeat len (setq res (cons chr res)))) ) (defun ctab (pair max padstr) (substr padstr 1 (- max (strlen (car pair) (cdr pair)))) ) (defun cdr++ (key alist) ( (lambda (x) (cond (x (subst (cons (car x) (1+ (cdr x))) x alist)) (t (cons (cons key 1) alist)))) (assoc key alist)) ) (defun get (k l) (cdr (assoc k l))) (defun entgetf (k e) ( (lambda (l) (mapcar '(lambda (x) (cdr (assoc x l))) k)) (entget e)) ) (defun count_block (ename) (apply '(lambda (etype name) (cond ( (and (eq "INSERT" etype) (or (assoc name blocks) (zerop (logand 45 (get 70 (tblsearch "block" name))))) (setq blocks (cdr++ name blocks))))) nil) (entgetf '(0 2) ename)) ) (defun cprinc-init () (setq *console-lines* (cond (*console-lines*) (t 25)) *cprinc-msg* (cond (*cprinc-msg*) (t "--- Press any key ---")) *cprinc-rubout* (cond ( (or textpage *clear-screen*) "") (t (strcat "\r" (count_repl " " (strlen *cprinc-msg*)) "\r"))) *cprinc-line* -1) (cond (textpage (textpage)) (*clear-screen* (*clear-screen*)) (t (textscr) (terpri))) ) (defun cprinc-page () (princ *cprinc-msg*) (grread) (cond (textpage (textpage)) (*clear-screen* (*clear-screen*)) (t (textscr))) (princ *cprinc-rubout*) (setq *cprinc-line* 0) ) (defun cprinc (s) (cond ( *cpage-disable*) ( (not *cprinc-line*) (cprinc-init)) ( (eq (setq *cprinc-line* (1+ *cprinc-line*)) (1- *console-lines*)) (cprinc-page))) (write-line s) ) ; ############################ eof COUNT.LSP ################################ (princ "\nC:COUNT loaded. Start command with COUNT. ") (princ) </PRE>
Dec 25, 2006 #8 COEngineeer Structural Sep 30, 2006 1,186 0 0 US If you highlight all you drawing with your mouse (instead of select all) then press Ctrl 1, it should list how many blocks you have. Upvote 0 Downvote
If you highlight all you drawing with your mouse (instead of select all) then press Ctrl 1, it should list how many blocks you have.