Jump to content

Recommended Posts

Posted

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

Posted
(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

Guest LElkins
Posted

Do you really need a lisp, or could you use the BCOUNT command which was recently mentioned?

Posted
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..

Posted

sophie

Forum Newbie

 

Using: AutoCAD 2004

 

Join Date: Jan 2008

Posts: 3

Guest LElkins
Posted

yes, and AutoCAD 2004 had express tools. no?

Posted
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...

Posted

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.

Posted

I will give you 2 of mine. BCOUNT has limited functionality, though I still use it some. Mine have a few more options.

Posted

Thanks for that, certainly works. I'll remember the bcount command for using a latter version.

  • 3 years later...
Posted

Hello,

sorry to come so late about this topic but how do you use the BlockQuantity and the BlockList?

Thanks!!

Posted

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...:sweat:

Posted

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.

Posted

Done!! :D:D... Thanks very much, SLW210!!!

  • 7 months later...
Posted (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 by SLW210
Posted

I have no problem down loading them.

 

Must be blocked on your end.

 

What message do you get?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...