Comma thousands separator

Comma thousands separator

fcernst
Mentor Mentor
284 Views
1 Reply
Message 1 of 2

Comma thousands separator

fcernst
Mentor
Mentor

Is there a way to get comma separators in table calculations and feature label expressions?



Fred Ernst, PE
C3D 2026
Ernst Engineering
www.ernstengineering.com
0 Likes
285 Views
1 Reply
Reply (1)
Message 2 of 2

CADaSchtroumpf
Advisor
Advisor

I use this:

(defun convert_str2mil (str2cnv flag / l_str n l_nw)
	(setq l_str (if flag (reverse (vl-string->list str2cnv)) (vl-string->list str2cnv)) n 1)
	(while l_str
		(if (zerop (rem n 3))
			(setq l_nw (cons 32 (cons (car l_str) l_nw)))
			(setq l_nw (cons (car l_str) l_nw))
		)
		(setq l_str (cdr l_str) n (1+ n))
	)
	(vl-list->string (if (not flag) (reverse l_nw) l_nw))
)

 

Example of use:

((lambda ( / )
	(setq pt (getpoint))
	(print
		(strcat
			"X="
			(convert_str2mil (rtos (setq mantisse (fix (car pt))) 2 0) T)
			","
			(convert_str2mil (substr (rtos (setq p_decimal (- (car pt) (fix (car pt)))) 2) 3) nil)
			" Y="
			(convert_str2mil (rtos (setq mantisse (fix (cadr pt))) 2 0) T)
			","
			(convert_str2mil (substr (rtos (setq p_decimal (- (cadr pt) (fix (cadr pt)))) 2) 3) nil)
		)
	)
	(prin1)
))