Jump to content

strcat help sought


diarmuid

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 11 years later...

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...