well, actually it is a simplification and generalization of already existing 
code

I do admit it might sound 'mhaberler is off in  esoteric feature space' on 
first look

this is why (lengthy sermon alert):

In the context of remapping, some RS274 codes may be redirected to 
O-word procedures, like prepare and tool-change. 

When the procedure finishes, something must happen in the interpreter - 
like 'set the pocket number' or 'set the tool number'.

The question is: who does that how?

That clearly cannot be done by the procedure itself because G-code lacks access 
to 
internal interpreter state (for some good and for some not-so-good reasons)

So far, I used the idea of 'epilogue functions' - C++-code which executes after 
a
remapped procedure finishes. These were special-cased for tool-change as above.

However, the Python plugin allows to drop the special-purpose C++ code and 
generalize
the concept of epilogue functions which move to Python code. And C++ code which 
aint 
there doesnt restrict.

The obvious sister concept of 'prologue functions' - executed before a remapped 
procedure will also benefit from this, as they permit preparing an appropriate 
environment for the O-word procedure, parameter checks and so forth.

----

To give an idea how pieces will eventually fit together:

1. lets assume we remap M420 to just execute a O-word procedure and nothing 
else.
   this is the easy case because nothing special needs to be done before and 
after the call.

[CUSTOM]
# this means 'remap M420 to m420.ngc and execute in modal group 9 sequence'
# if there where an 'm420' function in the Python module, that would be 
executed instead of m420.ngc
CODE=M420,9 

This is the boring case because 'M420' now really is nothing more than a 
glorified subroutine call.


2. Now the case where things start making sense:   we remap Tx 
[CUSTOM]
CODE=T,6,tsub_prolog,tsub,tsub_epilog 

this means:
remap Tx to tsub.ngc and execute in modal group 6 sequence.

However, before calling tsub, execute the tsub_prolog Python function.
(this will pull the 'x' out of 'Tx', do some checks)

Plus, after calling tsub, execute the tsub_epilog Python function.
(this will set the appropriate interpreter internal variable on success)

---

bingo, special-case C++ code for toolchange gone (and yes, the curious
are empowered to shoot themselves in the foot now - or do something really
useful which wasnt possible so far, and/or nobody cared to code in C++)

making sense yet?

-Michael



Am 12.05.2011 um 13:00 schrieb andy pugh:

> On 7 May 2011 12:02, Michael Haberler <[email protected]> wrote:
> 
>> The interpreter has a Python plugin capability.
> 
> This looks like a very powerful concept. I suspect that the number of
> users who would ever use it is quite small, but it would make the
> answer to the question "Does EMC2 do X?" nearly always "No, but it
> could".
> 
> -- 
> atp
> "Torque wrenches are for the obedience of fools and the guidance of wise men"
> 
> ------------------------------------------------------------------------------
> Achieve unprecedented app performance and reliability
> What every C/C++ and Fortran developer should know.
> Learn how Intel has extended the reach of its next-generation tools
> to help boost performance applications - inlcuding clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> Emc-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-developers


------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to