Post
by Moray » Sat Jan 23, 2021 8:58 pm
Having got a bit bored with re-writing KMotionCNC C++ to C#, I've been working on a little idea I've wanted to implement for a while.
Automatic C code generation.
To configure channel settings, go to the Config tab, then the Channels tab, then click Config, which will open a new window.
Config tab you can set the overall axis channels (defincoordsystem code), the directory where C programs will be generated to (this uses a bit of a bodge just now due to lack of WPF functionality to select folders. Just navigate to the folder you want to use, then click open. If you happen to click on a file within the folder you'd like to use, it doesn't matter. Still just click open), and any prefix you'd like to add to the files.
KStep option works (but only adds code for enabling it, not any of the autodisable code yet). Kanalog does nothing.
Channels tab should be pretty obvious, although the gain/offset boxes aren't labelled. Limitswitch options don't do anything yet, as I need to go and read up on how to implement them.
C Output tab. Generate Init, will generate the init file from the settings in the other tabs, and display in the text box.
Generate Chan, was simply for testing, and only generates the channel code for whatever channel is selected on the previous tab, and displays it in the box.
Once you've created all the settings above, click save, then close the window.
Then if you go to the usual User Button config on the main widow, the combobox will have an option for AutoC. Select that, enter a thread number as normal, select Init from the second combobox that appear, then click Save Settings. Remember to add a button name, or it won't appear.
KMoCNC needs copied to your KMotion/Release folder.
I've attached my KMC_3040mm.xml as it has lots of configuration options already configured, and it can be saved anywhere. Select it on the Tool/Setup Files tab.
To load KMoCNC, you'll also need to create a copy of the emc.var file (in KMotion/Data ), called emc_test.var (I would add a copy, but the forum software doesn't let me upload .var files, and it's probably as quick copy, pasting, and renaming your existing file, than trying to change a file suffix!)
I'm planning on expanding this functionality as I need it, but if somebody does want to use it and is keen for something specific to be implemented, let me know and I'll consider it.
Next on my hit list is keyboard jogging, and finishing the KFlopToPC functionality.
<edited to remove old .exe>
-
Attachments
-
- KMC_3040mm.xml
- (34.23 KiB) Downloaded 287 times
Last edited by
Moray on Sat Jan 23, 2021 10:14 pm, edited 1 time in total.