From: classix
Subject: how to force decimal places for strings
Date: 
Message-ID: <6b10e8ce-9f38-4762-a4a8-d0a59763ed7d@l34g2000vbi.googlegroups.com>
Hi
I wrote a lisp routine to get the area of a polyline in autocad placed
into an attribute. I use rtos to get decimal places rounded to 1,2,3
or 4 decimals. Everything works fine exept for strings ending with
zero.
Is it possible to force a string to decimal places? e.g 4.00 instead
of 4
Any suggestions welcome.
Marcus

From: Geoffrey Summerhayes
Subject: Re: how to force decimal places for strings
Date: 
Message-ID: <924a4315-bfa5-4f47-b51c-e33bd058e817@k26g2000vbp.googlegroups.com>
On Jun 26, 11:29 am, classix <············@einherzfuerpixel.de> wrote:
> Hi
> I wrote a lisp routine to get the area of a polyline in autocad placed
> into an attribute. I use rtos to get decimal places rounded to 1,2,3
> or 4 decimals. Everything works fine exept for strings ending with
> zero.
> Is it possible to force a string to decimal places? e.g 4.00 instead
> of 4
> Any suggestions welcome.
> Marcus

(format stream "~,VF" places number)

--
Geoff
From: Geoffrey Summerhayes
Subject: Re: how to force decimal places for strings
Date: 
Message-ID: <bbe58b3a-8e32-41f5-9233-835be101ffce@f30g2000vbf.googlegroups.com>
On Jun 26, 11:44 am, Geoffrey Summerhayes <·······@gmail.com> wrote:
> On Jun 26, 11:29 am, classix <············@einherzfuerpixel.de> wrote:
>
> > Hi
> > I wrote a lisp routine to get the area of a polyline in autocad placed
> > into an attribute. I use rtos to get decimal places rounded to 1,2,3
> > or 4 decimals. Everything works fine exept for strings ending with
> > zero.
> > Is it possible to force a string to decimal places? e.g 4.00 instead
> > of 4
> > Any suggestions welcome.
> > Marcus
>
> (format stream "~,VF" places number)
>
> --
> Geoff

Crap, not enough coffee this morning, missed the autocad.
--
Geoff
From: Thomas A. Russ
Subject: Re: how to force decimal places for strings
Date: 
Message-ID: <ymiljnegc03.fsf@blackcat.isi.edu>
Geoffrey Summerhayes <·······@gmail.com> writes:

> On Jun 26, 11:29��am, classix <············@einherzfuerpixel.de> wrote:
> > Hi
> > I wrote a lisp routine to get the area of a polyline in autocad placed
> > into an attribute. I use rtos to get decimal places rounded to 1,2,3
> > or 4 decimals. Everything works fine exept for strings ending with
> > zero.
> > Is it possible to force a string to decimal places? e.g 4.00 instead
> > of 4
> > Any suggestions welcome.
> > Marcus
> 
> (format stream "~,VF" places number)

I fear that may not be available in the AutoCad lisp that I assume the
OP has available for this.

To the OP:  You may have better luck posting in the autocad newsgroup.

  comp.cad.autocad
  alt.cad.autocad



-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Jacobite1607
Subject: Re: how to force decimal places for strings
Date: 
Message-ID: <3a4a8fa5-a995-4278-9187-2a42d98dd5ff@r34g2000vba.googlegroups.com>
> > (format stream "~,VF" places number)

Autolisp does not have "Format".

William
From: Robert Uhl
Subject: Re: how to force decimal places for strings
Date: 
Message-ID: <m3skhnkmnh.fsf@latakia.octopodial-chrome.com>
classix <············@einherzfuerpixel.de> writes:
>
> I wrote a lisp routine to get the area of a polyline in autocad placed
> into an attribute. I use rtos to get decimal places rounded to 1,2,3
> or 4 decimals. Everything works fine exept for strings ending with
> zero.
> Is it possible to force a string to decimal places? e.g 4.00 instead
> of 4

<http://www.jefferypsanders.com/autolispintr_conv.html> suggests that
(rtos 4 2 2) would return "4.00".

But this newsgroup is for Common Lisp; you might want to check on
comp.cad.autocad for more help.

-- 
Robert Uhl <http://public.xdi.org/=ruhl>
So, as a symbolic gesture, I printed out and burned that document.
     --Richard Gooch, re /usr/src/linux/Documentation/CodingStyle
From: Jacobite1607
Subject: Re: how to force decimal places for strings
Date: 
Message-ID: <6333d059-47ff-4b38-8e39-ab780795aaa2@l32g2000vba.googlegroups.com>
Robert Uhl is right.

(rtos 4 2 2)
(rtos 4.0 2 2)

etc. will all produce "4.00"

The first 2 being decimal "float" format, the second 2 being the
number of decimal places.

William