@GeryKnee wrote:
I think the next is OK
(defun c:xxx()
(setq DrawingScale (getreal "\nDim overall scale factor: "))
(setq GlobalLtScale (/ DrawingScale 1000.00))
(command "LtScale" GlobalLtScale)
(princ)
)
It looks like it ought to. But I wouldn't bother with the GlobalLtScale variable if it's used only once -- just do the calculation right where it's used. [If you do choose to use it, it's better to localize it.] And for a System Variable setting it's a little shorter [and faster, if only by milliseconds] to use (setvar) instead of (command). Also, since a (/) function will return a real number if either argument is a real number, and since (getreal) always returns a real number, the divisor can be an integer. [If you choose to make it a real number, there's no point in having more than one zero after the decimal point, and in fact you don't even need one, but some find it visually clearer having one.]
(defun c:xxx (/ DrawingScale)
(setq DrawingScale (getreal "\nDim overall scale factor: "))
(setvar 'ltscale (/ DrawingScale 1000))
(princ)
)
You could go even shorter, with no variables at all:
(defun c:xxx ()
(setvar 'ltscale (/ (getreal "\nDim overall scale factor: ") 1000))
(princ)
)
Kent Cooper, AIA