TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: iliekater on January 08, 2007, 02:47:44 PM
-
For years I was happy wit the use of the cprinc function . Thus , if I wanted to print a text in the next line in the command lie , I used something like this :
( princ "\nBla bla bla" )
Or even set first the text in a variable and then called it as many times I wanted :
( setq MyText "\nBla bla bla" )
( princ MyText )
However , lately in some routines I run into a strange problem : though I use the same tactics as above , I get the text printed twice :
( princ "\nBla bla bla" )
returns :
"\nBla bla bla" "\nBla bla bla"
It's even stranger the fact that the
\n
caracters are printed as well !
I admit I am a little rusty in Lisp , so the reason why this is happening may be quite simple and funny , but even if you laugh at me , please , tell me what to do in order to solve this problem .
-
It could be that your last line of code is (princ MyText). If so, then the routine will print your your line as you want it to, but then it will also return it.
Command: (defun c:Test (/ MyText)
(_> (setq MyText "\n Bla bla bla.....")
(_> (princ MyText)
(_> )
C:TEST
Command: test
Bla bla bla....."\n Bla bla bla....."
-
When you use PRINC function, you must, place at the end a (PRINC) call.
-
Thanks a lot . You were both right .