PDA

View Full Version : My MiniGcode creator software



routercnc
12-06-2022, 08:11 AM
After hand coding some gcode operations recently I wondered if it was possible to create a GUI and create them interactively. Since I have Excel on my machine and have written various bits of code in the past, including VBA, I decided to start there. The initial result / proof of concept is shown in the video.

It seems to work very well and I plan to develop it further as I see what it can do. It is much quicker for those small jobs than going back to CAD/CAM to create full gcode files, and offers the opportunity to work interactively such as creeping up on a final dimension.

I've posted this thread here as the others did not seem appropriate, plus it works well with UCCNC (so far). I say this because there are small details such as the coordinates are generated without the decimal point for whole numbers e.g. G1 X4.0 posts as G1 X4 and although UCCNC controller has no problem with this I have read that some controllers shoot off to another location with 4 in it. I have tried to get the VBA code to format these numbers but not been successful. It works for me so have left it for now.

Now as mentioned in the video there are commercial offerings (I since discovered!) which do all this and it is often called conversational programming. However, they started at $70 upwards so I will probably develop this to a point for my own use, but obviously it does not make sense to go too far.

Anyway, that is the introduction, here is the proof of concept:

https://youtu.be/KxuOC5BpTAA

A_Camera
13-06-2022, 10:25 AM
Cool. Will you make it available for others to use?

routercnc
13-06-2022, 12:54 PM
Cool. Will you make it available for others to use?

I was originally thinking to get it all finished with a bit more functionality and fully debugged then upload the excel .frm file (plus another supporting file?) to GitHub and people could download it for free so long as they had Excel on their CNC machine. There is a Thanks button on YouTube if they found it useful and wanted to donate anything.

But Iíve had replies on the channel about doing it all in C# under visual studio which is better suited to create a standalone app. Iíve been reading up on it and it looks good but I would need to get up to speed with C# and committing things to GitHub so now am thinking about where to go.

Maybe Iíll just put out the Excel version initially and take it from there. . . .

Neale
13-06-2022, 03:21 PM
I moved from Mach3 to UCCNC and one of the "missing" things is any conversational programming capability. At the moment it's Fusion 360 or carving gcode by hand for simple jobs. This looks like it would fill the gap - be very interested to take a look.

Thanks,

