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.

Aspire Direct Output to UCCNC

Postby RsX » Wed Oct 30, 2024 12:33 pm

Hello,
this is my solution to enable the Aspire direct output function for UCCNC
Let me know if it works for you too and if it can be improved :)

aspire direct output.png
aspire direct output.png (21.74 KiB) Viewed 1611 times

To enable the direct output I added this line into a copy of the UCCNC original postprocessor
The first part is just a name, the second is the ini file that contains the command to execute
Code: Select all
DIRECT_OUTPUT = "UCCNC|UCCNC_run.ini"


Then I put this command into the ini file
What it does is creating a UCCNC subfolder in the temp folder and moves the gcode (%s) into it with a fixed name.
Code: Select all
cmd
/c mkdir "%%TEMP%%\UCCNC\" & move /y %s "%%TEMP%%\UCCNC\Autoload.gcode"


Both files are in the attached zip file and go into this folder, where V is the version of Aspire
Code: Select all
C:\ProgramData\Vectric\Aspire\{Vx.x}\My_PostP


macroloop.png

To make UCCNC load the file I created an M20002 macro and setup a macroloop that starts with UCCNC
The macro continuously checks if there is an Autoload.gcode file in the specified folder and, if UCCNC is stopped, loads it then removes it.
Code: Select all
string AutoloadFile = Environment.GetEnvironmentVariable("TEMP") + @"\UCCNC\Autoload.gcode";
//MessageBox.Show(AutoloadFile);
if(exec.CycleStopped && System.IO.File.Exists(AutoloadFile)){
   exec.Loadfile(AutoloadFile);
   while(exec.IsLoading()){}
   System.IO.File.Delete(AutoloadFile);
}
Attachments
M20002.txt
(290 Bytes) Downloaded 96 times
UCCNC postprocessor.zip
(1.43 KiB) Downloaded 93 times
User avatar
RsX
 
Posts: 33
Joined: Fri Oct 25, 2024 9:22 pm

Re: Aspire Direct Output to UCCNC

Postby sebba » Wed Oct 30, 2024 4:34 pm

Nice job, I'll try it right after I'll finish my current upgrade.
Thanks for posting
- YQWQ
User avatar
sebba
 
Posts: 62
Joined: Mon Dec 21, 2020 9:56 am
Location: Bucharest, ROMANIA

Re: Aspire Direct Output to UCCNC

Postby sebba » Sun Nov 03, 2024 1:06 pm

regarding M20002 macro, uccnc and aspire have to be installed on the same computer?
what about if aspire run on different computer?
- YQWQ
User avatar
sebba
 
Posts: 62
Joined: Mon Dec 21, 2020 9:56 am
Location: Bucharest, ROMANIA

Re: Aspire Direct Output to UCCNC

Postby RsX » Sun Nov 03, 2024 1:37 pm

No, they don't, but they must have access to the same network folder/disk.
You can modify the Aspire command to move the %s file to the shared folder and the UCCNC macro to monitor that folder.
Maybe this might even work with a onedrive/googledrive synced folder or the direct output can be modified to send the file via ftp... The possibilities are endless
What would you like to use to send the file to the other computer? Maybe I can help
User avatar
RsX
 
Posts: 33
Joined: Fri Oct 25, 2024 9:22 pm

Re: Aspire Direct Output to UCCNC

Postby sebba » Sun Nov 03, 2024 5:22 pm

Understand, thanks.
I'll let you know when I'll test it in real life.
For now it was just a preview, having a break with my current task.
Thank you,
Seb
- YQWQ
User avatar
sebba
 
Posts: 62
Joined: Mon Dec 21, 2020 9:56 am
Location: Bucharest, ROMANIA

Re: Aspire Direct Output to UCCNC

Postby Battwell » Thu Nov 07, 2024 10:43 am

this works well. modified to work with vcarve pro and tested.
the only annoying thing is it loses the original job name. which i use for pre run file checking.
makes loading one of the last 10 gcode files impossible too.
cant have everything i suppose :-)
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 867
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk

Re: Aspire Direct Output to UCCNC

Postby RsX » Thu Nov 07, 2024 4:59 pm

Yes, it does lose the job name. Aspire names the file something like "Vectric_b35c675c-547a-4db3-8561-1b40ac22b7b9".

I encountered an issue where I cannot reload/rewind the file because it was deleted, so I modified the macro like this.

the command in the ini file creates an "AutoloadUCCNC.tmp" file in the temp folder with the Aspire generated gcode path in it.
Code: Select all
cmd
/c del /F "%%TEMP%%\AutoloadUCCNC.tmp" & echo %s>"%%TEMP%%\AutoloadUCCNC.tmp"


The UCCNC macro now looks for that file and loads the gcode path contained inside.
Code: Select all
string AutoloadFile = Environment.GetEnvironmentVariable("TEMP") + @"\AutoloadUCCNC.tmp";
string gcodeFile = "";
//MessageBox.Show(AutoloadFile);
if(exec.CycleStopped && 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);
}
Attachments
UCCNC_run.ini
(82 Bytes) Downloaded 70 times
M20002.txt
(536 Bytes) Downloaded 71 times
User avatar
RsX
 
Posts: 33
Joined: Fri Oct 25, 2024 9:22 pm

Re: Aspire Direct Output to UCCNC

Postby Battwell » Thu Nov 07, 2024 8:13 pm

that works a lot nicer.
as the file still exists i can pre file check too.

i cant remember if mach3 used to bring in the file name or not.
i know it had to have registry entries added. long time since since i used mach now!
Uc300eth on router and mill.
UK uccnc powered machine sales. https://cncrouter.uk/atc-cnc-routers.htm
Automateanything/duzzit cnc/mercury cnc
Battwell
 
Posts: 867
Joined: Sun Sep 25, 2016 7:39 pm
Location: South Wales. Uk


Return to Macros

Who is online

Users browsing this forum: No registered users and 0 guests