Expanding G-code library

More
17 Jul 2020 07:20 #174906 by Tango
My first post is here. Now, after reading it over just a few minutes ago, I'm realizing that there's a lot more to doing CNC work than I thought and I'm trying to put it all together in my head. I hope it's okay to ask a few general CNC questions here. If not, can someone point me to a good forum where I can do that?

My work computer is a Mac, but my love is Linux. (But, hey, when you open the terminal, the Mac is a lot more like Linux than Windows!) My plan is to put a small Linux box in my workshop to control a CNC machine. Right now I'm looking at a BobsCNC Evolution E4. The biggest problem with this system is that the manufacturer seems to work with all Windows systems and most of what they recommend is Windows only. I've gotten some info from them, but it's clear to me if I want to use Linux with this unit, they're ability to help is limited.

Any help in telling me where what I'm about to say is right or wrong (or any questions anyone can answer) will be a big help.

My understanding, working backwards, is that you need drivers for stepper motors and a controller to handle them. The BobsCNC system uses GRBL for the software on the computer to communicate with the CNC system. I'm told there's another protocol for communicating (not sure of the name - can someone help me here?) that LinuxCNC uses and that if I replace the control unit and drivers on the E4 from BobsCNC with a Gecko G540, I can control the E4 with LinuxCNC. (And, hardware wise, communication with the CNC device is through a parallel port - is that a DB25 connection or something offbeat?)

So LinuxCNC communicates with the CNC system and controls it. LinuxCNC needs to use GCode for input. I understand GCode is a language based on letters and numbers for commands and command arguments.

I get that I need a program that can output my design in GCode, so LinuxCNC can read it and work. I've seen there are a number of ways to generate GCode. I'm concerned about how well they work. I haven't see people complaining about any particular software making bad GCode, but I've also seen many times where I can't import a file from one word processor into another because different programs interpret the data differently.

In general, if a file is in GCode, is it usually going to be reliable? (I know - there have to be at least a few programs out there that create crappy GCode, so let's just make it a question about if this is true "in general.")

From what I see, there are CAD and CAM programs that can create GCode, but there are also translators that can read an STL or DXF file and translate the data into a GCode file. Are there some of these that work on Linux that are known to be reliable?

From here, I'm looking at modelling. I use Blender for some other uses. I'm wondering if anyone knows if BlenderCAM will work well for designing items I need to create with CNC work. Obviously, it would be easier to use Blender for this if I'm using Blender for other purposes, too - no extra interface to learn. (Another route I found is to use Blender, save as an STL file, then use a program like Slic3r to convert the STL file to GCode.) I'm hoping someone can at least tell me if that's a workable solution or a path that's full of problems.

Also, I see that there seem to be different ways of working with CNC machines in terms of dimensions. I've read that some programs only generate code that can be used to create 2D and 2.5D pieces. But I also see there are nice 3D carvings (and, yes, I know there are limits to what can be done with those). I also see signs done in CNC, which means the router only goes to a limited depth, but also wood shapes that are cut out (meaning the bit has to go down to the bottom of the wood to cut all the way through). Can Linux CNC handle all that?

Could I do a design in Blender that involves, say, cutting a piece of wood to size and shape, and putting engravings or holes of varying depths into the wood piece I'm cutting out?

I know that's a lot, but I'm really trying to put all the pieces together and see just what I can and can't do with this process. Thanks for any help!

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
17 Jul 2020 07:45 #174919 by tommylight
Find a different machine.
Most of the stuff you got right.
There are plenty of CAM software for Linux that will get the job done, from Inkscape with included gcodetools to BlenderCam, so here are some:
dxf2gcode
dmap2gcode
Inkscape
freecad
PyCam
BlenderCam

Please Log in or Create an account to join the conversation.

More
17 Jul 2020 12:51 - 17 Jul 2020 12:51 #174941 by andypugh

My work computer is a Mac, but my love is Linux. (But, hey, when you open the terminal, the Mac is a lot more like Linux than Windows!)

My home PC is a Mac. In fact i do all my LinuxCNC coding physically in front of a Mac with a collection of Linux Virtual machines (VMWare Fusion). When I need to test on real hardware I ssh to a real Linux machine.

My understanding, working backwards, is that you need drivers for stepper motors and a controller to handle them. The BobsCNC system uses GRBL for the software on the computer to communicate with the CNC system


The sequence is something like:

1) CAD Package
2) 3D model / 2D drawing
3) CAM Package (often part of the CAD package)
3a) Preprocessor
4) G-Code (or, on some 3D printers, x3g which is almost raw step numbers)
5) Network / SD card / internal file transfer.
6) CNC Controller (LinuxCNC / GRBL / Mach4 / Fanuc etc)
7) Hardware interface (Parallel port, Mesa/Pico card, built-in GPIO etc)
8) Step/Dir signals or analogue voltage or PWM or serial data
9) Stepper driver / servo driver
10) Stepper motor / servo motor / servo-hydraulic actuator / Galvanometer
11) Profit

