Re: [Emc-users] Issues with reloading from Oword

2017-11-03 Thread Terence Delia
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

Re: [Emc-users] Issues with reloading from Oword

2017-11-02 Thread Terence Delia
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


Re: [Emc-users] Issues with reloading from Oword

2017-11-02 Thread andy pugh
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


[Emc-users] Issues with reloading from Oword

2017-11-02 Thread Terence Delia
Hello Sirs/Ladies,


I was wondering if any has encountered/worked around this issue:


Following bizarre behavior related to a remapped M6 (the machine would 
automatically load the last gcode file without me knowing), I came in need to 
have the machine automatically reload the gcode file following an abort/manual 
stop of a program run. I have included the attached oword module, and 
 is set to be called from ini file.

All is fine with no errors, except that the reload takes more than 30 seconds 
to finish. Even manually calling the function from MDI takes that long. On the 
other hand, clicking the reload button on AXIS gui takes less than a second to 
perform the reload. Also, manually issuing the "axis-remote --reload" from 
terminal takes just a second or so. Am I missing something here?


...Of course, a better solution would be to keep the machine from changing 
gcode file on its own accord

Thank you and kind regards,

terans
from interpreter import *
import os

def on_abort(self, *words):
print("aborting")
self.execute("M65 P00")
self.execute("M65 P01")
self.execute("T0")
os.system("axis-remote --reload ")

def reload(self, *words):
os.system("axis-remote --reload ")
--
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