×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

block counting

block counting

block counting

(OP)
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

RE: block counting

The offending code in the above code is :

(grtext -2 (strcat "Counting: " (itoa IN)))

Remove that line and it should work flawlessly, assuming of course you already have defined a default text style with a fixed height, otherwise the routine will behave erratically due to the required parameters for the text command.

RE: block counting

(OP)
how would i go about setting this routine to have its own default text style to use
so say something like
1st it looks for a text style called "blkcnta" set to a default height of what ever and if its not there it creates it
2nd sets it current then runs the above command with the string "(grtext -2 (strcat "Counting: " (itoa IN)))" removed

if everyone helps everybody the world will be a better place

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources