Report of work

More
01 Dec 2011 16:25 #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
01 Dec 2011 19:21 #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
03 Dec 2011 17:57 #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
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
06 Dec 2011 15:14 #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,
#!/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:-
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:30 KB
Attachments:

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

More
07 Dec 2011 16:54 #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
07 Dec 2011 18:13 - 08 Dec 2011 10:53 #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
Attachments:
Last edit: 08 Dec 2011 10:53 by ArcEye.

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

More
08 Dec 2011 10:52 - 08 Dec 2011 14:26 #15471 by ArcEye
Replied by ArcEye on topic Re:Report of work
Apologies, that's what you get for rushing.

Not using python myself I had not realised that it would not open a new file if the mode was set to 'rw'.
I changed the mode at some point after I had already created the file so didn't get any errors.

The axis files are now amended, tested and work.

The earlier axis file is 2.4.5 not 2.4.6, as I don't have that on my system.

regards

(see later post for updated zip)
Attachments:
Last edit: 08 Dec 2011 14:26 by ArcEye.

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

More
08 Dec 2011 10:54 #15472 by gois
Replied by gois on topic Re:Report of work
Good day!
The think I'm doing something wrong, they still did not work, I will explain step by step how I'm doing.

User terminal and alert by deleting the files am root axis and axis-remote that are in the folder / usr / bin.
Then I am sending to the / usr / bin files and axis axis-2.4.6-remote that you sent me.
Then I'm renaming the 2.4.6 to axis-axis and giving 755 permissions via chmod.

So I'm opening the axis, ... have had an evolution, the axis is now open normally, but does not save anything in / tmp / filename.txt


I did another test by adding code in the file M121 bash to see if it was running and I could confirm that it is running normally.

The problem I'm noticing is that the file filename.txt is not getting the file name. Ngc.



The only thing missing is to have the ngc file name is sent to open the filename.txt so I can use this information to my file using the M121.

Thanks for the help,

Evan F. Gois

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

More
08 Dec 2011 11:33 #15474 by ArcEye
Replied by ArcEye on topic Re:Report of work
Hi

See my last post, I had set the file mode to 'rw' not realising that python would not open a new file in that mode.

Download the revised zip and swap the axis-2.4.5 for your /usr/bin/axis and it should work now.

Don't forget that axis must have a file loaded before you use M121 P1 or it will fail because of that too.

regards

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

More
08 Dec 2011 13:20 #15477 by gois
Replied by gois on topic Re:Report of work
Hello, I have not had success, did not indicate more information on recording infirm filename.txt.
The result of what I have in my report joglog.txt is this:

JOB FILE NAME
*************
Started at: -
Thu Dec 8 11:14:03 EST 2011
Ended at: -
Thu Dec 8 11:14:35 EST 2011

grateful for the help.

Evan F. Gois

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

Time to create page: 0.077 seconds
Powered by Kunena Forum