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
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
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
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
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
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