Save / Log "Print Message" to file

More
4 years 11 months ago - 4 years 11 months ago #226160 by +Jan+
Very creative approach. I put the M64Pxx on an output that I don't use. Seems to work fine so far. Thanks a lot!

I left "user_live_update() " in the code:
Code:
def update(self): if not self.running.get(): return try: self.stat.poll() except linuxcnc.error, detail: print "error", detail del self.stat return if ( (self.stat.motion_mode == linuxcnc.TRAJ_MODE_COORD) and (self.stat.task_mode == linuxcnc.MODE_MANUAL) ): set_motion_teleop(1) if ( (self.stat.motion_mode == linuxcnc.TRAJ_MODE_TELEOP) and not vars.teleop_mode.get() ): vars.teleop_mode.set(1) # CHANGES FOR LOGFILE if vars.len_program.get() and not self.stat.dout[10]: if self.stat.motion_line > (vars.len_program.get() - 4): vars.len_program.set(0) try: fl = open('/home/cnc/linuxcnc/logfile', "a") fl.write("successful" + 18*' ' + time.ctime() + "\n") fl.close() except : print "nkplogerror" user_live_update() # CHANGES FOR LOGFILE

Is this correct? Dangerous copy and paste...

Best regards

Jan
Last edit: 4 years 11 months ago by +Jan+.

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

More
4 years 11 months ago - 4 years 11 months ago #226191 by nkp
This will not work  user_live_update()
This is for the file .axisrc
===================
Code:
 
Warning: Spoiler!
Last edit: 4 years 11 months ago by nkp.

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

More
4 years 11 months ago - 4 years 11 months ago #226204 by +Jan+
Ok, so I removed it from the axis file and did not any modifications on the .axisrc file...
I have changed the formatting so that I can import the log file into Excel as a space separated CSV file if needed. I have also added the cycle abort as a log event.
The Log file looks now this way:
Code:
probekreis.ngc started Fri Nov 12 10:10:39 2021 probekreis.ngc finished Fri Nov 12 10:11:28 2021 test.ngc started Fri Nov 12 10:12:06 2021 test.ngc aborted Fri Nov 12 10:12:14 2021 probekreis.ngc started Fri Nov 12 10:12:22 2021 probekreis.ngc finished Fri Nov 12 10:13:37 2021

If someone wants to create his logfile this way in the future, I attach my Axis file (works with Linuxcnc 2.8.2). All blocks which have to be inserted are marked with "# Logfile... "(how to proceed with macros is also explained in the notes). 

The necessary steps are as follows:
- Create a file with e.g.: the name logfile (give all users read/write permissions to the file: right click Properties/Permissions...)
- Insert the marked blocks into your Axis file (located in usr/bin/).
- Adapt the file path in the different blocks in the Axis Python file to the location of your logfile.

Thats it... Thanks again to nkp for all the help.

File Attachment:

File Name: axis.zip
File Size:34.91 KB
Last edit: 4 years 11 months ago by +Jan+.

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

More
4 years 11 months ago #226206 by MaHa
How are you keeping this modification permanent? When i made some small patch to axis, it is gone sometimes after updates, and i had to do it again.

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

More
4 years 11 months ago - 4 years 11 months ago #226209 by nkp
you can place the file axis in the config folder (next to the INI file)
give the file execute permission 
then in the INI file :

[DISPLAY]
DISPLAY = ./axis
ps
you can also install the rip version
and it will not be updated 
 
Last edit: 4 years 11 months ago by nkp.
The following user(s) said Thank You: +Jan+, MaHa

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

Time to create page: 0.365 seconds
Powered by Kunena Forum