Jump to content
diarmuid

strcat help sought

Recommended Posts

diarmuid

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

Share this post


Link to post
Share on other sites
CarlB

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

Share this post


Link to post
Share on other sites
India

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

Share this post


Link to post
Share on other sites
diarmuid

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

Share this post


Link to post
Share on other sites
OMEGA-ThundeR

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)

Share this post


Link to post
Share on other sites
Roy_043

Use itoa instead. Or (rtos number 2 0).

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites
OMEGA-ThundeR

Thanks guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×