In general, if a file is in GCode, is it usually going to be reliable?

The best thing about standards is that there are so many of them. Sadly the 3D printer controllers (like GRBL) use a version of G-code that does not look a lot like lathe/mill G-code. The fundamentals are the same, but there are many extra M-codes for various tasks, and they use an "E" axis for the extruder. You can make a printer that works with normal G-code, or a lathe that works with GRBL / reprap code but you would end up on largely on your own.
Even different manufacturers have differences in the numbering of canned cycles, or the exact parameters used by complex commands like G76 lathe threading.
The basics, G0 (rapid) G1 (feed) G2/G3 (arc feed) are all the same. And CAM systems tend to not use the more advanced codes, so you can typically make the code work with some manual tweaks if it is postprocessed for the wrong machine.
The trick is to use the preprocessor (3a) that best matches your controller. LinuxCNC will work with Mach3 G-code, and most Fanuc G-code etc. If you can't see a "LinuxCNC" postprocessor, then look for EMC2 as that is what LinuxCNC used to be called.

Obviously, it would be easier to use Blender for this if I'm using Blender for other purposes, too - no extra interface to learn. (Another route I found is to use Blender, save as an STL file, then use a program like Slic3r to convert the STL file to GCode.)

Slic3r creates G-code specifically for 3D printing, it can't be used on a milling machine.
Well, it could, maybe, but as a printer puts material on, and a milling machine takes material off, at the very best you would get a hole the shape of your part.
The G-code is a series of moves and spindle speed commands. It's pretty low-level and defines how the part is machined or extruded.
To take a 3D printer example, if you changed the fill density you would need to completely re-create the G-code, every strand of filament extruded is commanded by a separate G1 command.
A "Slicer" is a very specialised "one trick pony" CAM system. But if you are making G-code for a 3D printer then they are by far the best choice.


Can Linux CNC handle all that?

Yes. Anything that involves the controlled movement of any sort of machine can be done by LinuxCNC as long as those motions can be encoded in G-code.


Could I do a design in Blender that involves, say, cutting a piece of wood to size and shape, and putting engravings or holes of varying depths into the wood piece I'm cutting out?


If you have a CAM system that can create the G-code that specifies how to do that, LinuxCNC can do the rest. And what you describe is the sort of basic thing that any CAM system (except for a Slicer) should be able to do.
Last edit: 17 Jul 2020 12:51 by andypugh.
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
17 Jul 2020 22:48 #174972 by Tango

Find a different machine.

What are your reasons for that?

I'm looking for a CNC machine that can do 2'x2', is not super-highly priced, and that I can use to even do 2'x4'. If I do a 2x2 section, then use registration marks and line it up, I can do the other 2x2 section beside it to get a 2x4 piece done. Also, one that uses the Dewalt 611 Router (which I already have and use for other work, too) would be nice.

Maybe there's more out there I had not found (in fact, I'm sure that's the case), but I found most systems were much higher in price or a smaller work area and I was not finding CNC systems where I could find a 2' wide work space where I could also slide it down and do a 2nd part to it.

I am more than open to suggestions on equipment and software and anything else, though.

Most of the stuff you got right.
There are plenty of CAM software for Linux that will get the job done, from Inkscape with included gcodetools to BlenderCam, so here are some:
dxf2gcode
dmap2gcode
Inkscape
freecad
PyCam
BlenderCam


Since I'm using Blender for other similar types of work, I was considering using Blender or BlendeCam, so I'm glad to see that on the list. Can anyone tell me if it's considered reliable for producing good GCode I can use with CNC?

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 00:14 #174987 by jbraun
You haven't been very specific about the type of work and materials the machine needs to be capable of doing.
For signs Inkcape+QCAD+scorchworks+linuxcnc will cover most of what you need. All of those run on linux.
Fusion 360 is powerful and will run on Mac.
FreeCad has plenty of features but has some rough edges. Save early, save often.
BlenderCam ? Never tried it or cared too much for STL if that's Blenders native format.

I run a G540 with parallel port and step generation handled by the computer. It's not the hot set-up but it works well enough. Gecko isn't the best bang for your buck but it's a good company with good product.

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 04:49 #175014 by Tango

You haven't been very specific about the type of work and materials the machine needs to be capable of doing.

Good point!

