Save / Log "Print Message" to file

More
4 years 11 months ago - 4 years 11 months ago #226126 by nkp
instead of the file currently loaded into task(s.file),
we must take the file loaded only initially (loaded_file)
 
so

        try:
            count = 0
            for line in open(loaded_file).xreadlines(): count += 1
            vars.len_program.set(count)

            fl = open('/home/nkp/emc2/logfile', "a")
            lnf = len(os.path.basename(loaded_file))
            fl.write(os.path.basename(loaded_file) + (28-lnf)*' ' + time.ctime() + "\n")       
            fl.close()        
        except :
            print "nkplogerror"
ps
probably this does not solve the problem
Last edit: 4 years 11 months ago by nkp.
The following user(s) said Thank You: +Jan+

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

More
4 years 11 months ago #226133 by +Jan+
Gave it a try, the result is following:
Code:
probekreis.ngc              Thu Nov 11 20:38:36 2021 # Logged on Cycle Start successful                  Thu Nov 11 20:39:22 2021 #Logged after end of first Tool Change

Than there is nothing more logged. Attached you can find my remap code (i can translate to english if neccesary)

Best wishes

Jan 

File Attachment:

File Name: messen.ngc
File Size:1.33 KB

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

More
4 years 11 months ago #226135 by nkp
Warning: Spoiler!

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

More
4 years 11 months ago #226136 by +Jan+
Haha so german is ok?!

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

More
4 years 11 months ago #226137 by nkp
the translator doesn't care =)

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

More
4 years 11 months ago - 4 years 11 months ago #226141 by nkp
do not read line number while subroutine
================================

o<messen> sub
m64p0
#1700=44            (Wechsel X Position)
#1701=0        (Wechsel Y Position)
...
...
m65p0
o<messen> endsub
M2
===============================================
    def update(self):


        if vars.len_program.get() and not self.stat.dout[0]:
            if self.stat.motion_line > (vars.len_program.get() - 4):
                vars.len_program.set(0)
                try:
                    fl = open('/home/nkp/emc2/logfile', "a")
                    fl.write("successful" + 18*' ' + time.ctime() + "\n")       
                    fl.close()        
                except :
                    print "nkplogerror"

==================
 it work for me with your gcode
Last edit: 4 years 11 months ago by nkp.

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

Time to create page: 0.375 seconds
Powered by Kunena Forum