Welcome! Log In Create A New Profile

Advanced

Invalid M code

Posted by appjaws1 
Invalid M code
September 09, 2014 03:38PM
I have been trying to get my 2 nozzle ormerod working in 2 colour mode with simplify3D as the slicer.

It appears that I need to define the nozzle offset by the use of M218.

I put the following into the starting G-code section in simplify3D
M218 T1 X0 Y0;
M218 T2 X11.95 Y0.35;

This did not work and when I just send M218 in the web interface, I get Error: invalid M Code: M218

Does M218 need adding to the firmware?
Could M218 be used in slic3r or in the ormerod config file?

Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 09, 2014 04:47PM
M218 is not supported by the firmware. I believe that the intention is that the RepRapPro firmware should support nozzle offset configuration via the G10 command. I held off adding this in my firmware because I thought that RRP were going to add support for it soon, and because slic3r can handle nozzle offsets itself by adjusting coordinates in the gcode.

M218 is not listed in [reprap.org].



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Invalid M code
September 09, 2014 08:06PM
Is simplify3D any good? I see it's quite expencive.


Please send me a PM if you have suggestions, or problems with Big Blue 360.
I won't see comments in threads, as I move around to much.
Working Link to Big Blue 360 Complete
Re: Invalid M code
September 10, 2014 02:22AM
I have been experimenting with Kisslicer (Pro $42 version) for a couple of weeks. It makes the support much more suited for multi-material support printing.

Kisslicer does not handle the offset either, so I hacked together a small python script. It add an offset to the G1-coordinates when T2 is in use. Please note, it's a quick hack for the Kisslicer output file - after not programming Python for about 10 years....

I have used it a couple of times, so it's actually working grinning smiley

You are welcome to attach a one of your gcode-files, so I can have a look at it and run it through the script. I would be very interested to see some results from another slicer.

:-) Carsten
Attachments:
open | download - extr2offset.py (1.1 KB)
Re: Invalid M code
September 10, 2014 04:38AM
Thanks for the script. How would I use it? (detailed instructions please for a novice)
I have attached the Traffic_Cone, sliced with simply3D as requested.

It would be so good to get duek nozzle working for simply3D.

Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Attachments:
open | download - Traffic_Cone_Rings_Orange-2.zip (493.2 KB)
Re: Invalid M code
September 10, 2014 05:58AM
Good question :-)

Just a very quick description

You need to install Python and include the installation directory in the PATH environment variable. Download version 3.X.X at Python download

Then you place the gcode-file in the same directory as the script, open a CMD-prompt and type "python extr2offset.py gcode-filename"

Example: "python extr2offset.py Traffic_Cone_Rings_Orange-2.gcode"

The script makes a new file ending with "_T2Offset.g", e.g. "Traffic_Cone_Rings_Orange-2_T2Offset.g"

I had to try it on Simply3D right away - didn't work out of the box - Simply3D uses G0-codes. It should work now. New script attached.

I have also attached a converted cone-file. The T2 X-offset is 22mm. If you have another offset, let me know and I'll make a new file. The offset hardcoded in the script.

I hope this help. You can get a long way with Googling a little bit for Python.

Let us hear your results.

Best regards

Carsten
Attachments:
open | download - extr2offset.py (1.2 KB)
open | download - Traffic_Cone_Rings_Orange-2_T2Offset.zip (471.6 KB)
Re: Invalid M code
September 10, 2014 06:26AM
Quote
colsenfoto

I had to try it on Simply3D right away - didn't work out of the box - Simply3D uses G0-codes. It should work now. New script attached.

I have also attached a converted cone-file. The T2 X-offset is 22mm. If you have another offset, let me know and I'll make a new file. The offset hardcoded in the script.

Carsten

Thank you very much I had figured out how to use your file and put my own offset in.
I was just about to let you know about the G0 problem.

I will try the new script.

Great job

Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 10, 2014 06:40AM
Just converted using new extr2offset.py and noticed that their was an error produced.

line 35, in
value = float - xOffset
ValueError: invalid literal for float<>: 2;

I don't think this has affected the conversion, but I'm not sure if this is a problem or not.

Just about to print a new Traffic cone

Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 10, 2014 06:55AM
I hove no idea what happens. It's probably a single line in the gcode-file that gives the error.

Are you converting the same cone-gcode-file as you attached to a previous post?
I'm not getting any errors when I run my script.

You could attach your edited version on the script, and I'll give it a try. My Python is pretty rusty, though - but maybe... :-)

:-) Carsten
Re: Invalid M code
September 10, 2014 08:13AM
Thanks Carsten,

