Use M100 to send popup messages - my solution

More
01 Mar 2019 13:12 - 01 Mar 2019 13:17 #127409 by TwoFeetDown
I have wanted a method of displaying popup reminders during code execution for some time (I'm getting old and forgetful and need constant prompting) and, I wanted it to be easy to maintain the messages.

After searching for some time and not finding what I wanted I decided to write my own Python script that pulls messages out of a good old-fashioned INI file that is easy to edit.

I use
M100 Px
to call the popup where x can be any positive number.
The popup (ugly as it is :) displays the message and offers large 'Continue' and 'Stop Executing' buttons that can be clicked with a mouse (sometimes I 'mouse' left-handedly), or you can use the [Enter] or [Esc] keys. 'Continue' allows the program to resume executing, 'Stop Executing' stops execution (duh!)

Unzip M00 Messages.zip and:
Place Messages.ini in your linuxcnc/configs/ folder.
Place M100 in your linuxcnc/nc_files/ folder

You will need to edit a couple lines of M100.
Change
user="jim"
and
title="Jim's CNC"
to reflect your username and the title you wish to display on the popup

Change the permissions on M100 to make it executable. (Right-click on M100, click on Properties, then on Permissions, and check 'Allow this file to run as a program')

Place the line
M100 P0
in your program and try it.

By the way, I'm not much of a Python programmer (give me VB6 any day - sure wish it worked in Linux!) so I'm certain those of you who know Python will have all sorts of improvements that could be made to this. I welcome them and am interested in seeing them.
-Jim
Attachments:
Last edit: 01 Mar 2019 13:17 by TwoFeetDown.

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 13:17 #127412 by pl7i92
You shoudt not use M100 at all
as it is internal linked to Featurers use from 160 UP

BUT it is great eyample

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 13:21 #127415 by TwoFeetDown
I don't understand what you mean. I have seen suggestions that M1xx could be used this way. Might this interfere with some other feature?

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 13:22 #127416 by pl7i92
you can use from 100-200
BUT as you posted a Realy good Idee and it may be sticky
yoiu shoudent do this with the First eighter the Last UserMcode

Please Log in or Create an account to join the conversation.

More
01 Mar 2019 13:35 #127420 by TwoFeetDown
I'm really sorry to be so dense and I really appreciate your input.

So it would be better if I use M199 instead of M100 ?
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
02 Mar 2019 18:08 #127525 by TwoFeetDown
If you are concerned about using M100 specifically you can use any of the available codes (M100 - M199). Just change 'M100' to the code you wish to use wherever it occurs.

Please Log in or Create an account to join the conversation.

More
04 Mar 2019 11:23 #127679 by pl7i92
The M codes up to M112 are used to set things in NGCgui
so if you are on a plain mashine you are ok
if somone ads Lrts Say TrueType tracer
he might be in troubel

so for good component selfmade it is best to be over that number

It Doesen Matter at all if someone knows How to EDIT the system

Please Log in or Create an account to join the conversation.

More
04 Mar 2019 14:35 #127702 by TwoFeetDown
Thanks. I didn't know that. Learn something every day! :)

Please Log in or Create an account to join the conversation.

More
08 Mar 2019 17:21 #128094 by TwoFeetDown
I have taken pl7i92's comments about not using some Mxxx codes to heart and have rewritten M100 so it can be renamed any name from M100-M199.

To try this out:
Place both files from the attachment in your linuxcnc/nc_files folder
Rename both files - replace each 'M100' with the 'Mxxx' of your choice
Make Mxxx executable

Next time you start AXIS a call to
Mxxx P2
will display the message 'Turn vacuum on'

You can test this from the MDI [F5] screen without having to actually put it in in your code.

Instructions are included as comments in M100

If you wish, you can create message files for specific uses. Just copy M100 and rename the copies M199, M198, etc. and create M199messages.ini, M198messages.ini

File Attachment:

File Name: Jimsmessag...stem.zip
File Size:3 KB

File Attachment:

File Name: Jimsmessag...stem.zip
File Size:3 KB

File Attachment:

File Name: Jimsmessag...stem.zip
File Size:3 KB

Hope you find this useful,
Jim
Attachments:
The following user(s) said Thank You: Stormholt

Please Log in or Create an account to join the conversation.

More
08 Mar 2019 17:23 #128095 by TwoFeetDown
Sorry for the triplicated attachments. They are identical.
The following user(s) said Thank You: petmakris

Please Log in or Create an account to join the conversation.

Time to create page: 0.081 seconds
Powered by Kunena Forum