Author Topic: One Log file  (Read 3831 times)

0 Members and 1 Guest are viewing this topic.

mohan

  • Newt
  • Posts: 98
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: 12905
  • 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: 98
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: 1451
  • 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: 12905
  • 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: 98
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: 98
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: 12905
  • 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).

mohan

  • Newt
  • Posts: 98
Re: One Log file
« Reply #8 on: February 04, 2021, 08:57:03 AM »
Dear Colleagues,

Ohh......  ok guys, after a long time !
I wanted to complete this Thread.

Command: LOGFILEON
Code: [Select]
[ AutoCAD - Thu Feb 04 12:06:09 2021  ]----------------------------------------
But I Prefer to display the first line of the Notepad as below !
Code: [Select]
Thursday, 04-February-2021, AutoCAD at W:\XXXXXXXX\XXXXXXX\ACAD\XREF\Drawing2.dwg (full path)
Thanks a lot.
"Save Energy"

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: One Log file
« Reply #9 on: February 04, 2021, 07:21:05 PM »
This may be useful  can create a log file for each dwg. I had it working for individual users. Could be called spy ware.

A man who never made a mistake never made anything