Part of that is because I'm at the point where there are some things I really want to do NOW, but am still trying to get used to all that I can do later. I know I have a number of signs I want to make for our lot, some for fun, and some necessary - like telling delivery drivers where to leave packages. (They keep messing that up!) I also want to be able to make some furniture, which would consist of just cutting out multiple copies of particular patterns. When I make furniture, though, I want to be able to do things like add holes of different depths for pegs to hold shelves or as pre-drilled holes for screws. After I've learned a little, I'd like to be able to make those furniture parts with some kind of patterns etched in them.

I'd also like to be able to do (and I'm not sure of the right term for this) panels with 3D designs etched in. For instance, if I put a tree on a panel, instead of just outlines, I'd like the trunk to be more rounded off. So if I used, say, BlenderCam and made a 3D image, I'd want to be able to use the CNC machine to etch that into a panel.

I know there are limits - like I can't make an "overhang" because there's no way to change the orientation of the router or to dig in under something.

But I also suspect that once I start getting used to a router, I'll be doing a lot more with it, so I don't want to spend thousands and thousand on it, but I don't want to start with something that will be really limiting later.

For signs Inkcape+QCAD+scorchworks+linuxcnc will cover most of what you need. All of those run on linux.
Fusion 360 is powerful and will run on Mac.

I'm using QCAD now, on the Mac in my study (far away from the workshop) and I like it, but I'm getting really sick of having to do multiple elevations and changing them all when I make a change - that's one of a number of reasons I'm moving to Blender to do plans for renovation and new work on our house and guest house.

FreeCad has plenty of features but has some rough edges. Save early, save often.
BlenderCam ? Never tried it or cared too much for STL if that's Blenders native format.

I know Blender saves in their own format and STL files, but BlenderCam saves in GCode files. So it looks like, as long as I'm changing to Blender for other things, that I can probably use it for CAM work, too.

I run a G540 with parallel port and step generation handled by the computer. It's not the hot set-up but it works well enough. Gecko isn't the best bang for your buck but it's a good company with good product.


On the other thread I started, several people have said they don't like Gecko, but others like it. My concern is that I want to, as a beginner, be able to remove the Raspberry Pi and drivers the router I want uses and replace them with a G540 without having to take days to figure out how to calibrate it or make changes.

When you say "but it works well enough," what do you mean?

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 05:42 #175017 by Tango
I had to wait to respond to this because you include a lot of good information and I had to read it a few times to get everything straight in my head.

My work computer is a Mac, but my love is Linux. (But, hey, when you open the terminal, the Mac is a lot more like Linux than Windows!)

My home PC is a Mac. In fact i do all my LinuxCNC coding physically in front of a Mac with a collection of Linux Virtual machines (VMWare Fusion). When I need to test on real hardware I ssh to a real Linux machine.

I haven't used VMs in years - just haven't needed them. Amazing how you can easily forget a tool that you've used to solve a lot of problems in the past!

But, from what you're saying, I feel like I should have no trouble doing the design work and running a CNC device from a Linux or Mac. (I suspect most of my design work will be done on my Mac in my study, and the control work will be done with a Linux box in my workshop. My study is in the house, the workshop is in the guest house attic, so the two machines are not close and easy to switch between. The guest house is a 500' walk, but there are fiber optic cables connecting the networks so both buildings are on the same LAN.

My understanding, working backwards, is that you need drivers for stepper motors and a controller to handle them. The BobsCNC system uses GRBL for the software on the computer to communicate with the CNC system


The sequence is something like:

1) CAD Package
2) 3D model / 2D drawing
3) CAM Package (often part of the CAD package)
3a) Preprocessor
4) G-Code (or, on some 3D printers, x3g which is almost raw step numbers)
5) Network / SD card / internal file transfer.
6) CNC Controller (LinuxCNC / GRBL / Mach4 / Fanuc etc)
7) Hardware interface (Parallel port, Mesa/Pico card, built-in GPIO etc)
8) Step/Dir signals or analogue voltage or PWM or serial data
9) Stepper driver / servo driver
10) Stepper motor / servo motor / servo-hydraulic actuator / Galvanometer
11) Profit

Well, I'm not so sure about step 11! But, yeah, that's usually the last step, isn't it? This helps me see that my basic understanding is pretty close to how it works.

Step 3a - that would change depending on whether I use a CAM (or CAD) package that can output GCode or not, right?

For the hardware, the Linux box I want to use is a mini-PC that does not have a parallel port, but I see that Mesa has a board with an ethernet connection I can use (the computer I want has a 2nd RJ45 on it), and then use the parallel port on that.

In general, if a file is in GCode, is it usually going to be reliable?

The best thing about standards is that there are so many of them. Sadly the 3D printer controllers (like GRBL) use a version of G-code that does not look a lot like lathe/mill G-code. The fundamentals are the same, but there are many extra M-codes for various tasks, and they use an "E" axis for the extruder. You can make a printer that works with normal G-code, or a lathe that works with GRBL / reprap code but you would end up on largely on your own.


