sophie Posted March 5, 2008 Posted March 5, 2008 Does anyone know of a lisp for calculating the sum of blocks? So if I was to create a block to represent trees in plan for example, I could automatically tally the number of trees. With thanks, Sophie Quote
ASMI Posted March 5, 2008 Posted March 5, 2008 (defun c:blc(/ blSet filLst nameLst curLen) (defun namesExtract(selSet) (mapcar '(lambda(x)(assoc 2 x)) (mapcar 'entget(vl-remove-if 'listp (mapcar 'cadr(ssnamex selSet))))) ); end of namesExtract (princ "\n<<< Select sample blocks to count >>> ") (if(setq blSet(ssget '((0 . "INSERT")))) (progn (setq filLst(append(list '(0 . "INSERT"))(list '(-4 . "<OR")) (namesExtract blSet)(list '(-4 . "OR>")))) (princ "\n<<< Specify area(s) to count >>> ") (if(setq blSet(ssget filLst)) (progn (setq nameLst(namesExtract blSet)) (princ "\n========== COUNT REPORT ==========") (while nameLst (setq curLen(length nameLst)) (princ(strcat "\n" (cdar nameLst) " " (itoa(- curLen(length(setq nameLst (vl-remove(car nameLst)nameLst))))))) ); end while (princ "\n=========== END REPORT ===========\n") (textscr) ); end progn ); end if ); end progn ); end if (princ) ); end of c:blc Quote
Guest LElkins Posted March 5, 2008 Posted March 5, 2008 Do you really need a lisp, or could you use the BCOUNT command which was recently mentioned? Quote
khama Posted March 5, 2008 Posted March 5, 2008 Do you really need a lisp, or could you use the BCOUNT command which was recently mentioned? yes bcount is the go.. and you don't need a lisp for that command.. Quote
ASMI Posted March 5, 2008 Posted March 5, 2008 sophie Forum Newbie Using: AutoCAD 2004 Join Date: Jan 2008 Posts: 3 Quote
NBC Posted March 5, 2008 Posted March 5, 2008 Bcount became available in AutoCAD 2000 though, according to this - http://www.hyperpics.com/commands/ Quote
Guest LElkins Posted March 5, 2008 Posted March 5, 2008 yes, and AutoCAD 2004 had express tools. no? Quote
khama Posted March 5, 2008 Posted March 5, 2008 sophie Forum Newbie Using: AutoCAD 2004 Join Date: Jan 2008 Posts: 3 Hey good point.. Don't know if it works in autocad 2004... maybe you do need a lisp then to make it happen.. my apologies... Quote
ASMI Posted March 5, 2008 Posted March 5, 2008 yes, and AutoCAD 2004 had express tools. no? Yes. But it not always good tool. For example I want to count certain blocks inside some area. Therefore I consider use of this (or another) LISP quite justified. Quote
SLW210 Posted March 5, 2008 Posted March 5, 2008 I will give you 2 of mine. BCOUNT has limited functionality, though I still use it some. Mine have a few more options. Quote
sophie Posted March 5, 2008 Author Posted March 5, 2008 Thanks for that, certainly works. I'll remember the bcount command for using a latter version. Quote
vidada Posted May 9, 2011 Posted May 9, 2011 Hello, sorry to come so late about this topic but how do you use the BlockQuantity and the BlockList? Thanks!! Quote
SLW210 Posted May 9, 2011 Posted May 9, 2011 You could send me $1,000,000 US or read this.....How to Use LISP Routines Quote
vidada Posted May 10, 2011 Posted May 10, 2011 Thanks, SLW210 ... In fact when I enter blockquantity or blockslist, it says "blockquantity Unknown command "BLOCKQUANTITY". Press F1 for help" or "blockslist Unknown command "BLOCKSLIST". Press F1 for help."... That's why I'm asking... PS: I already loaded the 2 files... Quote
SLW210 Posted May 10, 2011 Posted May 10, 2011 Are they in a folder in your support file search path? _OPTIONS>Files>Support File Search path make sure you have the path included. They both work fine here. I just checked them. Make sure your spelling is correct. Quote
LAM BOI CO Posted December 23, 2011 Posted December 23, 2011 (edited) I am a new member of CADTutor Forum. I can not download the files you attached. Pls help! Thanks. Post: Lisp for calculating the sum of blocks Forum: AutoCAD Drawing Management & Output Posted by: SLW210 Original Content: I will give you 2 of mine. BCOUNT has limited functionality, though I still use it some. Mine have a few more options. Edited December 23, 2011 by SLW210 Quote
SLW210 Posted December 23, 2011 Posted December 23, 2011 I have no problem down loading them. Must be blocked on your end. What message do you get? Quote
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.