Hello Guest it is March 28, 2024, 04:51:35 PM

Author Topic: Loadfile stalling and Mcodes triggering while Ignore M Calls checked  (Read 4530 times)

0 Members and 1 Guest are viewing this topic.

I have been trying to make a button to automatically load a spoil board surfacing program, run a simulation and then run the file.

I have the button made, all the vb done and it seemed to work ok for the first few runs so I know that overall it should work. I then change the skim program a little and then suddenly  it seems to be stalling around the load file.
LoadFile(Skimfile) Sleep (100) While IsLoading()    Sleep (25) Wend

I have tried lots of different sleep values , wait loops, big sleeps with no wait… nothing seems to work.  It seems that people are using a sleep value by trial and error as a work around but  I cannot seem to find a value that works for me.
If I hit the cancel button on the “please wait generating path” window I get left with the program loaded in the gcode window but no tool path loaded in the tool path window.  At this point I can regen, simulate and then run the code so really stumped as to what is wrong!

The other big issue is that I am still having outputs fire (just for a moment) when I run a simulation (maybe also with the run from here button but I will need to check when I get to the workshop tomorrow). I have check the “Ignore M Calls While Loading” which did not help so have had to add script to the button to first check the state of the offline led, turn the cnc offline,  run the sim then turn it back online. This works ok for now but I would prefer to solve the problem than put a bandage on it and hope it gets better.
Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #1 on: January 30, 2013, 07:29:00 AM »
stalling photo and my macro

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #2 on: January 30, 2013, 11:07:32 AM »
Most of the places you used Sleep() you should be using WhileIsmoving(), Wend.  Sleep does not WAIT it just sleeps a period of time.

Also you misspelled false as " fulse " in one spot. Code will run but not correctly.

You need to double check the Ignore Macros  on load is checked if it is then you have something seriously wrong with your load of mach3.

Is this a demo version?, licensed version?, pirated version? 

Just a thought, (;-) TP
Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #3 on: January 30, 2013, 05:09:26 PM »
Thanks for the fast reply,

I did use :

While IsMoving
Sleep (100)
Wend

But this would allow the code to skip the loading and step into the simulation without loading the tool path and with that same window displayed. This is frustrating as it seems to be fine once you exit out of the script and then regen and simulate.

All of my testing and the posts I have found suggest there is an issue with this vb call. The only work around I have found is to choose the right sleep value. There was a post suggesting that it was the way mach3 processes the file and it gets trapped into some sort of strange loop and wont kick out.

I have stripped the script right back to just the loading the file and it works a treat….  I can also run it from the script editor and it will work as expected but from the Mcode call on the MDI line or from a screen button calling the mcode it stalls.

I am reinstalling my full licenced version of mach3 now and going to do a clean install, rebuild of my mxl and make sure I install the parallel port drivers (did not have them as I am running an ESS) to see if this solves my issues.

I have also double checked Ignore Macros is checked but still having outputs fire on simulation. What can I do to start trouble shooting this issue?

The While IsMoving call - I was under the impression this was just for movement, can someone point me to the info to find what other things it will wait for.








Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #4 on: January 30, 2013, 05:25:35 PM »
I found this post that I think is the same issue as I’m having:

http://www.machsupport.com/forum/index.php/topic,19254.msg133307.html#msg133307


"When one uses LoadFile() it not only loads the file but goes through quickly (ignoring M0/M1 stops and all time constraints) to check for errors, to generate a toolpath and probably do some other things. The latter part seems to take much longer than the actual loading.  Putting in a sufficiently long Sleep command allows one to see all of this happening. If the Sleep time is not sufficient and RunFile() kicks in before the loading + other processes are complete, then the RunFile() command is ignored.

This is fine when developing the program because it throws up any errors, however once everything is working OK it results in an irritating delay while the system does its checks.   A "Cancel" button comes on the "Please Wait - Generating Path" display but there does not seem to be a way of programing this to cut out the delay."

I am seeing the same symptoms but am unable to get the sleep value to be so that it works. I have left it to load for well over 10 mins and still nothing.

i have also tried moving it to an Mcode rather than a button script, no luck either.

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #5 on: January 30, 2013, 09:33:15 PM »
I believe you main problem is the Simulate file. I do not know of any WAITS that will work with it. It is an ODD function. Do you really need it?

I have tested all other of your functions, With proper use of WHile Ismoving and While Isloading for File Load it all works ok EXCEPT for the SIM.

(;-) TP
Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #6 on: January 31, 2013, 05:10:27 AM »
Thanks for the reply tp ( may I ask your name?). Sadly I do need to run the sim as the last thing I need is a misplaced work offset in play before running the file and driving over some metal stops that are just within the possible cutting area if the program is not correctly located.

Could you please explain what you mean by proper use of while IsMoving . Is it not used correctly in the script I posted? I am very new to vb – less than a few months really so always keen to learn the best way to do things.

ok... after a day of trying everything I have tracked down the issue....
When first making the code I had it all loaded into a button script. At some point I decided to make it its own macro file and then call that via Code "M691" from the button script and only worked out this was the issue after loading each of my backups one by one until got to the point of trying an older screen set backup that still had the code in the script.

Not sure why this seems to stall the loading of the file but it seems to work ok now.  Is there any issue with moving scripts to custom macros and then calling that macro via the Code ”M*********” method?

I have seen it said a few times but it’s bad to call macros from macros, why is this? How many is ok? If this is not the way to do things can someone give me the method that is accepted as best practise?

Offline BR549

*
  •  6,965 6,965
    • View Profile
Re: Loadfile stalling and Mcodes triggering while Ignore M Calls checked
« Reply #7 on: January 31, 2013, 10:10:53 AM »
SIM is not going to show you anything that the toolpath display does not.  (;-)

Why are you going "offline" in your script ??

Calling a MACRO form a MACRO is not a good idea because ther is NOT a way to control the thread(order of execution) with multiple macros trying to run.

Order execution is hard to make work with just ONE macro running. 


(;-) TP