Jump to content

Recommended Posts

Posted

(setq a 12.2)
(setq b 7.
(setq c (+ a b))
(alert  (rtos c))

 

This display 20

How to change this to display as 20.0

Posted

My 2 cents:

_1$ (setq a 12.2)
12.2
_1$ (setq b 7.
7.8
_1$ (setq c (+ a b))
20.0
_1$ (rtos c)
"20.0000"
_1$ (getvar 'lunits)
2
_1$ (getvar 'luprec)
4
_1$ (setvar 'luprec 1)
1
_1$ (rtos c)
"20.0"
_1$ 

or just:

_1$ (rtos c)
"20.0000"
_1$ (rtos c (getvar 'lunits) 1)
"20.0"
_1$ 

Posted

Look at rtos function help (rtos c 2 1)

 

(Rtos number mode precision)
1 scientific
2 Decimal
3 Feet decimal inches
4 Feet fraction inches
5 Fractional

Posted

Thanks Mr Lee Mac. Your explanation is very useful. Please can you explain me what function create the _$ and _1$

Posted
Thanks Mr Lee Mac. Your explanation is very useful.

 

You're welcome!

 

Please can you explain me what function create the _$ and _1$

 

This is the Visual LISP IDE Console prompt - see here for more information:

 

The Visual LISP Editor - Part 1

The Visual LISP Editor - Part 2

An Introduction to the Visual LISP IDE

Retrieving Information About a Function

A Shortcut to Localising Variables

Debugging Code with the Visual LISP IDE

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...