TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Shade on September 21, 2007, 11:13:16 AM

Title: Evaluate a string....
Post by: Shade on September 21, 2007, 11:13:16 AM
If I have a string like "32/3", is it possible to have autolisp evaluate the string so that 10.666667 is returned instead of 32?
(atof "32/3") returns 32, instead of 10.66667 which is what i need.

I have a cvs file I made in excel, where the values are stored in fractional format for better accuracy.

ie. 32/3, 8/3, 1/12, 8/5, etc.

I then take this data and import it into Autocad through a lisp that converts a cvs file to a list.

ie. ("32/3" "8/3" "1/12" "8/5")

I would then like to take the individual string and have autocad evaluate and return the fraction in decimal format.

ie. "32/3" is returned as 10.666666666667.

Is this possible?
Any help would be apprecited
Thanks.  :mrgreen:
Title: Re: Evaluate a string....
Post by: Chuck Gabriel on September 21, 2007, 11:17:56 AM
Try distof instead of atof.
Title: Re: Evaluate a string....
Post by: Shade on September 21, 2007, 11:20:11 AM
Thanks mate,
Thats works for me!