Hello Guest it is April 19, 2024, 08:57:58 AM

Author Topic: Assign Generated GCode to GCode Box  (Read 525 times)

0 Members and 1 Guest are viewing this topic.

Assign Generated GCode to GCode Box
« on: May 05, 2022, 07:50:14 PM »
I have customized the screen a bit where you enter a few parameters, then generate the GCode.  I am plugging the generated GCode into the MDI window because I have not been able to figure out how to put it in the GCode window. 

This means you have to press the GCode tab before you press the "Cycle Start GCode".

Is there a way to put the GCode in the GCode window or have the MDI window selected already so it is not necessary to click it before each cut?

Thanks

Offline jbuehn

*
  •  101 101
    • View Profile
Re: Assign Generated GCode to GCode Box
« Reply #1 on: May 06, 2022, 12:24:55 PM »
A couple different options...

There are some APIs to load G code, either from a file or a string. So you could write your G code to a file and then use mc.mcCntlLoadGcodeFile(), or mc.mcCntlLoadGcodeString() if you wanted to load it directly from a string instead of a file. The API docs in C:\Mach4Hobby\docs will be helpful for how to use those API calls.

or...

Are you familiar with the scr.SetProperty() API? The notebook in the screen editor that has your G code and MDI tabs, there sound be a property like "Current Tab" you can set with the scr.SetProperty() API to flip between tabs. I believe the tab number is a string of the zero-based index. So "0", "1", etc.