Keep '0' visible in text using a lisp for less decimals

Hello,

I would like to know how keep the zeroes visible as decimals after using the following lips routine:

[code]; TXT_DEC2.LSP
; 'Display text with 2 decimal'
;
;
(defun C:TXT_DEC2 ( / ID_TEXT CNTR EN ENLIST OLD_TXT NEW_TXT )
(setq ID_TEXT(ssget "X" (list (cons 0 "TEXT"))))
(If (BOUNDP 'ID_TEXT)(PROGN

(setq CNTR 1)
(while (< CNTR (sslength ID_TEXT))
(setq EN(ssname ID_TEXT CNTR))
(setq ENLIST(entget EN))
(setq OLD_TXT (CDR(assoc 1 ENLIST)))
(IF (NUMBERP(ATOF OLD_TXT))(PROGN
(setq NEW_TXT (RTOS(ATOF OLD_TXT)2 2))
(setq ENLIST(subst(cons 1 NEW_TXT)(assoc 1 ENLIST)ENLIST))(entmod ENLIST)
))
(setq CNTR(+ CNTR 1))
)
))

(Princ)
)

[/code]

For example my text at first is 1.000 then my output is 1 instead 1.00
I found this code online and my knowledge about code is very limited, so hopefully someone can help me.

Cicilia

Comments

  • And an additional question, how could I make this work for texts in one layer only without editing the other texts in thee drawing?
  • Problem #1:
    This is probably due to your DIMZIN setting. Either switch it to zero, or have the Lisp (temporarily) do this.

    Problem #2:
    One way to solve this is to remove the "X" after (ssget). That way you can select the texts manually.
  • Hello Roy,

    Your solutions work perfectly! Thank you very much!

    Cicilia
This discussion has been closed.