Report of work

More
14 years 11 months ago #15259 by gois
Report of work was created by gois
Good afternoon!
I'm doing a script to generate a report that tells you the name, start time and end time of each job running on EMC2.

What I am in doubt is how to pass a variable to the name of the file being executed.

The remainder of the information I added in a shell script with the name of m150 and M151 RERA information that start and end of work, now we just need help to add the name of the file that is running on this same report.]

grateful

Gois

Please Log in or Create an account to join the conversation.

More
14 years 11 months ago #15262 by BigJohnT
Replied by BigJohnT on topic Re:Report of work
Not that this answers your question but in 2.5 there is a timer comp for elapsed time.

John

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #15335 by ArcEye
Replied by ArcEye on topic Re:Report of work
Hi

The current file is held in the variables initialfile when starting up and loaded_file when running, in axis.py

What you want is not as simple as it perhaps should be, because M code scripts can only deal with float values not strings.

Some re-writing in python will probably be required to store the loaded_file string somewhere accessible, you may even have to write it to file.

The last file loaded can be accessed from ~/axis_preferences in the recentfiles heading, but this is only updated when Axis closes.
To access this you need something like
Code:
lastfile = "" recent = ap.getpref('recentfiles', [], repr) if len(recent): lastfile = recent.pop(0)

A solution that comes to mind is to amend axis.py to write the loaded_file to filename.txt whenever it is changed or set.
Then write a C or even Bash program M1XX which receives the time data as params from M code calls in gcode and then reads the filename.txt to get the current file name and then outputs the stats as required.

There are of course many types of cats and many other ways of skinning them

regards

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #15427 by ArcEye
Replied by ArcEye on topic Re:Report of work
Hi

OK I have a solution for you.

I have done what I suggested that you do and altered Axis. It now accepts a new remote command get_file_name.
I have also altered axis-remote so that it has a new switch --get.

When axis-remote --get is run, Axis will write the current loaded file to /tmp/filename.txt

Then using a M code script which I called M121,
Code:
#!/bin/bash if [ ! $# -ge 1 ]; then echo "Usage: M121 n - where n is 1 (start 2 (end " exit 1 fi float=$1 int=${float/\.*} case $int in 1 ) axis-remote --get echo "JOB FILE NAME" >> /tmp/joblog.txt echo "*************" >> /tmp/joblog.txt cat /tmp/filename.txt >> /tmp/joblog.txt echo "Started at:-" >> /tmp/joblog.txt date >> /tmp/joblog.txt;; 2 ) echo "Ended at:-" >> /tmp/joblog.txt date >> /tmp/joblog.txt;; esac exit 0 you now can just code

M121 P1
.
. (rest of your gcode)
.
M121 P2

and you will get a file called /tmp/joblog.txt which contains for example:-
Code:
JOB FILE NAME ************* /home/bob/emc2/ngc/blank.ngc Started at:- Tue Dec 6 14:47:30 GMT 2011 Ended at:- Tue Dec 6 14:54:32 GMT 2011

The emc version is 2.6, axis-remote should just run , don't think it has been changed for a while.
The alterations to axis are lines 1884 - 1903, if this version of axis does not run on your build.

zip of all files attached




regards

File Attachment:

File Name: jobtimestamp.zip
File Size:29.51 KB

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago #15447 by gois
Replied by gois on topic Re:Report of work
Good afternoon!
First I would like to thank ArcEye for help because I have already clarified many doubts.
I tried using the files that vece left here on the topic, most did not work properly.
I am using AXIS 2.4.6, terial any changes I need to do to work in this version.

Thank you and help and I'm sorry clerical errors, because I am Brazilian and I am using a translation tool.

Please Log in or Create an account to join the conversation.

More
14 years 10 months ago - 14 years 10 months ago #15450 by ArcEye
Replied by ArcEye on topic Re:Report of work
Hi

As I suspected the axis-remote from 2.4.6 and 2.6 are identical

I have patched the axis file from 2.4.6 and included it in this new zip, just need to rename it /usr/bin/axis and make sure is set
to 755 with chmod.
They were all created as root so you may need to chown them to your user ID or run as root.

M121 needs to be 755 (executable) and in the directory listed in your .ini file under [DISPLAY] PROGRAM_PREFIX =
but I assume you know about that as you spoke of using M codes in your initial post.



regards

See next post for updated zip
Last edit: 14 years 10 months ago by ArcEye.

Please Log in or Create an account to join the conversation.

Time to create page: 0.114 seconds
Powered by Kunena Forum