LinuxCNC as a 3D Printer
2017-05-16 LinuxCNC as 3D Printer Updates - IT WORKS
My workflow consists of Solidworks (Windows) -> Slic3r (Windows) -> LinuxCNC.
Slic3r does need a bit of configuration for it to make gcode that doesn't enrage linuxCNC. The highlights:
Printer Settings->General Change output type to Mach3/LinuxCNC -- This will remove M82 error codes.
Printer Settings->Custom G-code->End G-Code
Put a semicolon at the head of the M84 line for disable motors
Add an M2 to properly end a gcode program as the last line.
Put a semicolon in to comment out the G28 for rehoming the X axis.
M104 S0 ; turn off temperature
;G28 X0 ; home X axis
;M84 ; disable motors
M2
The remapping stuff wasn't as hard as I made it out to be. I abandoned the remappings from MachineKit. The "silver bullet" was to add USER_M_PATH = /home/blah/hablasdfjasfd/path to point to a folder with the M1xx files in it. I created a dummy shell script that just prints the command line arguments and does nothing else. This removed all complaints about unknown M codes
dummy_m_code.sh contains:
#!/bin/bash
# THC Enable
exit
I used
ln -s dummy_m_code.sh M101
ln -s dummy_m_code.sh M102
...
to create symlinks for each of the Mcodes specific to 3d printing. Each one of those will get mapped to custom shell function that does something appropriate.
The files available in sam0737's github repo for hrepstrap still have utility even though they are old. I haven't built up an arduino with heater/extruder controls on it to REALLY test it out. The python virtual control panel did fire up easily enough using the directions in the readme. The real trick was the USER_M_CODE = pathpathpath to get linuxcnc to start using the custom M Codes without individual REMAP directives.
The above software toolchain works well enough with the simulator and when I coupled it to an hm2eth board.
2017-03-20 Started working with LinuxCNC as the motion engine in a 3D Printer
Here is what I have learned:
Slic3r has an output option for Mach3/LinuxCNC - Great! There were some bugs with retract, but they may be fixed or are on the their way to being fixed.
Slic3r spits out a bunch of m-codes that need remapped. Fine: LinuxCNC can do that.
These codes were remapped by the gang over at machinekit:https://github.com/machinekit/machinekit/tree/master/nc_files/remap-subroutines/fdm
I can get the remappings to be located, they don't seem to take hold in the interpreter. i.e. if I mung a name of a config file intentionally, it complains about not being able to find it. If I delete a file for m107.ngc, linuxCNC fails to load, so it seems that it is finding the file and doing something with it. However, if I type m107 in the interpreter, it complains that m107 isn't a valid code.I have effectively remapped m400 as in the documentation at http://linuxcnc.org/docs/html/remap/remap.html#_upgrading_an_existing_configuration_for_remapping]
I did have to tweak the example by changing the file myprocedure.ngc: o<m400> needed to change to o<myprocedure>. It did work after that.
I currently can remap M404 to use the m104.ngc gcode, but I can't remap M104 to m104.ngc... not sure why yet.M100-M199 can only be a shell executable program as far as I can tell. It is great to know how to kick off executables to do funny things to the machine, but not what I was looking for.
Putting a sacrificial M104 empty shell script program out there and then remapping it didn't cause the remapped script to run.