Hello Guest it is March 29, 2024, 04:34:25 AM

Author Topic: Getting this error when I try to use a message box with my M6 Script  (Read 1006 times)

0 Members and 1 Guest are viewing this topic.

Offline jevs

*
  •  315 315
    • View Profile
I am getting this error when a message box pops up to enter information when tripped within the M6 Script.

I check to see if the current tool is a valid one and also if the asked for tool is a valid one. If not, I pop up a window to accept correct values to be selected.

If either message box pops up, I get this error. Once I hit Cancel to ignore it, then everything works fine from that point on as far as the message boxes operation and M6 macro.

The error happens before anything is selected with the message box.

I did submit this to Artsoft.

Wondering if anyone knows if I am doing something wrong or if this is a known bug or what?

Maybe popping up a box to enter something from an M code script is a rule violation? Not sure why it would be. I did this in Mach3 with my M6 script. 
« Last Edit: August 05, 2019, 11:39:04 PM by jevs »

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Getting this error when I try to use a message box with my M6 Script
« Reply #1 on: August 05, 2019, 11:55:40 PM »
The error is what it says.  You can't use wxMessageBox in any thread other than the main thread.  But it is a programmer error and not a bug type of error.  You can use wxMessageBox() in the PLC script because the PLC script is run in the main thread of the GUI. 

Using wxMessageBox() isn't a really good idea inside of Mach.  It is there because it is part of wxLua.  But just because it is there doesn't mean it is a good thing to use.  Use mc.mcCntlSetLastError() instead.  Or have the PLC script look at a flag or something to use wxMessageBox().

Steve
« Last Edit: August 06, 2019, 12:17:57 AM by smurph »

Offline jevs

*
  •  315 315
    • View Profile
Re: Getting this error when I try to use a message box with my M6 Script
« Reply #2 on: August 06, 2019, 12:00:30 AM »
Okay. Well if that is the case. I can work around it in another way. I was hoping to correct the values rather than just give a warning and dump out of the script.
However that will still serve the purpose.
Does mach have anything built in to use that can know your "legal" tool number range?

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Getting this error when I try to use a message box with my M6 Script
« Reply #3 on: August 06, 2019, 12:17:47 AM »
Legal tool number range?  That is pretty much defined by you, or the tool changer.  But there no hard rule to any of it.  For instance, my ATC is a 16 pod geneva drive carousel.  Tools 1-16 occupy the ATC and if 17 and above it called out, my M6 script goes into manual tool change mode.  VERY flexible.  Since I know my tool changer only holds 16 tools, that is the number I hard code in the M6 script.

Steve

Offline jevs

*
  •  315 315
    • View Profile
Re: Getting this error when I try to use a message box with my M6 Script
« Reply #4 on: August 06, 2019, 12:36:16 AM »
Actually this brings up something I was not even considering. I was just going to limit it to 7 tools (my turret capacity). I was not considering if if I need more than 7 tools what to do. Is your M6 script something you share?

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: Getting this error when I try to use a message box with my M6 Script
« Reply #5 on: August 06, 2019, 12:46:48 AM »
I run a Galil so the whole tool changer is done in Galil code.  All my M6 script does is post the called tool to the Galil is it is 1 to 16.  Otherwise if the tool is greater than what the ATC has (17 or above), it does EXACTLY what the manual tool change script does. 

Steve