วันพุธที่ 7 กรกฎาคม พ.ศ. 2564

Add decimal point in Text

 


;|

       Add Dot Command Add decimal point in Text

       Ex. Km.1+000000 to Km.1+000.000

       Create and Design by Songkhran Jongkul july 2021

|;

(defun c:adot ()

(setq old_cmdecho  (getvar "cmdecho"))

(setvar "cmdecho" 0)

(if (null dec)

       (setq dec 3)

)

(if (setq tmp (getint (strcat "\nEnter Number of Decimal: <" (rtos dec 2 0) ">: ")))

       (setq dec tmp)

)

(setq ss(ssget '((0 . "TEXT,MTEXT"))))

(setq cntr 0)

(while (< cntr (sslength ss))

       (setq en(ssname ss cntr))

       (setq enlist(entget en))

       (setq s-tex(cdr(assoc 1 enlist)))   

       (setq num (strlen s-tex)

                cnt (- num dec)

                opt (strcat (substr s-tex 1 cnt) "." (substr s-tex (1+ cnt)))

       )

       (setq enlist(subst (cons 1 opt)(assoc 1 enlist) enlist))

       (entmod enlist)

       (setq cntr(+ cntr 1))

(princ)

)

(setvar "cmdecho" old_cmdecho)

(princ)

)

(prompt "\nEnter ADOT to start. ")

ไม่มีความคิดเห็น:

แสดงความคิดเห็น