Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to print last line of command history to a file

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
933 Views, 4 Replies

how to print last line of command history to a file

Backstory


I've been killing myself with trying to get the following (acet-getvar '("BNS_EDITTIME_TOTAL")) in standard time format

rather than julian and then printing it to a file.  I never found a way.  So I'm figuring the next best thing is to just run the edittime command and then set a custom variable to report the last line of the command history.  Then I can open a file and print it to the file.  But alas my skills are lacking.  Is there an easy way to do this?  

 

If I'm asking the wrong question, what I'm really after is copying the edittime value to a log file.  Thanks! 

4 REPLIES 4
Message 2 of 5
pbejse
in reply to: Anonymous


@Anonymous wrote:

Backstory


I've been killing myself with trying to get the following (acet-getvar '("BNS_EDITTIME_TOTAL")) in standard time format

rather than julian and then printing it to a file.  I never found a way.  So I'm figuring the next best thing is to just run the edittime command and then set a custom variable to report the last line of the command history.  Then I can open a file and print it to the file.  But alas my skills are lacking.  Is there an easy way to do this?  

 

If I'm asking the wrong question, what I'm really after is copying the edittime value to a log file.  Thanks! 


Look into this thread  -->  LISP to Export TIME Command Results to a Text File  <---

Message 3 of 5
Anonymous
in reply to: Anonymous

I started putting together the following response and attached sample lisp, but in the meantime it looks like pbejse referred you to a good posting.  But just in case your interested see below.

 

-----------------------------------------------------------------------------------------------------------------------------------

 

Seems as though your first approach may be the way to go, and that you need to use a JULIAN express tool function to convert the Julian Date/Time into a calendar date list which you can then reformat through lisp list manipulation.  Apparently you have to execute the JULIAN DATE function to activate the other commands in the JULIAN lisp application.

Other observations:

  • The BNS_EDITTIME_TOTAL variable can be used "to extract the elapsed time (up to the opening of the current editing session) from the current drawing" according to help.  So if you open a new file but do not save the file, BNS_EDITTIME_TOTAL returns nil.  BNS_EDITTIME_TOTAL will update each time you save the file.
  • The function (acet-edittime-total) apparently returns the total elapsed time the file has been edited since you turned on the edittime (acet-edittime-enable On) unless the you reset the time with the (acet-edittime-reset).
  • When you type EditTime command at the command line it is giving you the time equivalent to (acet-edittime-total).

I put togther the attached LISP program to illustrate some of what I am talking about.  I suggest you look at the code, while also viewing the Express Tool help for the EDITTIME and JULIAN tools.

I have not worked with these Express Tools before, much less date time format conversions, but those are my findings.

Message 4 of 5
Anonymous
in reply to: Anonymous

Thanks for the heads up on (acet-edittime-total).   I changed the file I'm writing out to to a csv since I can have excel convert julian time.  I was hoping I could write the edittime out to the file, but it doesn't seem to work.  Here's what I was trying:

 

(write-line (strcat "USER:," (getvar 'loginname) "," "EDIT TIME:," (acet-edittime-total) "\n") ofile)

 

This is only a portion of the code, which was actually from another post which does 99% of what I want but the only issue is that it returns the "TDUSRTIMER" value as the edittime which is less accurate than the edittime value we're discussing.  Here's a link to that post fyi:

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/ignorant-needs-help-with-lisp-routeen...

 

Thanks for your quick response and for your code.  I suspect if I knew more I could probably run it as a subroutine in the lisp and then just write out your line (+ (nth 3 ettotl-cdl) (/ (+ (nth 4 ettotl-cdl) (/ (nth 5 ettotl-cdl) 60)) 60)), but I'm currently at the stage of tweaking some pre-existing codes.  I'll take a look at Lee Mac's code and see what I can break there Smiley LOL

 

-Scott

 

Message 5 of 5
Anonymous
in reply to: Anonymous

Try the following instead:

 

(write-line (strcat "USER:," (getvar 'loginname) "," "EDIT TIME:," (rtos (acet-edittime-total) 2 8) "\n") ofile)

 

Looks like the posting you referenced is similar in nature to the one referenced by pbejse.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report