PDA

View Full Version : STRCAT question


dgomez.189897
2008-07-25, 01:08 AM
Hi,

I am trying to change a routine I have and I keep getting a nil return using STRCAT. I think I know what the problem is but I don't know how to fix it. Any help will be greatly appreciated.

Here is the part of the code I am having problems with:

(setq blc_emp (strcat chemin Panel))
(command "_insert" blc_emp pti "1" "1" "0")
(setq pipe_num (caddr pti))
(setq pipe_num_int (fix pipe_num))
(setq pipe_dir (strcat pipedir pipe_num_int))
(command "_insert" pipe_dir pti "1" "1" "0")

And here is what's happening:
CHEMIN is a directory and PANEL is of the form "XXXX" (with the quotation marks, when you do a "watch" in the editor).
This makes the variable BLC_EMP of the form "c:/folder/XXX" which is inserted with no problem

The problem I have is with the second STRCAT.
PIPEDIR is a directory and PIPE_NUM_INT is of the form XXX (no quotation marks)

Now, after the second STRCAT, the variable PIPE_DIR is a nil value and obviously, I cant insert the block in the dwg.

What is the problem and how can I solve it?

Thanks for the help.
D

Moderator Note:
Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)

steve.ashton
2008-07-25, 01:34 AM
(setq pipe_num_int (fix pipe_num)) returns an integer

Strcat requires all to be strings

Try (setq pipe_num_int (itoa (fix pipe_num)))

Itoa converts integers to strings, rtos would convert reals to strings.


Steve

dgomez.189897
2008-07-25, 06:06 PM
Thanks Steve, that was it. It works now