I Revived 3-Axis CNC Mill G-Code Simulator
(github.com)113 points by harvie 4 days ago
113 points by harvie 4 days ago
Opensource options include:
- Solvespace --- limited to 2D last I checked
- FreeCAD has a workbench for CAM/toolpath generation
- BlenderCAM is a plug-in for Blender which is well-regarded, and together w/ CADsketcher/BlenderCAD works well for some folks
- Kiri:Moto
- pyCAM --- a venerable option, it worked well ages ago when I used my son's gaming computer to make toolpaths.
Rather rough (possibly outdated) list at: https://old.reddit.com/r/shapeoko/wiki/cam
In general, FreedCAD has 3-axis tool path support, and I've met the kind local guy who started the original Path toolbox.
For 2.5D there are several engraver options with the inkscape mightyscape plugins (scorchworks etc.)
YMMV with the island-routing and surface probing routines:
https://github.com/pcb2gcode/pcb2gcode.git
https://github.com/pcb2gcode/pcb2gcodeGUI.git
Also, we are currently evaluating: viaconstructor, inkcut, GCAM ( https://github.com/blinkenlight/GCAM.git )
If you want 3D contouring operations, than you could also try:
git://pycam.git.sourceforge.net/gitroot/pycam/pycam
And note, if you patch CAMotics to compile on ubuntu 24.04.x it still has a number of Qt5 GUI problems (not entirely unexpected with Qt impact on LTS programs.)
There are also direct gcode generator macros that support the LinuxCNC/emc language extensions. This is the most accurate methodology for turning and milling ops.
Best of luck, =3
I have a post-processed NC file from Fusion 360...which I think is just gcode. How can I transform that into something this can simulate? My hacky attempts have failed.
https://nraynaud.github.io/webgcode/
I made one too, a long time ago.
https://nraynaud.github.io/webgcode/webapp/visucamTest.html
I did some code generation too, but it's bit rotting.
One thing I'll suggest - if you ever want to cut anything metal, you'd probably do well to learn how machining works in general and by that I mean on a manual lathe and mill. The coding part is going to be easy for you (and probably anyone else reading this), but knowing what you want the thing to do is a MUCH different task than being able to tell the machine what to do.
Everything about how you move that tool through the work matters. Materials, workholding, spindle speeds, tooling, tooling coatings, feed rates, plunge speeds, all of these things need to be worked out and they all change when you swap a tool or a part etc. Speeds and feeds are dynamic, you need to learn about conventional-vs-climb milling, you'll need to know about cutter geometries and the materials the cutters are made of, when and how to deploy coolant, the list just never ends.
GCODE is, by far, the easy part for a programmer. It's a very simple language that hasn't changed much in the past several decades. "Knowing machining" is that tougher hill to climb.
My recommendation? Check your local community colleges/trade schools! I took a couple semesters of machining classes as a 40-something grown-ass dude and I learned a huge amount of stuff that would have been expensive or dangerous to learn by trying. You'll get hands-on access to big machines with someone over your shoulder helping to make sure you keep your limbs attached to your body.
Second this. My work occasionally deals with Gcode files. The coding is simple, knowing what to do (or not to do!) is harder. My first foray into the world of Gcode I named "Smokey" because it was a quick fix for another program generating bad Gcode that quite literally caused smoking on the work surface and could have lead to a fire had the operator not been paying attention.
And note that while Gcode is consistent it's meaning isn't always--is Z positive going into the work surface or going away from the work surface?
If you literally want to emboss hello world on a piece of foam, you can buy cheap CNC kits on Amazon like https://www.amazon.com/dp/B08HRLGL6C/ which will execute G-code.
They're weak and imprecise by the standards of CNC machines but if you're only looking to learn a bit and cut foam? That's a low price.
The big problem for contemporary hobby CNC is that the G-code interpreters for small single board computers such as Grbl running on an Arduino are extremely memory-constrained:
which means:
- no loops
- no branching
- no variables
One work-around for that is:
https://github.com/NRSoft/GSharp
(I took a very different approach in my project linked elsethread)
I used to have some machines with Fanuc 6 controllers circa 1981 - 1983. They had variables, macros, branching, etc. I haven't been able to find what processors were in those old controllers, but I'm certain the single board computers of the last decade have more ram, more flash, and way more processing power. If GRBL can't do it, it is a software issue, not hardware.
I don't understand this comment- gcode never had loops, branching, or variables. And most folks use more capable controllers now based on ESP32 or whatever.
Update: I guess gcode does have loops, branching and variables: https://www.fictiv.com/articles/cnc-machining-macros-subprog...
Actually, in LinuxCNC dialect the gcode does have many features most machines will not understand.
This is why these machines can drill and helical-tap plates with thousands of holes with ease. Also, some folks will cut gear-profiles with a slitting saw, and 4th rotary axis...
https://www.youtube.com/watch?v=HI27vSoxCeo
Trying to pull these things off in a CAD/CAM package is usually a fools errand the old guys prank kids with... oh that sounds easy... lol =3
They are the high-end/legacy-end of hobby CNC.
The Grbl/Arduino stuff seems most prevalent/commonly sold.
That said, I was remiss in not mentioning LinuxCNC, &c., and as you note, they do have a more traditional G-code implementation w/ loops and variables and branches.
But, I don't think that this simulator supports all of that --- could someone post a sample program which does that sort of thing and test it?
Yeah - I guess as a someone who considers my machining "non professional", I've never even really consider GRBL for a machine because "running G code" and "running a mill/router/lathe" feel like different categories. the lack of a reasonable GUI and access to the configurations and macros to handle things like tool changes etc. has never made me interested in GRBL. (I've only ever played with GRBL in the context of a router that needed to be run by UGS) and that felt so limited as to be useless.
That said, I'm on the brink of converting both my mill and router from UCCNC to Centroid just to be into some software that is more "machine operator aware" meaning that it offers more features targeting making my life easier as an operator, rather than simply running gcode in a machine-agnostic way.
FreeCAD and its CAM Workbench?
For the light version maybe Solvespace?
I'm still amazed by Dune 3D: https://dune3d.org/ where the Github page has the footnote:
>I ended up directly using solvespace's solver instead of the suggested wrapper code since it didn't expose all of the features I needed. I also had to patch the solver to make it sufficiently fast for the kinds of equations I was generating by symbolically solving equations where applicable.
That's an excellent question.
Also, how are tool definitions to be handled? Each program seems to have their own approach, though some will place the tool description in comments. CutViewer is notable for doing this, and is the example I have been following in:
https://github.com/WillAdams/gcodepreview
(which is quite a different project)
EDIT: Note that the comment system which Cutviewer uses seems to be something of a de facto standard --- Carbide Create uses this same scheme.
Very cool.
It seemed to struggle a bit with a more complex example.