I had to make a new file and hadn't configured the 2 stl files with the correct tool.

finger trouble

I am printing the cone again and apart from messing up the first few layers of the base changing colours and printing a large circle on the second layer (first tool change). I think that should have been skirt. I need to look into the settings on simplify3D and try to understand what caused this.
Apart from that the print is looking good, will post a photo when finished.
Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 10, 2014 09:01AM
Quote
colsenfoto

You could attach your edited version on the script, and I'll give it a try. My Python is pretty rusty, though - but maybe... :-)

:-) Carsten

My cone print failed, nothing to do with your conversion.

I have made a small cube as a test and when I run extr2offset.py I get the following error:-

line 35, in
value = float - xOffset
ValueError: invalid literal for float<>: 2;

I can't see what is causing this, perhaps you would be kind enough to take a look.

Thanks
Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Attachments:
open | download - testcube2.gcode (33 KB)
open | download - testcube2_T2Offset.g (33.2 KB)
open | download - extr2offset.py (1.2 KB)
Re: Invalid M code
September 10, 2014 10:01AM
I simply _had_ to look at it :-)

The problem is in line 1301 in the gcode input file.

The line is: "G1 Y190 X2; park the machine"

The script is trying to convert the string "X2;" to a float, which fails due to the ";"

The problem should not have affected the print, as the G1-code was only parking the head.

I just tried splitting the lines with ";" also - line 31 in the script. It looks like its working.

I'm getting curious about Simplify3D. Is it possible to specify different extruders for support (and maybe support-interface)?

:-) Carsten
Attachments:
open | download - extr2offset.py (1.2 KB)
Re: Invalid M code
September 10, 2014 10:19AM
Quote
colsenfoto

I'm getting curious about Simplify3D. Is it possible to specify different extruders for support (and maybe support-interface)?

:-) Carsten
Yes different extruders can be set for different tasks like support or internals etc., have a look at the videos on www.simplify3D.com

no errors now with the py file - thanks

Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 10, 2014 11:05AM
Seeing that at least two people are running into problems because of the lack of support for nozzle offsets in the Duet firmware, I've started adding it. So far I've just added the code to have G10 store and retrieve the nozzle offsets for each tool. Now I need to actually use them. There are a few complications:

- When applying axis limits, the stored axis limits are valid for a nozzle with no offset. So axis limits need to be applied after adjusting the requested position for the tool offset.

- When homing, the endstops define the positions of a nozzle with no offset

- G92 is tricky. Does G92 define the position of a tool with no offset, or the actual tool in use? When sending G92 manually, it makes sense that it defines the position of the tool in use. This will work OK for people who use homing files based on my own, which don't contain G92 commands. But it won't work with RRP's homing files, which rely on sending a G92 command after an endstop is presumed to have been hit. And at present, a G92 command has to be used when homing the Y axis on an Ormerod 2 even when using my firmware fork, because the Y endstop is configured in the firmware as a high endstop but it is actually a low endstop.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Invalid M code
September 10, 2014 12:31PM
Thanks for your work on this David,

I have totally confused myself whilst trying to comment on the above.
I suppose the correct thing to do is to define the actual tool's position and the offset should be taken into account when defining the limits so in effect we have a slightly smaller print area by the offset amount.


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 10, 2014 12:31PM
Interesting. If I get this right, I would implement tool offsets this way:

- I think in the first place axis limits should be specified for the raw head position only; when specifying offsets using G10, axis limits should be reduced by the min+max offsets. OTOH, M208 must take care if an offset was specified earlier and adjust them properly

- This way when an endstop is hit, we can still rely on the axis minima and maxima. Further it may be a good idea to introduce G1 ... S2 to tell the firmware to set the axis maximum as the current position when an end stop is hit (for Ormerod 2)

- I'd only modify SetupMove (for regular G1 moves) and SetPosition (for G92) to apply the current tool's offset. This way the Move class doesn't have to worry about offsets at all.

Do you see any problems if it were implemented this way?
Re: Invalid M code
September 10, 2014 01:22PM
That sounds absolutely great, Dave. Thanks for looking into the offset issues.

It's definitely not a straight forward task to implement proper offset handling. I know this from a previous job, that included software development for mobile mechanical systems with offset-handling.

All internal calculations were made with non-offset coordinates, and then the offsets were added or subtracted on all user-interactions.

@appjaws1, I watched the Simplify3D review on YouTube. That program looks fantastic. I especially noticed, that you can specify gaps between model and support. Hopefully I have some good dual material support results to show in near future.