JohnHaine
13-06-2022, 05:25 PM
I've used Excel quite a lot for generating g-code for odd shapes like cams of various types, though not VBA. The problem with VBA is you need Excel so of course it's not compatible with Linux for those using LinuxCNC. I recently wrote a wizard to generate code for knurling using the rotary axis on my CNC mill - initially I did this in Excel but then moved to Python which I found very easy to use (though it doesn't have any graphics). You could consider Python as for example the Thonny IDE for Python is cross platform - I run it on both the PC and a Raspberry Pi - and it's free. I believe that there are extensive graphics libraries available for Python too.

routercnc
13-06-2022, 10:13 PM
I moved from Mach3 to UCCNC and one of the "missing" things is any conversational programming capability. At the moment it's Fusion 360 or carving gcode by hand for simple jobs. This looks like it would fill the gap - be very interested to take a look.

Thanks,

Hi Neale,
I have been playing around with it tonight trying to get it to crash/create odd toolpaths (on my desktop, not on the real machine) and have caught some errors and now it seems to work OK. Next step will be cutting out some sample parts, simple circle, simple circle with radial stock to leave, full pocket, full pocket with stock to leave, and throwing in some offset XY start points for the hole (in case the hole is not at 0,0). I should get a chance this weekend to have a play in the workshop, then maybe I can upload the Excel file to the open source section here as a Beta (for those with Windows & Excel on their CNC machine PC at least).

routercnc
13-06-2022, 10:26 PM
Hi John,
OK that is good to know. I had a look at Python today, as well as C++ and C#, and as with all things they seem to be best suited for certain applications. MS Visual Studio Code supports most of them, but the GUI looked well supported for C#. I think Python is easier to get started with but I think a GUI is important for this tool so if I go that way I am leaning towards C# as it seems to be the right starting point for this sort of thing (I think), apologies Linux users if I get that far :(

I did get a request on the YouTube channel for yet another standalone system / approach. And there was I thinking I would just finish this in Excel VBA and let others use it !

Plan for now is get it running safely in Excel VBA, share it out and see where to go from there . . .

Thanks for all the comments and suggestions on coding approaches, I'm not an expert on coding but seem to get things to work in the end.

Neale
14-06-2022, 07:20 AM
Given that you are aiming this to provide extra functionality in a UCCNC setting, assuming Windows doesn't seem silly. I guess that a portable version across platforms would be a nice-to-have but something that works on one platform seems better that something that doesn't quite on several. I remember way back tallking to a colleague who had left to join a big database company. He said that they had one version for VMS, one for IBM, and about 50 more for different flavours of Unix! Maintenance nightmare...

routercnc
14-06-2022, 03:32 PM
Given that you are aiming this to provide extra functionality in a UCCNC setting, assuming Windows doesn't seem silly. I guess that a portable version across platforms would be a nice-to-have but something that works on one platform seems better that something that doesn't quite on several. I remember way back tallking to a colleague who had left to join a big database company. He said that they had one version for VMS, one for IBM, and about 50 more for different flavours of Unix! Maintenance nightmare...

Exactly. I canít get into all that !

I do use UCCNC but the gcode generated is basically G0, G1, and G2, with some M commands for the spindle start stop and code rewind. Iím hoping that is fairly universal for most controllers. I didnít see the commercial conversational software requesting which controller was to be used so they would tailor the post to suit, but I might have missed it. The idea was to keep it simple to be more universal in terms of generated code.

m_c
14-06-2022, 05:10 PM
I may still have the barebones of a conversational programming C# project on my computer somewhere.

I started one a few years ago, mostly to force myself to learn how to code desktop apps, so there is lots I'd do differently now.
Although IIRC I wrote it using the older WinForms (Windows Forms) GUI. If I was to do something now, I'd use WPF (Windows Presentation Foundation) which uses XAML for the GUI.

routercnc
14-06-2022, 09:49 PM
I may still have the barebones of a conversational programming C# project on my computer somewhere.

I started one a few years ago, mostly to force myself to learn how to code desktop apps, so there is lots I'd do differently now.
Although IIRC I wrote it using the older WinForms (Windows Forms) GUI. If I was to do something now, I'd use WPF (Windows Presentation Foundation) which uses XAML for the GUI.

Interesting - I was waiting for visual studio to download and went to browse this thread so good timing! Now it has finished installing Iím sat here looking at the myriad of coding options and I feel a bit overwhelmed. I can see the WPF option and it offers both Visual Basic and C#.

Given that I would want to release a standalone executable at the end with a GUI to create custom gcode is there a preference? Iím looking at the WPF with VB option and my existing code out of Excel VBA would pretty much drop straight in at first glance, whereas C# would need rewriting. Sorry for the question but do you have experience of any downside to WPF with VB as Iím leaning that way now?

Also apologies to the rest of the users as this thread is going quite deep!

m_c
14-06-2022, 10:13 PM
You can code the backend in pretty much whatever language Visual Studio supports, but some will be better supported than others.

I knew a bit C. and quite a bit C++, and have a good understanding of OOP, so C# was the natural choice for me.

I did do a Udemy C# course, as although I'd done lots of embedded coding, I'd never written a desktop app.
Udemy courses can often be had for not much money, and some of them are very worthwhile.

If you want to see what I did, send me your email, and I'll send a zip file across.

routercnc
15-06-2022, 05:01 PM
You can code the backend in pretty much whatever language Visual Studio supports, but some will be better supported than others.

I knew a bit C. and quite a bit C++, and have a good understanding of OOP, so C# was the natural choice for me.

I did do a Udemy C# course, as although I'd done lots of embedded coding, I'd never written a desktop app.
Udemy courses can often be had for not much money, and some of them are very worthwhile.

If you want to see what I did, send me your email, and I'll send a zip file across.

OK great. Will do when I get back from work tonight.

routercnc
15-06-2022, 08:20 PM
pm sent

routercnc
25-06-2022, 09:30 PM
Here is the followup video showing the updates to the Mini Gcode creator, and how you can download the BETA version of the modules to import into your copy of Excel. You need to extract all 3 files from the zip but only need to manually import 2 of them (the .frm is the form and the .cls is the workbook code, the .frx is loaded automatically by Excel).

The video explains how to import the files into Excel.

Lee, if you feel this is better in the Open Source section as a thread then feel free to move the whole thing there. Just let me know if you do that as the Youtube video currently points to this thread for others to download the modules.


https://youtu.be/tNKDaSjpq70

JasonT
26-06-2022, 09:31 AM
I will have to look out my dreadful attempt and share it with you, I covered PCD and peck drilling. I started out using GRBL but due to its limited G & M command set i couldn't use any canned cycles so i was trying to develop code in dot net to run in the background behind the grbl panel Gui. I'm a little spoilt as i now have a Haas Mini Mill but the concept of being able to quickly write conversational code is interesting. It might be worth considering the possibility of offering both full fanuc standard GCode commands and an option to do a hard coded version for hobby machines. I found it hard to aquire examples of hand coded functions of canned cycles, I couldn't understand why in the dark ages of machining that it wasn't common to have something like peck drilling written in G01s and X,Y,Z moves instead of G81, G73, G83 commands etc. It has to have a feeds and speeds calculator and an area which no one else covers Drill speeds, tapping and facemills. Ive searched for ages to find a decent calculator to help find the right feeds and speeds for multi-flute indexed facemills. Ill look my code out over the next few days and message it to you.

routercnc
26-06-2022, 05:05 PM
Hi Jason
OK pm it over and I’ll have a look.

m_c
27-06-2022, 11:04 PM
This has just reminded me that I never replied to your email.


I will have to look out my dreadful attempt and share it with you, I covered PCD and peck drilling. I started out using GRBL but due to its limited G & M command set i couldn't use any canned cycles so i was trying to develop code in dot net to run in the background behind the grbl panel Gui. I'm a little spoilt as i now have a Haas Mini Mill but the concept of being able to quickly write conversational code is interesting. It might be worth considering the possibility of offering both full fanuc standard GCode commands and an option to do a hard coded version for hobby machines. I found it hard to aquire examples of hand coded functions of canned cycles, I couldn't understand why in the dark ages of machining that it wasn't common to have something like peck drilling written in G01s and X,Y,Z moves instead of G81, G73, G83 commands etc. It has to have a feeds and speeds calculator and an area which no one else covers Drill speeds, tapping and facemills. Ive searched for ages to find a decent calculator to help find the right feeds and speeds for multi-flute indexed facemills. Ill look my code out over the next few days and message it to you.

Ultimately because of memory limitations.
When you only had 128k of memory available to store programs, all those G01 blocks add up.
Plus for hand coding, and repetitive cycles, a canned cycle makes much more sense.