shadow
Computer
- Mar 1, 2001
- 321
ok i found this lisp routine not sure how its supposed to work but im assuming its supposed to count the blocks and insert it as text in the drawing at a user specified point
;;; BLKCNTa.LSP
;;; Count All Blocks Placed in Drawing
(defun C:BLKCNTA (/ FILE BLIST BNAME SS1 NUM# IN)
(setvar "cmdecho" 0)
(setq startPt (getpoint "Pick Text Starting Point .."
)
(command "text" startPt "" "Blocks in this Drawing"
(setq BLIST (tblnext "BLOCK" T) IN 0)
(while BLIST
(setq BNAME (cdr (assoc 2 BLIST)))
(setq SS1 (ssget "x" (list (cons 0 "INSERT"
(cons 2 BNAME))))
(if (/= SS1 nil) (progn
(setq NUM# (sslength SS1))
(setq PRTXT (strcat (itoa NUM#) " = " BNAME))
(command "text" "" PRTXT)
))
(setq BLIST (tblnext "BLOCK"
)
(grtext -2 (strcat "Counting: " (itoa IN)))
(setq IN (1+ IN))
);;while
(alert "Block Count Completed!"
(princ)
)
someone take a look at it and see if they can get it to work as it is now all i get is the same as the text command if everyone helps everybody the world will be a better place
;;; BLKCNTa.LSP
;;; Count All Blocks Placed in Drawing
(defun C:BLKCNTA (/ FILE BLIST BNAME SS1 NUM# IN)
(setvar "cmdecho" 0)
(setq startPt (getpoint "Pick Text Starting Point .."
(command "text" startPt "" "Blocks in this Drawing"
(setq BLIST (tblnext "BLOCK" T) IN 0)
(while BLIST
(setq BNAME (cdr (assoc 2 BLIST)))
(setq SS1 (ssget "x" (list (cons 0 "INSERT"
(if (/= SS1 nil) (progn
(setq NUM# (sslength SS1))
(setq PRTXT (strcat (itoa NUM#) " = " BNAME))
(command "text" "" PRTXT)
))
(setq BLIST (tblnext "BLOCK"
(grtext -2 (strcat "Counting: " (itoa IN)))
(setq IN (1+ IN))
);;while
(alert "Block Count Completed!"
(princ)
)
someone take a look at it and see if they can get it to work as it is now all i get is the same as the text command if everyone helps everybody the world will be a better place