Save / Log "Print Message" to file
- +Jan+
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 15
11 Nov 2021 15:11 #226112
by +Jan+
Replied by +Jan+ on topic Save / Log "Print Message" to file
Thank you for your effort. I have implemented the changes and tried them out. Everything works fine as long as no macro calls are in game.Unfortunately, since I use the remap command with macro call for my manual tool change, the current solution does not work:
If the required tool (Tool 9) is not in the spindle at cycle start, only the file name of the tool change macro with timestamp appears in the log file. The success is not logged.
If the tool (tool 9) is already in the spindle, the start is logged with the actual file name. At the first tool change (tool 11) success is logged and then nothing more.
Here the G Code file I used for evaluation:
Best wishes
Jan
If the required tool (Tool 9) is not in the spindle at cycle start, only the file name of the tool change macro with timestamp appears in the log file. The success is not logged.
If the tool (tool 9) is already in the spindle, the start is logged with the actual file name. At the first tool change (tool 11) success is logged and then nothing more.
Here the G Code file I used for evaluation:
N0010 (Filename: probekreis.ngc)
N0020 (Post processor: EMC_G64_REV00_dyn_wmsg.scpost)
N0030 (Date: 10/11/2021)
N0040 G21 (Units: Metric)
N0050 G40 G90
N0060 F1
N0070 (Part: probekreis)
N0080 (Operation: Outside Offset, STANDARD, T9: Fraeser, 6 mm, 0 mm Deep)
N0090 G64P0.025
N0100 M6 T9 (Fraeser, 6 mm)
N0110 G00 Z6.0000
N0120 M03 S24000
N0130 X19.7990 Y19.7990
N0140 Z1.5000
N0150 G01 Z1.0000 F2000
N0160 G03 X19.7990 Y19.7990 I-19.7990 J-19.7990 F3800.0
N0170 G00 Z6.0000
N0100 M6 T11 (Fraeser, 6 mm)
N0110 G00 Z6.0000
N0120 M03 S24000
N0130 X19.7990 Y19.7990
N0140 Z1.5000
N0150 G01 Z1.0000 F2000
N0160 G03 X19.7990 Y19.7990 I-19.7990 J-19.7990 F3800.0
N0170 G00 Z6.0000
N0100 M6 T9 (Fraeser, 6 mm)
N0110 G00 Z6.0000
N0120 M03 S24000
N0130 X19.7990 Y19.7990
N0140 Z1.5000
N0150 G01 Z1.0000 F2000
N0160 G03 X19.7990 Y19.7990 I-19.7990 J-19.7990 F3800.0
N0170 G00 Z6.0000
N0180 M05
N0190 M05 M30
Best wishes
Jan
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
11 Nov 2021 17:57 #226124
by nkp
Replied by nkp on topic Save / Log "Print Message" to file
need your file remap
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
11 Nov 2021 18:33 - 11 Nov 2021 19:36 #226126
by nkp
Replied by nkp on topic Save / Log "Print Message" to file
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
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: 11 Nov 2021 19:36 by nkp.
The following user(s) said Thank You: +Jan+
Please Log in or Create an account to join the conversation.
- +Jan+
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 15
11 Nov 2021 19:47 #226133
by +Jan+
Replied by +Jan+ on topic Save / Log "Print Message" to file
Gave it a try, the result is following:
Than there is nothing more logged. Attached you can find my remap code (i can translate to english if neccesary)
Best wishes
Jan
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
Attachments:
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
11 Nov 2021 19:54 #226135
by nkp
Replied by nkp on topic Save / Log "Print Message" to file
Warning: Spoiler!
(i can translate to english if neccesary) I don't know English at all =)
Please Log in or Create an account to join the conversation.
- +Jan+
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 15
11 Nov 2021 20:02 #226136
by +Jan+
Replied by +Jan+ on topic Save / Log "Print Message" to file
Haha so german is ok?!
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
11 Nov 2021 20:05 #226137
by nkp
Replied by nkp on topic Save / Log "Print Message" to file
the translator doesn't care =)
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
11 Nov 2021 21:01 - 11 Nov 2021 21:05 #226141
by nkp
Replied by nkp on topic Save / Log "Print Message" to file
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
================================
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: 11 Nov 2021 21:05 by nkp.
Please Log in or Create an account to join the conversation.
- +Jan+
- Offline
- Senior Member
Less
More
- Posts: 60
- Thank you received: 15
11 Nov 2021 23:31 - 11 Nov 2021 23:33 #226160
by +Jan+
Replied by +Jan+ on topic Save / Log "Print Message" to file
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:
Is this correct? Dangerous copy and paste...
Best regards
Jan
I left "user_live_update() " in the 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: 11 Nov 2021 23:33 by +Jan+.
Please Log in or Create an account to join the conversation.
- nkp
- Offline
- Premium Member
Less
More
- Posts: 147
- Thank you received: 39
12 Nov 2021 06:41 - 12 Nov 2021 06:43 #226191
by nkp
Replied by nkp on topic Save / Log "Print Message" to file
Attachments:
Last edit: 12 Nov 2021 06:43 by nkp.
Please Log in or Create an account to join the conversation.
Time to create page: 0.089 seconds