Referring to the attached txt file, I had to insert a yield
INTERP_EXECUTE_FINISH just before my "EPILOG". I have to set global variables
for the machine to remember what tool is active, and what tool is in the
spindle AFTER the "yield INTERP_EXECUTE_FINISH". (The machine is a router and
has multiple drills and spindles, one of which is able to pick tools from
pockets, while the rest are just lowered by pneumatic cylinders when active)
Doing otherwise caused readahead to set such variables before the actual
toolchange takes place, hence when I stop the machine during program runs, the
global variables always reflect the "next tool in the program" and not what is
actually active.
Inserting "yield INTERP_EXECUTE_FINISH" kinda solved the readahead issue, but
then in the following conditions:
- I open part1.nc in axis and run it without problem
- I open part2.nc in axis
- I run part2.nc
- I manually stop part2.nc midway
- part1.nc is loaded back automatically. Titlebar shows part1.nc. Axis Preview
still shows part2.nc. Pressing RUN from axis actually runs part1.nc!!
- Manually pressing CTRL-R or reload icon reloads part2.nc
Kind Regards,
Terence
From: Terence Delia
Sent: Thursday, November 2, 2017 10:40 PM
To: Enhanced Machine Controller (EMC)
Subject: Re: [Emc-users] Issues with reloading from Oword
It has to do with yield INTERP_EXECUTE_FINISH and code following it in the M6
function. The remap has been done purely in python, I will attach the code
tomorrow from my shop. Thanks!
From: andy pugh
Sent: Thursday, November 2, 2017 9:11 PM
To: Enhanced Machine Controller (EMC)
Subject: Re: [Emc-users] Issues with reloading from Oword
On 2 November 2017 at 08:03, Terence Delia wrote:
> Following bizarre behavior related to a remapped M6 (the machine would
> automatically load the last gcode file without me knowing),
Can we start there. I have not heard of this problem before, and I
would imagine that we would have done.
Can you describe steps to reproduce it?
--
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1916
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users
from interpreter import *
from emccanon import MESSAGE, SET_MOTION_OUTPUT_BIT,
CLEAR_MOTION_OUTPUT_BIT,SET_AUX_OUTPUT_BIT,CLEAR_AUX_OUTPUT_BIT,CHANGE_TOOL,STRAIGHT_FEED,STRAIGHT_TRAVERSE
import ConfigParser
import linuxcnc
c = linuxcnc.command()
s = linuxcnc.stat()
throw_exceptions = 1
configParser = ConfigParser.RawConfigParser()
_sticky_params = dict()
_current_tool = 0
_tool_in_hsd = 0
def m6(self):
if self.task==0:
yield INTERP_OK
result = m6_prolog(self)
if result == 1:
print("m6 prolog ready")
yield INTERP_EXECUTE_FINISH
elif result == 2:
print("M6: no change required")
yield INTERP_OK
else:
print("M6: prolog error")
yield INTERP_ERROR
if m6_epilog(self) == 1:
print("m6 epilog ready")
yield INTERP_OK
else:
print("M6: epilog error")
yield INTERP_ERROR
def m6_prolog(self):
global _current_tool
global _tool_in_hsd
print("Current tool: %d, HSD: %d, Selected: %s" % (_current_tool,
_tool_in_hsd, self.selected_tool))
if self.selected_pocket < 0:
self.set_errormsg("M6: no tool prepared")
return 0
if self.cutter_comp_side:
self.set_errormsg("Cannot change tools with cutter radius compensation
on")
return 0
#self.params["tool_in_spindle"] = self.current_tool
self.params["selected_tool"] = self.selected_tool
self.params["current_pocket"] = self.current_pocket # this is probably
nonsense
self.params["selected_pocket"] = self.selected_pocket
if _current_tool == self.selected_tool and not self.selected_tool == 0:
print("exiting prolog, nothing to do; current: %d, HSD: %d, selected:
%s" % (_current_tool, _to