I am looking for a clean method for a program to find how many decimal places a dimension has so I can write it correctly to a txt file. I am using assoc 42 with ssget function to extract the dimension.
I could turn it into a string an walk through it with a counter, but I am hoping there is a much cleaner method.
This is the same code I posted yesterday under "Crash using a "while" statement" with corrections.
Code:(defun c:BB () (Setvar "osmode" 0) (setq INFOLST nil) (setq T1 1) (setq SS 1) (while (/= SS nil) (Prompt "Pick Dimension") (setq SS (ssget)) (if (/= SS nil) (progn (setq ELST (entget(ssname SS 0)) P1 (cdr(assoc 11 ELST)) P2 (list (+ (car P1) 0.55)(+ (cadr P1) 0.38) 0.0) P3 (list (- (car P2) 0.10)(- (cadr P2) 0.10) 0.0) ) (command "circle" P2 0.25 "") (setq T2 (itoa T1)) (command "text" P3 "0.180" "0" T2) (setq D1 (cdr(assoc 42 ELST)) D1 (rtos D1 2 3) INFOLST (append INFOLST (list D1)) T1 (1+ T1) ) );end progn );end if );end while ;Write INFOLST out to file (setq R (length INFOLST) FN "c:\\cad\\Iso9000.txt" I 0 TEX (open FN "w") ) (repeat R (setq L (nth I INFOLST)) (write-line L TEX) (setq I (1+ I)) ) (close TEX) (princ) ) (princ)Moderator Note: