Results 1 to 1 of 1

Thread: Anyone here any good with AutoCAD and Excel ?

  1. #1
    I could stop if I wanted to
    Join Date
    2005-08
    Posts
    378
    Login to Give a bone
    0

    Cool Anyone here any good with AutoCAD and Excel ?

    Guys,
    Are any of you any good with both AutoCAD and Excel ? I suppose one step at a time though wanting to have a csv files contents to be added. I have a routine that logs files being opened and closed. I am trying to get it to log the edittime rather just the time opened and closed. This seems to be an unsuccessful task at present though sure it will get there.
    Not sure what the best way is to get the objective though or how to do it and asking for a kind person to assist if and where they could.
    Is it possible to have the routine upon going to write to the log file check the csv file for a row containing that logs file name ? If so could we have the routine add the existing figure with the new one ?
    Or do we write the new log on the folowing line and then have the csv file add file hours with the common names ?

    Below is both the working open closed log and the current, not finished routine to write the edittime:


    Code:
    (vl-load-com)
    (defun DoThisOnClose (Caller CmdSet)
      (WriteLog "CLOSED")
      (princ)
    )
    
    
    (setq MyReactor1
           (vlr-dwg-reactor
    	 nil
    	 '((:vlr-beginClose . DoThisOnClose)
    	  )
           )
    )
    
    
    (defun WriteLog	(Event / Draftername Job file line2write)
      (if (/= (getvar "dwgname") "Drawing1.dwg")
        (progn
          (setq Draftername (getvar "loginname"))
          (setq Job (strcat (getvar "dwgprefix") (getvar "dwgname")))
          (setq file
    	     (open (strcat "S:\\DSA CAD\\USERLOG FILE\\UserLog-"
    			   (getvar "loginname")
    			   "-"
    			   (menucmd "M=$(edtime,$(getvar,date),YYYY-MO)")
    			   ".csv"
    		   )
    		   "a"
    	     )
          )
    
          (setq line2write
    	     (strcat
    	       Draftername
    	       ","
    	       Event
    	       ","
    	       (menucmd
    		 "M=$(edtime,$(getvar,date),YYYY/MO/D - HH:MM AM/PM)"
    	       )
    	       ","
    	       Job
    	     )
          )
    
          (write-line line2write file)
          (close file)
    
        )
      )
      (princ)
    )
    
    (WriteLog "OPENED")
    
    
    
    
    (vl-load-com)
    (defun DoThisOnClose (Caller CmdSet)
      (setvar "USERS1"
    	  (rtos (acet-getvar '("BNS_EDITTIME_TOTAL")) 2 10)
      ) ;_end setvar
      (WriteLog "CLOSED")
      (princ)
    ) ;_end defun
    
    
    (setq MyReactor1
           (vlr-dwg-reactor
    	 nil
    	 '((:vlr-beginClose . DoThisOnClose)
    	  )
           )
    ) ;_end setq
    
    
    (defun WriteLog	(Event / Draftername Job file line2write)
      (if (/= (getvar "dwgname") "Drawing1.dwg")
        (progn
          (setq Draftername (getvar "loginname"))
          (setq Job (strcat (getvar "dwgprefix") (getvar "dwgname")))
          (setq file
    	     (open (strcat "S:\\DSA CAD\\USERLOG FILE\\UserLog-"
    			   (getvar "loginname")
    			   "-"
    			   (menucmd "M=$(edtime,$(getvar,date),YYYY-MO)")
    			   ".csv"
    		   ) ;_end strcat
    		   "a"
    	     ) ;_end open
          ) ;_end setq
    
          (setq line2write
    	     (strcat
    	       Draftername
    	       ","
    	       Event
    	       ","
    	       (menucmd "M=$(edtime,$(getvar,date),YYYY/MO/D)")
    	       (if (= Event "CLOSED")
    		 (progn
    		   ","
    		   (menucmd "M=$(edtime,$(index,0,$(getvar,users1)),HH:MM:SS)"
    		   )
    		 ) ;_end progn
    	       ) ;_end if
    	       ","
    	       Job
    	     ) ;_end strcat
          ) ;_end setq
    
          (write-line line2write file)
          (close file)
    
        ) ;_end progn
      ) ;_end if
      (princ)
    ) ;_end defun
    
    (WriteLog "OPENED")

    Any assistance would be grately appreciated.

    Stephen
    Last edited by Opie; 2007-08-08 at 01:29 AM. Reason: [code] tags added

Similar Threads

  1. Replies: 11
    Last Post: 2022-11-30, 03:18 PM
  2. Replies: 5
    Last Post: 2013-10-16, 05:39 PM
  3. Replies: 1
    Last Post: 2012-08-08, 05:50 PM
  4. Replies: 1
    Last Post: 2009-04-29, 11:03 AM
  5. Import a good AutoCAD profile?
    By Dpump777 in forum AutoCAD General
    Replies: 2
    Last Post: 2005-12-15, 11:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •