+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19
  1. #1
    Forum Newbie
    Using
    AutoCAD 2004
    Join Date
    Jan 2008
    Posts
    4

    Default Lisp for calculating the sum of blocks

    Registered forum members do not see this ad.

    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

  2. #2
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Code:
    (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

  3. #3
    LElkins
    Guest

    Default

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

  4. #4
    Senior Member khama's Avatar
    Computer Details
    khama's Computer Details
    Operating System:
    Windows 7 Ultimate
    Computer:
    INTEL CUSTOM i5
    Motherboard:
    GIGABYTE HD55-UD3A i7
    CPU:
    CORE I5 3.2GHz
    RAM:
    6GB CORSAIR DDR-3
    Graphics:
    NVIDIA Quadro FX 3800 Graphics adapter - 1 GB - GDDR3 SDRAM
    Primary Storage:
    SAMSUNG 660GB SATA
    Secondary Storage:
    SAMSUNG 1TB
    Monitor:
    2 x DELL PRECISION 30"
    Discipline
    Mechanical
    khama's Discipline Details
    Occupation
    Project Leader, Engineering, Oil and Gas and Materials Handling
    Discipline
    Mechanical
    Details
    Mechanical is my strongest Discipline. Civil and Structural are all strengths for me too.
    Using
    AutoCAD 2011
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    200

    Default

    Quote Originally Posted by LElkins View Post
    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..
    Last edited by khama; 5th Mar 2008 at 01:35 pm. Reason: spelling
    Khama
    Bachelor of Science Mechanical Engineering
    Diploma Civil & Structural Engineering
    Diploma Engineering NDT

  5. #5
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    sophie
    Forum Newbie

    Using: AutoCAD 2004

    Join Date: Jan 2008
    Posts: 3

  6. #6
    Forum Deity NBC's Avatar
    Using
    AutoCAD 2009
    Join Date
    Aug 2007
    Location
    Manchester, UK
    Posts
    2,109

    Default

    Bcount became available in AutoCAD 2000 though, according to this - http://www.hyperpics.com/commands/
    Life's constantly changing - keep up or get left behind

  7. #7
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Yes, with Express Tools.

  8. #8
    LElkins
    Guest

    Default

    yes, and AutoCAD 2004 had express tools. no?

  9. #9
    Senior Member khama's Avatar
    Computer Details
    khama's Computer Details
    Operating System:
    Windows 7 Ultimate
    Computer:
    INTEL CUSTOM i5
    Motherboard:
    GIGABYTE HD55-UD3A i7
    CPU:
    CORE I5 3.2GHz
    RAM:
    6GB CORSAIR DDR-3
    Graphics:
    NVIDIA Quadro FX 3800 Graphics adapter - 1 GB - GDDR3 SDRAM
    Primary Storage:
    SAMSUNG 660GB SATA
    Secondary Storage:
    SAMSUNG 1TB
    Monitor:
    2 x DELL PRECISION 30"
    Discipline
    Mechanical
    khama's Discipline Details
    Occupation
    Project Leader, Engineering, Oil and Gas and Materials Handling
    Discipline
    Mechanical
    Details
    Mechanical is my strongest Discipline. Civil and Structural are all strengths for me too.
    Using
    AutoCAD 2011
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    200

    Default

    Quote Originally Posted by ASMI View Post
    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...
    Khama
    Bachelor of Science Mechanical Engineering
    Diploma Civil & Structural Engineering
    Diploma Engineering NDT

  10. #10
    Super Member ASMI's Avatar
    Using
    AutoCAD 2008
    Join Date
    Nov 2005
    Location
    Oceanus Procellarum, Moon
    Posts
    1,427

    Default

    Registered forum members do not see this ad.

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

Similar Threads

  1. Using lisp with blocks
    By Ozymandias in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 12th Dec 2007, 11:46 am
  2. Lisp for inserting blocks without basic prompts
    By Towel in forum AutoLISP, Visual LISP & DCL
    Replies: 19
    Last Post: 13th Oct 2007, 03:24 pm
  3. Blocks, Details, LISP Routines and More...
    By good_m in forum Useful Links
    Replies: 0
    Last Post: 30th Mar 2006, 08:06 pm
  4. redifining blocks in LISP
    By dimtick in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 28th Dec 2005, 06:36 pm
  5. Lisp for counting blocks?
    By Bloke in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 9th Oct 2003, 06:24 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts