Welcome! Log In Create A New Profile

Advanced

Can Slic3r be used to generate GCODE for CNC machine?

Posted by elikloft 
Can Slic3r be used to generate GCODE for CNC machine?
October 26, 2015 04:54PM
The wiki for Slic3r states that "Slic3r is the tool you need to convert a digital 3D model into printing instructions for your 3D printer." Could Slic3r also be used to generate GCODE for a CNC machine instead? We have access to a CNC machine and would like to add a 3D printing head to the machine. We also have access to the post-processor which will translate the GCODE to that specific CNC machine.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 26, 2015 06:30PM
Your question could be easily misinterpreted.
To make it clear : It IS possible to make a CNC machine behave like a 3D printer as the XYZ positioning is about the same.
What is neded is to add an extruder head with heater control to extrude plastic at the track specified by Gcode produced by a slicer like SLIC3R.

The reverse interpretion that 3D slicers should produce G-code for CNC machining is not a simple thing but they are often used with probing to scan models into 3D

My first 3D printer was actually a small CNC machine with extruder attached at tools place.and heating control and plastic trasnport controlled by a small CPU card.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 27, 2015 09:13AM
A 3D printer controller requires 4 axis (X,Y,Z and the extruder) and a temperature-controlled heater. The output from the slicing program is designed to control those 5 things, so you will need to explain how you have connected the controller of your CNC mill to operate the Z axis, extruder and hotend heater.

Dave
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 27, 2015 10:55AM
Or you could post-process the gcode to strip out the temperature controls and the E axis.

BUT:
  • You'd need to reconcile that fact that on a 3D printer your Z axis starts at 0 and increases whereas on a CNC machine Z generally starts at 0 and decreases.
  • most CNC machines are capable of producing arcs via G2 and G3, but I'm not sure slic3r can generate them.
  • you'd have to somehow account for tool radius. You might be able to do it by setting the extrusion width to the tool diameter, but I'm not certain that would work


There are probably many other issues. These three just popped into my head
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 27, 2015 11:45PM
Quote
dmould
A 3D printer controller requires 4 axis (X,Y,Z and the extruder) and a temperature-controlled heater. The output from the slicing program is designed to control those 5 things, so you will need to explain how you have connected the controller of your CNC mill to operate the Z axis, extruder and hotend heater.

Dave

Dave, I was watching this video and they mentioned something about using the 4th axis. I'm not sure what it was. I included a link to the video. elikloft and I are trying to do the same thing but on a larger machine.
3D print head on CNC

Heres a link to photos of the machine we're trying to put the print head on
Photos of the machine. An Onsrud

If you notice, theres a picture of all the servos/drives in the back for each axis. Is that what your referring to as using the other axis?

Is there a way Slic3r can just program the toolpaths/movements for the machine, then use a seperate controller for the extruder temp and speed of the filament? Is the feedrate of the filament constant or vary?

From my understandinf of what you guys are saying. Slic3r can also write certain g codes for extruder temp, speed, etc? That would be nice because then I could probe the machine and tap into where it sends the specific g code signal from in theory.

Edited 1 time(s). Last edit at 10/27/2015 11:49PM by Shelbey.Cobra.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 28, 2015 08:52AM
Thinking about it, I do not believe that a CNC machine will have a controller that is capable of running a 3D printer file without firmware modification - no matter what the format of the print file. The reason being that the filament feed rate must be tied to the XY move speed, and is not constant. A standard print file will give the XYZ move and speed (in exactly the same way as a CNC G-code file), but will specify how much filament to feed over the duration of that move. The printer controller must then control the extruder so that the specified amount is extruded evenly over the distance of the move. The XY move is not usually at a constant speed (it includes acceleration and deceleration phases), and the extruder's speed must be in exact proportion to the XY speed in order to spread the required amount of plastic evenly. This is a function that a CNC controller is not going to have. If, for example you tied the extruder to the CNC machine's spindle drive, its controller would only be able to handle commands to change the spindle speed (RPM), which is (a) not good enough to extrude the precise amount of plastic and (b) would not be tied to the XY move. AFAICS there is no way to change the G-code file format in a way that would make the controller behave as required unless you can think of a way to adapt the theta move output (if it has one) to drive the extruder. Theta moves are often tied to XY moves in a similar way to extruder moves, but I cannot think of a way it could be adapted in the G-code file to drive an extruder.

I think the best way forward would be to modify the CNC controller's firmware so that it can control the extruder (and Z axis) in the way a FFF printer needs. In that case you would also modify its input parser to accept standard FFF G-code files.

If that is not possible (e.g. because the controller's code is closed-source), the next easiest would probably be to replace the CNC controller with one designed for a FFF printer (such as the Duet), and adapt its outputs to drive your mechanics. Both the Duet board schematic and the firmware source is available and actively maintained by people who would almost certainly be willing to offer at least limited advice, so you could make any necessary hardware & firmware modifications to the format of its drive outputs. The Duet also has plenty of spare inputs that, with suitable firmware changes could be used to control feedback (servo style) XYZ mechanics (which your machine probably uses) instead of stepper-motor style mechanics.

Dave
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 28, 2015 01:19PM
@dmould :
You should really not try to explain something you obviously do not understand :-(. you create a lot more confusion than necessary for a novice that try to understand what is needed.

As explained above a 3D printer has four "axes" to move, XYZ and an extra E (or A) for extruder. This is available in any 3D printer but not necessarily in a CNC machine where XYZ is basic.
if CNC does not have drivers for extra axes this must be added by HW for the extruder, but that is a simple thing just by adding an extra controller and extraordinary find an extruder with stepping motor and heater. Signals for the extra E axe is already produced in the printer slicing sw output so the CNC should route this infomation to the extra axe added (E/A).
The heating control would be stand alone but could be controlled manually as it would get more complex if it also should be driven by same Gcodes, but of course this could be done also, but is not necessary.
The code for printing is still produced by any slicer but it may be necessary to do some gcode pre processing to keep out commands that is not recognizeable by the specific CNC machine.

KISS IT.......and go on with transforming your CNC robot. Take a look into some Gcodes and try to understand what happens in a printer different from CNC processing controlled by the same Gcode..
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 28, 2015 10:19PM
Another obstacle that occurred to me after my last post is that the 3D printer is an additive process, whereas the CNC is a subtractive process. The G Code for 3D printing is to fill in the interior, whereas the G Code for CNC is to remove the exterior.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 29, 2015 02:13AM
@jbernardis
Yes and that is why we use different sw to generate the gcodes as they have to know what we intend to do, but the CNC does not really care as the XYZ movements are the same and the extruder is just another axes added. Heater could be controlled by start/stop only in the simplest version by a PID controller.

Edited 1 time(s). Last edit at 10/29/2015 02:13AM by justcurious.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 29, 2015 08:14AM
Quote
justcurious
You should really not try to explain something you obviously do not understand :-(. you create a lot more confusion than necessary for a novice that try to understand what is needed.

I would politely suggest that you take your own advice.

It is a lot more involved than simply adding another driver. As I attempted to explain, the controller firmware must tie the extruder speed to the XY speed - simply sending the extrusion amount to a separate extruder driver is not going to work because the controller will have no idea what speed to drive the extruder - extrusion speed is tied to XY speed which is highly variable.

Dave

Edited 1 time(s). Last edit at 10/29/2015 08:15AM by dmould.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 29, 2015 11:22AM
Maybe the difference between your advice and mine is that I actually made a CNC machine do 3D printing.
how do you think 3D printers extruder is working with XYZ and what do you think is different with a CNC machine having the same axes available?
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 29, 2015 12:48PM
So this is a 5 axis machine. The bridges controls XY and the table moves back and forth for the Z axis. Then the head rotates and pivots. I'm not sure yet what axis those are labeled as. I believe E or A, but if you look at the photos it shows the label on some of the drives/servos. Obviously I feel that theres multiple ways of doing this, and of course we're trying to start with something easy then get more fancy.

From what I saw on that kick starter video, it sounds simple enough as
Quote
justcurious
was saying. Did you guys watch that video?

So it sounds we may be able to utilize the addition 4 ot 5th axis to operate the extruder? We plan to the temperature of the gun seperatly.

I should start with seeing what some standard g code is for 3d printers. Im familiar with CNC but not 3d printers. Any suggestions for where I can find a list of some standard stuff?
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 29, 2015 03:16PM
4 axes is what you need. XYZ and the extra E/A for the extruder. Just go for it and have some fun.

Why not install your first slicer. Go to Slic3r.org and install Slic3r.
go to Thingiverse.com and download a simple testobject and let Slic3r make the gcode like this one Simple test.
Read through the gcode and try to understand what happens and find some of the new codes that are unfamiliar and not known by CNC machine.

Maybe this site could give you some hints on how a 3d printer is working: : RepRap wiki

Good luck

Edited 1 time(s). Last edit at 10/29/2015 03:21PM by justcurious.
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 30, 2015 08:11AM
Quote
justcurious
Maybe the difference between your advice and mine is that I actually made a CNC machine do 3D printing.
how do you think 3D printers extruder is working with XYZ and what do you think is different with a CNC machine having the same axes available?

I think that the difference is with the control firmware. A CNC machine has no axis that behaves in the same way as an extruder and so requires changes to the control firmware. If you have made such a machine, perhaps you could provide the details of exactly what modifications you did which may be of more help to the OP that telling another poster that his advice is wrong.

Dave
Re: Can Slic3r be used to generate GCODE for CNC machine?
October 30, 2015 09:10AM
Quote
Shelbey.Cobra
I should start with seeing what some standard g code is for 3d printers. Im familiar with CNC but not 3d printers. Any suggestions for where I can find a list of some standard stuff?

A full list of G codes can be found here [reprap.org]. However most of these will only be used for particular printers, and the slicing software only generates a handful of these codes.

It is the movement codes that you need to consider the most. These are pretty straightforward. A printing move consists of the move command (G1) followed by a maximum of 5 parameters - X position (X), Y position (Y), Z position (Z), move speed (F) and filament feed amount (E). A non-printing move is the same but with no extrusion parameter (or zero extrusion). If there is no speed parameter, the last speed set is used. If any of the other parameters are missing, that axis does not move. There are two possible extruder modes, relative and absolute. In relative mode the extruder (E) value means the amount of filament to feed over that move only. In absolute mode the filament parameter refers to the total amount of filament fed since the start of the print or the last extruder reset command (G92 E0). So in the latter case the extruder amount will be steadily increasing (and would get too large over the course of a print so the slicing software will insert periodic extruder reset commands). You set the slicing software to produce its E output in relative or absolute mode. X, Y or Z positions can also be set to relative mode, but I know of no slicing software that produces code using relative X, Y or Z moves.

Example:

G21 - set units to millimeters
G90 - use absolute coordinates (X, Y and Z)
M83 - This command sets the extrusion amount to relative mode
G1 X83.5 Y74.4 Z0.25 F3600 - this will move the nozzle to bed position 83.5mm in X, 74.4mm in Y and 0.25mm above the bed (Z) at a speed of 3600 mm per minute (=60mm/s) without printing
G1 F1800 - this changes the default speed to 1800 mm per minute (30mm/s) with no movement
G1 X84.0 Y74.0 E0.03212 - This moves from the previous position to 84mm , 74mm at the current default move speed (30mm/s) and 0.03212mm of filament should be fed to the nozzle evenly during that move. Z will stay at 0.25mm
G1 X91.1 Y69.5 F3600 E0.15166 - Another printing move at a speed of 60mm/s - and will also change the default speed to 60mm/s. The nozzle is still 0.25mm above the bed

It is up to the printer's controller to ensure that the move is carried out with the appropriate acceleration and deceleration limits applied, and that the extruder speed is proportional to the XY speed at all times over the acceleration curve of the move so that plastic is extruded evenly. i.e. X,Y,Z and E moves are all tied together so that they all start and complete at the same time and always at speeds in the same proportion to each other.

Note that extrusion distance refers to the length of solid filament being fed into the hot nozzle chamber, not the amount of extruded molten plastic that leaves the nozzle.

Dave
TTN
Re: Can Slic3r be used to generate GCODE for CNC machine?
November 09, 2015 07:27PM
Quote
dmould
Quote
justcurious
You should really not try to explain something you obviously do not understand :-(. you create a lot more confusion than necessary for a novice that try to understand what is needed.

I would politely suggest that you take your own advice.

Dave

Just wow.

Dmould, you make it out to be a lot more complicated than it is and obviously don't really know what you're doing, which is fine, just try to keep the confusion posted on the thread to a minimum.

Basically, all you need to do is add an extruder (with accompanying heater, and stepper driver), hook it up so you can drive it via the gcode, and perhaps do some gcode post processing.
Re: Can Slic3r be used to generate GCODE for CNC machine?
November 10, 2015 06:34AM
Quote
TTN
Quote
dmould
Quote
justcurious
You should really not try to explain something you obviously do not understand :-(. you create a lot more confusion than necessary for a novice that try to understand what is needed.

I would politely suggest that you take your own advice.

Dave

Just wow.

Dmould, you make it out to be a lot more complicated than it is and obviously don't really know what you're doing, which is fine, just try to keep the confusion posted on the thread to a minimum.

Basically, all you need to do is add an extruder (with accompanying heater, and stepper driver), hook it up so you can drive it via the gcode, and perhaps do some gcode post processing.

Please could you give us the benefit of your experience by explaining a few details of how you "hook it up so you can drive it via the gcode". The electrical connections I understand, its the bit where you get it to respond to the G-codes that I am struggling with. AFAICS that will only be possible by modifying the controller firmware (or replacing the controller), but from what you say there is a far simpler way that I have not seen. It would be helpful if you would be so kind as to point me in the right direction so that I can see where I have been in error.

Dave
Re: Can Slic3r be used to generate GCODE for CNC machine?
November 12, 2015 01:57AM
I feel like we are having similar questions gentlemen. I think I figured out some better questions to ask.
- If you have watched the video link I included a little while back, this will make more sense. The Fastrax was a small destop CNC machine with an adaptable 3D print head step up.

Commonly you guys mention "use a 4th axis" I understand its used to control the extruder, which is a stepper motor. Using this 4th axis allows everything to stay in sync. Just as they have done in this video, I get that. But I noticed that their CNC machine uses stepper motors for its XYZ movements, which has some sort of rasberry pie or arduino to control the stepper motors. A 3D printer uses the same thing to control XYZ movements and the extruder because they're all stepper motors. So it was just that easy to utilize an existing controller, that already controls a stepper motor, to control another stepper motor. This larger CNC machine however uses servos/drives which is more complex. So my question is, can you use a servo/drive to control a stepper motor? and how?

Or you might be able to tap into the serial data or somethen coming from the machine that could tell a micro controller the machines surface speed, to allow the extruder and machine movement to stay in sync. So you would just be sending a signal from the machine to a separate controller that would then know when to tell the stepper motor to turn on/off and speed?

Tell me what you guys thoughts are.
Re: Can Slic3r be used to generate GCODE for CNC machine?
November 12, 2015 07:37AM
Quote
Shelbey.Cobra
I feel like we are having similar questions gentlemen. I think I figured out some better questions to ask.
- If you have watched the video link I included a little while back, this will make more sense. The Fastrax was a small destop CNC machine with an adaptable 3D print head step up.

Commonly you guys mention "use a 4th axis" I understand its used to control the extruder, which is a stepper motor. Using this 4th axis allows everything to stay in sync. Just as they have done in this video, I get that. But I noticed that their CNC machine uses stepper motors for its XYZ movements, which has some sort of rasberry pie or arduino to control the stepper motors. A 3D printer uses the same thing to control XYZ movements and the extruder because they're all stepper motors. So it was just that easy to utilize an existing controller, that already controls a stepper motor, to control another stepper motor. This larger CNC machine however uses servos/drives which is more complex. So my question is, can you use a servo/drive to control a stepper motor? and how?

Or you might be able to tap into the serial data or somethen coming from the machine that could tell a micro controller the machines surface speed, to allow the extruder and machine movement to stay in sync. So you would just be sending a signal from the machine to a separate controller that would then know when to tell the stepper motor to turn on/off and speed?

Tell me what you guys thoughts are.

The extruder must accurately follow the "E" parameter in the G-code as well as staying in perfect sync with the XY move & speed. It may be possible to fit a bespoke separate controller for the extruder that is fed with the same G codes so it knows how much filament to feed for each move, but the problem then will be to accurately synchronise it to the machine's XY moves so they execute each line of code at exactly the same time. It is unlikely that the machine has any form of output that would be suitable - especially as the extruder controller will need to know not only what the XY head is doing in real time, but also which line of the G-Code the present move relates to (the controller must buffer moves, so the incoming G-code data stream will not tell you which line is currently executing). If you are able to modify the machine's present controller firmware you could provide such an output (but in that case you could also provide an extruder output directly so you won't need a separate controller).

Personally, if I were modifying the machine, unless I was able to modify the existing controller's firmware, I would replace the machine's present controller with a 3D printer controller (such as the Duet), and connect it to the existing XYZ servo motor drivers (and servo feedback encoders) using spare I/O and maybe some additional glue logic. The Duet's firmware will then need to be modified to replace the stepper software drivers with drivers that control the servo drive logic on spare I/O pins - but the source code is available.

Dave
Sorry, only registered users may post in this forum.

Click here to login