I am implementing laser cutting with ink-jet part marking solution. Ink-jet 
printer/head is attached near the laser head. It accepts one text string to be 
printed via some serial data channel, then waits for start signal on a 
dedicated wire. I get acknowledgments for text received and text printed from 
the printer.

I decided to use ;py,mark_text("ABC 123") syntax in G-code. All python code is 
in toplevel.py or imported from there..
It works, but I don't know how to raise an error for the program to stop and give message 
to operator, like "Some printer communication time-out..".

If I use:
    from emccanon import CANON_ERROR
    CANON_ERROR("Do you see the printer? I can't find it!")

Then UI shows the error message, but program is not stopped.

Then if I write:
    import linuxcnc
    from emccanon import CANON_ERROR
    c = linuxcnc.command()
    CANON_ERROR("I'm lost, please help me!")
    c.abort()

Program aborts, but no message appears.

I thought I could use:
    from hal import set_p
    from emccanon import CANON_ERROR
    CANON_ERROR('Here, I found a pencil for ya! Might be broken, sorry..')
    set_p("halui.program.stop", '1')

It is the same to my surprise - still no message.


-
Other questions related to this solution:
2. No way to pass string parameter from NGC? I found ;py,whatever('is the only 
solution').
3. How to make ;py blocking()? I use M6 Tn before ;py nonblocking() to make it 
work on time.
4. Idea: even HAL pins could accept strings...
5. How to program serial communication with receiver call-back or thread 
working in background, waiting for print confirmation, which would allow to 
send next string and continue motion without stopping for communication with 
printer.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to