:-) Carsten
Re: Invalid M code
September 10, 2014 02:41PM
It turns out, that my fix for the Python error killed the script totally - it just copies the whole file....
I found another error, where the yOffset was subtracted from the Z-coordinate (should have been zOffset)

I have rolled back and corrected the zOffset. This means that you will get an error, if a coordinate is not immediately followed by a " " (space).
For the files I have seen from Simplify3D this only happens at the very end of the gcode-file. It's probably a missing space in the post-gcode in Simplify3D - please check your post-gcode @appjaws1

It's just a matter of parsing a pretty simple string in Python, but it's apparently pretty hard :-)

:-) Carsten
Attachments:
open | download - extr2offset.py (1.2 KB)
Re: Invalid M code
September 10, 2014 03:09PM
Thank you Carsten,

That script now works great, you were right, a missing space.

Thank you for all your help
Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 10, 2014 03:27PM
Good to hear that it works now, Paul

Let's see a picture of your print, when you get one.

:-) Carsten
Re: Invalid M code
September 10, 2014 07:22PM
I have put a test version of firmware with G10 nozzle offset support at [dl.dropboxusercontent.com]. It seems to work OK on my machine although I have yet to do a full print with it.

I have the following in my config.g file:

M563 P1 D0 H1              ; Define tool 1
G10 P1 X-11 Y0 Z0 S0 R0    ; Set tool 1 offset, operating and standby temperatures
M563 P2 D1 H2              ; Define tool 2
G10 P2 X11 Y0.4 Z0 S0 R0   ; Set tool 2 offset, operating and standby temperatures
M92 E420:420               ; Set extruder steps/mm

G92 commands will always assume that the coordinates you give are of the head as a whole, not a particular nozzle. This means that homing files containing G92 commands will still work. However, the head positions reported by the web interface and by the M114 command will be the position of the current tool, if a tool is selected.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Invalid M code
September 11, 2014 01:28AM
Thanks, Dave.

I guess it's time to upgrade, when I get home from work.

:-) Carsten
Re: Invalid M code
September 11, 2014 06:24AM
Quote
colsenfoto

I'm getting curious about Simplify3D. Is it possible to specify different extruders for support (and maybe support-interface)?

:-) Carsten

Hi Carsten

These are the options for every process:












Erik
Re: Invalid M code
September 11, 2014 08:14AM
Quote
dc42
I have put a test version of firmware with G10 nozzle offset support at [dl.dropboxusercontent.com]. It seems to work OK on my machine although I have yet to do a full print with it.

I have the following in my config.g file:

M563 P1 D0 H1              ; Define tool 1
G10 P1 X-11 Y0 Z0 S0 R0    ; Set tool 1 offset, operating and standby temperatures
M563 P2 D1 H2              ; Define tool 2
G10 P2 X11 Y0.4 Z0 S0 R0   ; Set tool 2 offset, operating and standby temperatures
M92 E420:420               ; Set extruder steps/mm

G92 commands will always assume that the coordinates you give are of the head as a whole, not a particular nozzle. This means that homing files containing G92 commands will still work. However, the head positions reported by the web interface and by the M114 command will be the position of the current tool, if a tool is selected.

Just to let you know the new firmware seems to be working OK. I can now print 2 colours using simplify3D as the slicer.

These are my settings in config

M563 P1 D0 H1 ; Define tool 1
G10 P1 X0 Y0 Z0 S0 R0 ; Set tool 1 offset, operating and standby temperatures
M563 P2 D1 H2 ; Define tool 2
G10 P2 X-11.95 Y0.35 Z0 S0 R0 ; Set tool 2 offset, operating and standby temperatures

Thanks for all your hard work David

Paul


appjaws - Core XYUV Duet Ethernet Duex5
firmware 3.1.1 Web Interface 3.1.1
Ormerod 1-converted to laser engraver, Duet wifi
OpenSCAD version 2020.07
slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1
Re: Invalid M code
September 12, 2014 01:27PM
Thanks for the screen dumps, Erik.

It looks very promising.

:-)Carsten
Re: Invalid M code
September 12, 2014 04:19PM
I've now now checked in the 0.76s-alpha binary (with G10 nozzle offset support) along with thr source code at [github.com].



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Invalid M code
October 07, 2020 01:51AM
To all,Ihv converted my cnc router to 3d printer,newly to 3d print.pls educate me on how to set up my machine for printing my first print,l hv install pronterface and configure marlin firmware on arduino.on clicking machine on,pronterface get loaded and am able to jog axis but not to my requirements.pls advice me on some instructable or video to learn.thanks in advance
Sorry, only registered users may post in this forum.

Click here to login