Aspire Direct Output to UCCNC

This is where you talk about Macros, show examples of your macro scripting and SHARE handy segments of script code as examples.

Re: Aspire Direct Output to UCCNC

Postby Greolt » Sat Apr 05, 2025 2:25 am

It seems to me that after the execution of a program UCCNC has a flag left hanging that interferes with the "exec.Loadfile" command running.

Once "Cycle Stop" has been enacted then the macro loop containing "exec.Loadfile" command can then do its thing.

Or in other words M30 is not returning UCCNC to an idle state.
Greolt
 
Posts: 262
Joined: Sun Sep 04, 2016 6:22 am

Re: Aspire Direct Output to UCCNC

Postby ger21 » Sat Apr 05, 2025 2:04 pm

Have you tried M2 instead of M30?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2794
Joined: Sat Sep 03, 2016 2:17 am

Re: Aspire Direct Output to UCCNC

Postby RsX » Sat Apr 05, 2025 5:49 pm

I have figured it out and it's actually my bad. :oops:
I'm checking the wrong flag. CycleStopped is true only if the Cycle Stop button is pressed.
Code: Select all
if(exec.CycleStopped && System.IO.File.Exists(AutoloadFile)){

The correct flag is exec.stopped which is true when the program ends or if the machine is in idle after the execution of a single line. Not true when feed hold is active or the program is running.
Code: Select all
if(exec.stopped && System.IO.File.Exists(AutoloadFile)){


Here is the code. There is no need to edit the M30 this way.
Code: Select all
string AutoloadFile = Environment.GetEnvironmentVariable("TEMP") + @"\AutoloadUCCNC.tmp";
string gcodeFile = "";
//MessageBox.Show(AutoloadFile);
if(exec.stopped && System.IO.File.Exists(AutoloadFile)){
   //read the file, it should have only one line
   gcodeFile = System.IO.File.ReadAllText(AutoloadFile);
   //clean the string
   gcodeFile = gcodeFile.TrimEnd('\r', '\n');
   //load the gcode
   exec.Loadfile(gcodeFile);
   while(exec.IsLoading()){}
   //delete the tmp file, not the gcode
   System.IO.File.Delete(AutoloadFile);
}
User avatar
RsX
 
Posts: 77
Joined: Fri Oct 25, 2024 9:22 pm

Re: Aspire Direct Output to UCCNC

Postby Greolt » Sun Apr 06, 2025 1:59 am

Great work RsX. That has solved my puzzle.

Very glad there are much smarter people than me on this forum. :)

Thanks again for your work on this feature
Greolt
 
Posts: 262
Joined: Sun Sep 04, 2016 6:22 am

Previous

Return to Macros

Who is online

Users browsing this forum: Bing [Bot] and 1 guest