strcat error

strcat error

alexandre_benekowski
Advocate Advocate
1,227 Views
8 Replies
Message 1 of 9

strcat error

alexandre_benekowski
Advocate
Advocate

Hi, folk, 

i´m typing a lisp, but i can´t solve a problem with "strcat":

(defun c:folhas ()

;INSERÇÃO DE DADOS....

(setvar "attdia" 0)
(setq PONTO (getpoint "\nClique no primeiro ponto de inserção "))
(setq PONTO_2 (getpoint "\nClique no segundo ponto de inserção "))
(setq PONTO_3 (getpoint "\nClique na primeira seção da segunda coluna "))
(setq QUANTIDADE_COLUNAS (getint "\nDigite a quantidade de colunas"))
(setq QUANTIDADE_LINHAS (getint "\nDigite a quantidade de seções em cada coluna "))

;CONTAS E CÁLCULOS....
(setq VALOR 1)
(setq QUANTIDADE_SEÇÕES (* QUANTIDADE_COLUNAS QUANTIDADE_LINHAS))
(repeat QUANTIDADE_SEÇÕES
(setq VALOR1 (itoa VALOR))
(setq VALOR_FINAL (strcat VALOR1 " / "))
(setq VALOR_FINAL1 (strcat VALOR_FINAL QUANTIDADE_SEÇÕES))
(command "_insert" "C:/BLOCOS/FOLHAS" ponto "1" "1" "0" VALOR_FINAL1)
(setq valor (1+ valor))
)
)

I need to "strcat" number / quantity

 

thanks!!!!

0 Likes
Accepted solutions (3)
1,228 Views
8 Replies
Replies (8)
Message 2 of 9

ВeekeeCZ
Consultant
Consultant

You need to convert QUANTIDADE_SEÇÕES from an integer to a string.

0 Likes
Message 3 of 9

stevor
Collaborator
Collaborator
Accepted solution

(setq VALOR_FINAL1 (strcat VALOR_FINAL QUANTIDADE_SEÇÕES))

 

Could be the same as your other string types from integers: 

 (setq VALOR_FINAL1
   (strcat VALOR_FINAL (itoa QUANTIDADE_SEÇÕES)) )

S
Message 4 of 9

alexandre_benekowski
Advocate
Advocate
Accepted solution
Hi stevor, the code "(setq VALOR_FINAL1 (strcat VALOR_FINAL (itoa QUANTIDADE_SEÇÕES)) )" worked!!! thank you so much!!!
0 Likes
Message 5 of 9

ronjonp
Mentor
Mentor

If you don't want to worry about your data type for strcat you could use a function like so and feed it a list of whatever. Although I'm not sure of the usefulness 🙂

(defun _dpstrcat (l) (apply 'strcat (mapcar 'vl-princ-to-string (mapcar 'eval l))))
(setq i 69.)
(setq e (car (entsel)))
(_dpstrcat '("string" 1 i e))
0 Likes
Message 6 of 9

john.uhden
Mentor
Mentor

Obviously not for this purpose...

(_DPSTRCAT (ENTGET (ENTLAST)))
*Cancel*
bad argument type: consp <Entity name: 7e2f5958>

 

Only teasing

John F. Uhden

0 Likes
Message 7 of 9

ronjonp
Mentor
Mentor

@john.uhden wrote:

Obviously not for this purpose...

(_DPSTRCAT (ENTGET (ENTLAST)))
*Cancel*
bad argument type: consp <Entity name: 7e2f5958>

 

Only teasing


😃

(_dpstrcat '((car (entsel))))

Not sure why I wrote this madness! 😅

0 Likes
Message 8 of 9

john.uhden
Mentor
Mentor
@ronjonp wrote, " Not sure why I wrote this madness!"

Just for fun. At least I hope that's why we are here.
Many thanks for improving my day.

John F. Uhden

0 Likes
Message 9 of 9

ronjonp
Mentor
Mentor
Accepted solution

@john.uhden wrote:
@ronjonpwrote, " Not sure why I wrote this madness!"

Just for fun. At least I hope that's why we are here.
Many thanks for improving my day.

Cheers! 🍻

Glad to have improved your day!

0 Likes