diarmuid Posted August 22, 2006 Posted August 22, 2006 Lisp question (setq ope(getreal "\nenter the actual ope size...")) (setq wname (strcat ope "w")) (command "-insert" wname p2 "" "" p3 "") ; inserts a standard block. What I basically want to do is create a new variable that will be whatever number I enter for the variable Quote
CarlB Posted August 22, 2006 Posted August 22, 2006 Barking up right tree just got to keep from mixing fruits and nuts. 'ope' is a real number. 'Strcat' works on only strings. So using'ope' in 'strcat' function you need to convert it to a string using 'rtos'. If 'ope' can only be an interger you should use 'getint' rather than 'getreal'. Convert an integer to string using 'itoa'. Quote
India Posted August 23, 2006 Posted August 23, 2006 Yes. Strcat can deal only in strings, so you shoulkd convert the real / int in to string by using for Int - Itoa (integer to ascii) or for real it is RTOS - real to string eg; (setq ope (getreal "sdjsd") combine_Ope (strcat (rtos ope) "W") ) Quote
diarmuid Posted August 23, 2006 Author Posted August 23, 2006 thanks guys. slowly but surely i'm getting the hang of lisp. my routines are getting more elobrate each time, i'm still a looooong way of yet, but i'm getting there. Ta. Diarmuid Quote
OMEGA-ThundeR Posted December 7, 2017 Posted December 7, 2017 i would like to ask how the RTOS part can make an integer a whole number. (if (null NUMBER) (setq NUMBER 6)) (setq NUMBER(getint (strcat "\nHow many ?<" (rtos NUMBER) ">: "))) The output would be "How many? :" But i would want it to be "How many? :". Any indication on how the '.000' part can be removed? p.s. This is just a learing case for me, i know (or at least in my code at the moment) the number 6 would not be saved if i just press enter after the question) Quote
Roy_043 Posted December 7, 2017 Posted December 7, 2017 Use itoa instead. Or (rtos number 2 0). Quote
BIGAL Posted December 8, 2017 Posted December 8, 2017 To quote the lisp bible (Autocad release 12 paper copy) (rtos number [mode [precision]]) mode 1 Scientific 2 Decimal 3 Engineeering Feet & dec inches 4 Architectural Feet & inches 5 Fractional Quote
Recommended Posts
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.