Tuesday, January 15, 2008

What LUPREC is and what it can do in AutoLISP

I got a question on how to change BomLengths.lsp to not show decimals.

BomLengths.lsp is a freeware that reports the accumulated sum length of multiple objects. As default it uses the current number of decimals according to the LUPREC value.

The solution is the following:

Change the following rows
(princ (rtos %l (getvar "lunits")(getvar "luprec")))
and
(princ (rtos %t (getvar "lunits")(getvar "luprec")))

to

(princ (rtos %l (getvar "lunits") 0))
and
(princ (rtos %t (getvar "lunits") 0))

According to the manual on luprec:

Sets the number of decimal places displayed for all read-only linear units, and for all editable linear units whose precision is less than or equal to the current LUPREC value. For editable linear units whose precision is greater than the current LUPREC value, the true precision is displayed. LUPREC does not affect the display precision of dimension text (see DIMSTYLE).

No comments:

Post a Comment