CNC12 Skinning API: Run Job directly through program [Solved]

All things related to Centroid Oak, Allin1DC, MPU11 and Legacy products

Moderator: cnckeith

Post Reply
aroot
Posts: 6
Joined: Thu Aug 20, 2020 3:24 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: 630200980
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

CNC12 Skinning API: Run Job directly through program [Solved]

Post by aroot »

I've been working on creating software that can control our gantry setup. We're using a an Oak board running CNC12 to control the movement. The project is coming along great but I've hit a snag.

I want to be able to press a button in my program and then it will run a G-Code job. I can currently load a g-code program into CNC12 through my software, and then I can run that by pressing the Cycle Start button, but we're hoping to cut out the second step.

I've used this line of code to load the g-code file to CNC12 (with "currentFileName" being the file path to the file chosen by the user)

Code: Select all

m_skin.job.Load(currentFileName, @"C:\cncm\");
And I've tried using this one to run the program

Code: Select all

m_Skin.job.RunNow(@"C:\cncm\");
But whenever I run this line it will take my g-code file and erase everything in it. I tried setting my file as read-only so the program wouldn't erase it, but the machine is still unresponsive after running this code.

The Skinning API is not super in-depth so I'm not sure if there's a problem with how I'm using the function, or if this is even the correct function that I should be using. If anyone has done something similar and has some input I'd love to hear it.

Worst case scenario is that we just have the user press the Cycle Start button on our pendant. (honestly I think that's right thing to do, but I'm not the one in charge)
Last edited by aroot on Fri Oct 09, 2020 3:36 pm, edited 1 time in total.
cnckeith
Posts: 7293
Joined: Wed Mar 03, 2010 4:23 pm
Acorn CNC Controller: Yes
Allin1DC CNC Controller: Yes
Oak CNC controller: Yes
CNC Control System Serial Number: none
DC3IOB: Yes
CNC11: Yes
CPU10 or CPU7: Yes
Contact:

Re: CNC12 Skinning API: Run Job directly through program

Post by cnckeith »

Not the most elegant, but this should work to automatically run the flange.cnc job in c:\cncm\ncfiles:
var result = m_skin.job.RunCommand("g65 \"c:\\cncm\\ncfiles\\flange.cnc\"", "C:\\cncm", false);
Need support? READ THIS POST first. http://centroidcncforum.com/viewtopic.php?f=60&t=1043
All Acorn Documentation is located here: viewtopic.php?f=60&t=3397
Answers to common questions: viewforum.php?f=63
and here viewforum.php?f=61
Gear we use but don't sell. https://www.centroidcnc.com/centroid_di ... _gear.html
aroot
Posts: 6
Joined: Thu Aug 20, 2020 3:24 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: Yes
CNC Control System Serial Number: 630200980
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: CNC12 Skinning API: Run Job directly through program

Post by aroot »

Thanks for the reply,

This solution works as good as I needed it to. I tweaked it a little bit to clean it up a little and make it more modular.

Code: Select all

m_Skin.job.RunCommand("G65 \"" + currentFileName + "\"", @"C:\cncm\", require_cycle_start: false);
I agree that it's probably not the best solution, for example it doesn't display the G-Code line by line in CNC12 like it would from using Cycle Start, but it provides the effect that I was looking for and that's good enough for me. :D
Post Reply