Fixed Saving-Path for Logfile from a LISP-Code

Fixed Saving-Path for Logfile from a LISP-Code

Anonymous
Not applicable
500 Views
3 Replies
Message 1 of 4

Fixed Saving-Path for Logfile from a LISP-Code

Anonymous
Not applicable

Hello everyone,

the situation is as follows:

 

I use a Lisp script in ACA which writes a log file at the end. Now It is programmed that the LOGFile will always be placed in the location of the DWG file, that I am applying the script to. Sometimes it doesn't work for some inexplicable reason, so I wanted to specify a fixed saving-location, e.g. "C: / Temp" What is the order for that?

Here is my previous code for flexible saving.
------------------------------------------------------
(Defun WriteLogT (textzeile / filename Logdatei)
(setq filename (if (> (vl-string-search "\\" (getvar "DWGNAME") 0) 0)
(getvar "DWGNAME")
(strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))
)
)
(if (setq Logdatei (open (strcat filename "Logdatei.LOG") "a"))
(progn
(write-line (vl-string-subst "" "\n" Textzeile) Logdatei)
(close logdatei)
)
)
)
------------------------------------------------------


Perhaps you can use that to find a solution.

Thank you

Erik

0 Likes
501 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

Possibly like this?

 

(Defun WriteLogT (textzeile / Logdatei)
  (if (setq Logdatei (open "c://Temp//Logdatei.LOG" "a"))
    (progn
      (write-line (vl-string-subst "" "\n" Textzeile) Logdatei)
      (close logdatei))))

 

Message 3 of 4

Anonymous
Not applicable

Thanks for the fast reply!

 

How i have to rewrite your code to us a alternate Filename?
In my case, the Logname depends on the DWG name wich the LISP applied to.
Like this:

yxz.dwg --> yxz-Log.log
123.dwg --> 123-Log.log

I tried to use my original string, but doesn't work.
(Defun WriteLog (textzeile)
(if (setq Logdatei (open c://Temp// (strcat (getvar "DWGNAME") "-XYZ.LOG") "a"))
(progn
(write-line (vl-string-subst "" "\n" Textzeile) Logdatei)
(close logdatei)
)
)
)

 

Maybe you have a clue.
Thanks a lot
Erik

0 Likes
Message 4 of 4

ВeekeeCZ
Consultant
Consultant

... then you can fix it using THIS  fnc

0 Likes