Am 19.06.2011 um 17:44 schrieb Stephen Wille Padnos:
> alan wrote:
>> Hello everyone,
>>
>> I asked the two questions written below on the forum at linuxcnc.org and
>> was advised that this group would be more likely to give me an answer.
>>
>> I understand that the user defined commands M100 etc allow me to run a
...
>>
> You would have to modify the G-code interpreter to add parameters to the
> M1xx calls, which would not be trivial.
>
> Note also that the M1xx programs do not return any values to the
> interpreter. If your intent is to load a value into a #parameter, that
I'm working on EMC to support new G&M-codes (which is really a generalization
and simplification of the toolchange issues).
This code has the capability to define a new code, and completely define its
semantics as a Python function, including access
to all words on the command line. Alternatively an NGC procedure may be used.
It would probably solve your problem.
To give a sneak preview how this works: in the ini file you would define, say,
M251:
[RS274NGC]
REMAP=M251 modalgroup=10 argspec=Pqijk python=myfunc
roughly meaning: M251 has mandatory words P, and optional words q,i,j,k; if
found, execute the Python callable 'myfunc'
also, execute this alongside outer modal group 10 codes.
and in the interpreter Python plugin code you would write:
def myfunc(**words):
p = words['p']
if (words.has_key('q')):
# do stuff if q is set ..
return INTERP_OK
If that is still too high-level, the parsed G-code block, internal state and
the canon layer is completely available in Python, too:
def introspect(args,**kwargs):
r = interp.remap_level
print "selected_pocket=",interp.selected_pocket
print "blocks[r].p_flag=",interp.blocks[r].p_flag
print "blocks[r].p_number=",interp.blocks[r].p_number
print "blocks[r].q_flag=",interp.blocks[r].q_flag
print "blocks[r].q_number=",interp.blocks[r].q_number
All this is currently executed at readahead time. Support to handle queue
busters (toolchange, HAL input, probe) in Python is in place.
---
That said, I have still a major step ahead - reworking access to the tool
table, which affects a lot of code - which makes a release likely "later this
summer".
-Michael
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers