Author Topic: One Log file  (Read 343 times)

0 Members and 1 Guest are viewing this topic.

mohan

  • Newt
  • Posts: 24
One Log file
« on: November 19, 2019, 01:25:45 AM »
Please a small lisp.........need!

AutoCAD Text Windows should write into one Notepad
(When working with many drawings it should writing into one Notepad, you can specify the location & name of the Notepad - I can modify it as per my requirement)
While opening each drawings Full names + Full path should first write in the Notepad

thanks
"Save Energy"

Lee Mac

  • Seagull
  • Posts: 12290
  • London, England
Re: One Log file
« Reply #1 on: November 19, 2019, 03:00:14 PM »
Add the following to your acaddoc.lsp, change the text filename to suit:
Code - Auto/Visual Lisp: [Select]
  1. (   (lambda ( txt / des )
  2.         (if (setq des (open txt "a"))
  3.             (progn
  4.                 (write-line (strcat (menucmd "m=$(edtime,0,\"yyyy-mo-dd hh:mm:ss\")") "\t" (getvar 'dwgprefix) (getvar 'dwgname)) des)
  5.                 (close des)
  6.             )
  7.         )
  8.         (princ)
  9.     )
  10.     "C:\\YourFolder\\DrawingLog.txt"
  11. )

mohan

  • Newt
  • Posts: 24
Re: One Log file
« Reply #2 on: November 20, 2019, 03:35:45 AM »
I have found these acad2017doc.lsp, acad2017.lsp, acadinfo.lsp etc; not acaddoc.lsp
[I am using civil 3d as AutoCAD 2017]

Guide me............
"Save Energy"

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1019
  • Marco
Re: One Log file
« Reply #3 on: November 20, 2019, 04:33:34 AM »
Add the following to your acaddoc.lsp, change the text filename to suit:
Code - Auto/Visual Lisp: [Select]
  1. (   (lambda ( txt / des )
  2.         (if (setq des (open txt "a"))
  3.             (progn
  4.                 (write-line (strcat (menucmd "m=$(edtime,0,\"yyyy-mo-dd hh:mm:ss\")") "\t" (getvar 'dwgprefix) (getvar 'dwgname)) des)
  5.                 (close des)
  6.             )
  7.         )
  8.         (princ)
  9.     )
  10.     "C:\\YourFolder\\DrawingLog.txt"
  11. )
Inspired by your function I wrote:
Code: [Select]
(defun ALE_UtilsOnD_UserOpenClose (TxtOut BitFlg / FilPnt)
  (if (setq FilPnt (open TxtOut "a"))
    (progn
      (if (zerop BitFlg)
        (write-line (strcat "Close: " (menucmd "m=$(edtime,0,\"yyyy-mo-dd hh:mm:ss\")") "\t" (getvar 'DWGPREFIX) (getvar 'DWGNAME)) FilPnt)
        (write-line (strcat "Open:  " (menucmd "m=$(edtime,0,\"yyyy-mo-dd hh:mm:ss\")") "\t" (getvar 'DWGPREFIX) (getvar 'DWGNAME)) FilPnt)
      )
      (close FilPnt)
      (or
        (zerop BitFlg)
        (progn
          (vl-cmdf "_.UNDEFINE" "_CLOSE")
          (defun C:CLOSE ( )
            (ALE_UtilsOnD_UserOpenClose TxtOut 0)
            (vl-cmdf "_.CLOSE")
          )
          (defun C:CHIUDI ( ) (C:CLOSE))
        )
      )
    )
  )
  (princ)
)

Comando: CLOSE
>>error
<clip>
[4.31] (OPEN nil "a")
[5.25] (ALE_UTILSOND_USEROPENCLOSE nil 0)
[6.19] (C:CLOSE)
<clip>
How do I pass the argument TxtOut to the function?

Lee Mac

  • Seagull
  • Posts: 12290
  • London, England
Re: One Log file
« Reply #4 on: November 20, 2019, 08:10:58 AM »
I have found these acad2017doc.lsp, acad2017.lsp, acadinfo.lsp etc; not acaddoc.lsp
[I am using civil 3d as AutoCAD 2017]

Guide me............

No problem - simply create an AutoLISP file called acaddoc.lsp containing the above posted code within a Trusted Support Path, and such file will be automatically evaluated when a drawing is opened.

mohan

  • Newt
  • Posts: 24
Re: One Log file
« Reply #5 on: November 20, 2019, 12:12:30 PM »
I will reply tomorrow soon

thanks
"Save Energy"

mohan

  • Newt
  • Posts: 24
Re: One Log file
« Reply #6 on: November 26, 2019, 12:52:36 PM »
It's writing in one log file the time & the drawing path as below
Quote
2019-11-26 09:08:43   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 09:11:08   W:\1801 Design of Shin-Rowd Road_DGR\06-WORKING\X-Ref\X_1801_Proposed Layout - 2.dwg
2019-11-26 12:01:20   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 12:17:30   W:\1801 Design of Shin-Rowd Road_DGR\06-WORKING\X-Ref\X_1801_Proposed Layout - 2.dwg
2019-11-26 14:52:32   W:\1801 Design of Shin-Rowd Road_DGR\06-WORKING\02-Roads\01 Preliminary Design\IC 7\Layout - IC 7 - Option 7.dwg
2019-11-26 16:19:20   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 16:21:23   W:\1914 One Way Road System in Alir MM\02-TOPOGRAPHIC SURVEY\CONTOUR by cv3d.dwg
2019-11-26 20:04:56   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 20:06:24   C:\Users\mohan.RENA\Documents\Signs for weri.dwg
2019-11-26 20:06:38   C:\Users\mohan.RENA\Documents\Drawing2.dwg

but the text window not writing.......
"Save Energy"

Lee Mac

  • Seagull
  • Posts: 12290
  • London, England
Re: One Log file
« Reply #7 on: November 26, 2019, 04:26:26 PM »
It's writing in one log file the time & the drawing path as below
Quote
2019-11-26 09:08:43   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 09:11:08   W:\1801 Design of Shin-Rowd Road_DGR\06-WORKING\X-Ref\X_1801_Proposed Layout - 2.dwg
2019-11-26 12:01:20   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 12:17:30   W:\1801 Design of Shin-Rowd Road_DGR\06-WORKING\X-Ref\X_1801_Proposed Layout - 2.dwg
2019-11-26 14:52:32   W:\1801 Design of Shin-Rowd Road_DGR\06-WORKING\02-Roads\01 Preliminary Design\IC 7\Layout - IC 7 - Option 7.dwg
2019-11-26 16:19:20   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 16:21:23   W:\1914 One Way Road System in Alir – MM\02-TOPOGRAPHIC SURVEY\CONTOUR by cv3d.dwg
2019-11-26 20:04:56   C:\Users\mohan.RENA\Documents\Drawing1.dwg
2019-11-26 20:06:24   C:\Users\mohan.RENA\Documents\Signs for weri.dwg
2019-11-26 20:06:38   C:\Users\mohan.RENA\Documents\Drawing2.dwg

but the text window not writing.......

From your first post, I thought that you were only interested in the path & drawing filename; if you want the entire command-line history, turn on the in-built command line log file (LOGFILEON command or LOGFILEMODE system variable) and then consolate the files generated for each drawing if necessary (refer to the system variables LOGFILENAME & LOGFILEPATH).