That sounds to me like G-code for lathe/mill work is a subset of the G-code for a system that does a lot more. Is that a fair way to put it? (And just for clarification, for this, I am not looking at 3D printing at this time - while that may be an issue later, right now I just want to be able to do a design and make it in wood with a CNC system.

Even different manufacturers have differences in the numbering of canned cycles, or the exact parameters used by complex commands like G76 lathe threading.
The basics, G0 (rapid) G1 (feed) G2/G3 (arc feed) are all the same. And CAM systems tend to not use the more advanced codes, so you can typically make the code work with some manual tweaks if it is postprocessed for the wrong machine.
The trick is to use the preprocessor (3a) that best matches your controller. LinuxCNC will work with Mach3 G-code, and most Fanuc G-code etc. If you can't see a "LinuxCNC" postprocessor, then look for EMC2 as that is what LinuxCNC used to be called.

So most of the time what I do in a CAD/CAM program should create G-code that will work on most CNC systems, but I may need to either tweak it myself or find a pre-processor that does it, or analyze it and figure out what has to be done and write my own pre-processor?

Obviously, it would be easier to use Blender for this if I'm using Blender for other purposes, too - no extra interface to learn. (Another route I found is to use Blender, save as an STL file, then use a program like Slic3r to convert the STL file to GCode.)

...

Can Linux CNC handle all that?

Yes. Anything that involves the controlled movement of any sort of machine can be done by LinuxCNC as long as those motions can be encoded in G-code.

So if I want to do a 3D image on a plaque, LinuxCNC can handle that? For instance if I want to do an image that has curved slopes or half a dome or cylinder sticking up out of the surface, can it do that?

Could I do a design in Blender that involves, say, cutting a piece of wood to size and shape, and putting engravings or holes of varying depths into the wood piece I'm cutting out?


If you have a CAM system that can create the G-code that specifies how to do that, LinuxCNC can do the rest. And what you describe is the sort of basic thing that any CAM system (except for a Slicer) should be able to do.


Got that. So now the next part I need to find an answer to is if BlenderCAM works well with the CNC system I want to get - or if there's a better one that will work with the output from Blender.

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 07:35 - 18 Jul 2020 07:36 #175024 by Mike_Eitel
Just a simple small step for first result
Linuxcnc can convert by an included tool a jpg file into a running gcode.

So you build your hw, connect your electronic, adjust your machine. All works, you smile first time. Then you simply load a jpg file, play a bit with the described parameters and click the start button. And have a big smile.
For making signs that is a working way. You will be sucked into 3d modeling later.. Promised!
Last edit: 18 Jul 2020 07:36 by Mike_Eitel. Reason: Typos
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 15:00 - 18 Jul 2020 15:12 #175052 by jbraun

When you say "but it works well enough," what do you mean?

works well enough = meets all my current needs
Adding Mesa hardware increases the rate pulses can be generated and read but the computer alone can take care of all of this within it's limits. Mesa hardware also includes many inputs/outputs where the G540 is more limited because the drives are integrated with the breakout board plus it's all through a single DB25. The good news is you can try it my way and if you don't like it everything can be reused with Mesa bits added into the mix.

Whether g-code is created in Blendercam or FreeCad or anything else it's still g-code. If Blendercam works with bobscnc/grbl it should work with linuxcnc. It's a matter of choosing the right post processor in Blendercam.

btw: get a linuxcnc live image and try some simulation, hardware isn't needed to test and play. Camotics is useful for simulation as well.
Last edit: 18 Jul 2020 15:12 by jbraun.

Please Log in or Create an account to join the conversation.

More
18 Jul 2020 21:16 #175080 by Tango

When you say "but it works well enough," what do you mean?

works well enough = meets all my current needs
Adding Mesa hardware increases the rate pulses can be generated and read but the computer alone can take care of all of this within it's limits. Mesa hardware also includes many inputs/outputs where the G540 is more limited because the drives are integrated with the breakout board plus it's all through a single DB25. The good news is you can try it my way and if you don't like it everything can be reused with Mesa bits added into the mix.

Understood - thanks for helping me get a better grip on that.

Whether g-code is created in Blendercam or FreeCad or anything else it's still g-code. If Blendercam works with bobscnc/grbl it should work with linuxcnc. It's a matter of choosing the right post processor in Blendercam.

Could you tell me more about post processors? Is it the post processor that customizes G-code for something like LinuxCNC or UGS or some other control program that will talk to the hardware and tell it what to do?

btw: get a linuxcnc live image and try some simulation, hardware isn't needed to test and play. Camotics is useful for simulation as well.

Cool! Did NOT know that. Thank you!

Please Log in or Create an account to join the conversation.

Time to create page: 0.092 seconds
Powered by Kunena Forum