drawing number list

Jul 28, 2003 3 Replies

Well, with much help from others esp. Tom D. this is what I've got. It seems to work well. It takes a drawing number from a list and prints it in the bottom right corner of the drawing, then updates the list for the next user. It also creates the list if none exists.



Thanks all,



Chuck



(defun c:dnum () (setq dp (getvar "DWGPREFIX")) ;returns the current drive and directory of the drawing (setq filename (strcat dp "drawing numbers.txt")) ;creates the file in the "dp" directory (if (setq ofil (open filename "r")) (progn (while (setq nxtlin (read-line ofil)) (setq lastnum nxtlin) ) ;while (setq increment (1+ (atoi lastnum))) (close ofil) ) ;progn, then (setq increment 1) ) ;if (setq ofil (open filename "a")) ;if it doesn't exist, it will be created (write-line (itoa increment) ofil) (close ofil) (setq a (getvar "TEXTSIZE")) (setq x (/ a 2)) ;sets the vertical offset to textsize/2 (setq a (- (car (getvar "limmax")) a)) ;sets the horizontal offset to limmax-textsize bottom-right justified (command "text" "j" "br" (list a x) "" "" lastnum) ;prints the dnumber at the predetmined co-ordinates )


Glad it's working, Chuck. Thanks for posting your finished product. No doubt it will help someone else. ;)

There's nothing wrong with your idea, IMO. I considered that, but decided it was way too much for our needs. If you're working in an environment with many users and require that much flexibility, I think it would be well worth it. For us, it simply isn't worth it.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required