Hi
For.....
@carlos_m_gil_p wrote:
...................
One more question.
There is some way to know which is the largest number of decimals that the selected text has.
For example:
In the file that I had attached, of the original texts the one with the highest decimals was 3 decimals.
I ask this, because it would be the value that I would use to put the number of decimals to the new texts.
.......................
Try this........(For your particular type of drawings).....lightly tested
(defun C:CHN (/)
(setq ss (ssget ":L" '((0 . "*TEXT"))))
(setq dec 0)
(repeat (setq n1 (sslength ss))
(setq txt (vlax-ename->vla-object (ssname ss (setq n1 (1- n1)))))
(setq NO (vla-get-TextString txt))
(setq lst1 (parse NO "."))
(setq DP (- (strlen (rtos (atoi (nth 1 lst1)) 2 1)) 2))
(if (> DP dec) (setq dec DP))
)
(repeat (setq n (sslength ss))
(setq txt (vlax-ename->vla-object (ssname ss (setq n (1- n)))))
(vla-put-TextString txt (rtos (atof (vla-get-TextString txt)) 2 dec))
)
(command "_.justifytext" ss "" "M")
)
(defun parse (str delim / lst pos)
(setq pos (vl-string-search delim str))
(while (> pos 0)
(setq lst (cons (substr str 1 pos) lst)
str (substr str (+ pos 2))
pos (vl-string-search delim str)
)
)
(if (> (strlen str) 0)(setq lst (cons str lst)))
(reverse lst)
)
Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....