Welcome! Log In Create A New Profile

Advanced

Problems generating/interpreting G code correctly.

Posted by flydeprutten 
Problems generating/interpreting G code correctly.
September 16, 2017 04:39PM
Hi

I'm building my first 3D printer, and in order to challenge myself a bit, and to get as much time out of the project as possible, I have chosen to make my own design (highly inspired by people here on the forum and others places on the internet smiling smiley).

My design is coreXY, made of V-slot profiles, and for the time being I use a RAMPS controller with the latest Marlin firmware. I have finished the X/Y-axis, but the z-axis is still missing. To test the X/Y-axis, I have put a temporary wooden board in as a "build plate", and have tried to draw something with a pen. I have tried to make some simple test drawings in inkscape, and here is the problem. Figures consisting of straight lines (G01 commands) will be perfect, but figure made with arcs (G02 and G03 commands) does not look right.

Unfortunately, this shows my lack of experience with 3D printers, as I have no idea why this occurs. Is there a problem with the G code because of inkscape, it is a problem with Marlin, or something completely different.

This is how the G code looks on my computer:


And this is how i looks on paper, printed by my 3D printer:


This is the G code:
https://pastebin.com/jgXeeQ3U
VDX
Re: Problems generating/interpreting G code correctly.
September 16, 2017 06:14PM
... most likely the printer is loosing steps ...


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Problems generating/interpreting G code correctly.
September 16, 2017 07:28PM
Speed? Acceleration? Jerk/junction deviation?


Ultra MegaMax Dominator 3D printer: [drmrehorst.blogspot.com]
Re: Problems generating/interpreting G code correctly.
September 17, 2017 03:11AM
Quote
the_digital_dentist
Speed? Acceleration? Jerk/junction deviation?

Yes sorry, I should have said that smiling smiley :

Jerk: 20 mm/s
Acceleration: 300 mm/s/s
Speed: 50 mm/s

I'm using the DRV8825 stepper driver, set to 1/32 microstepping.

Quote
VDX
... most likely the printer is loosing steps ...

The problem is very constant. If I print the B several times, they will look like carbon copies, and if I print something that consists of straight lines, they will be perfect. I have set the current of the stepper motor relatively high and I can, with no reasonable strength, move the printer head by hand while it is printing (I do not know if I can test it in this way).
Re: Problems generating/interpreting G code correctly.
September 17, 2017 09:02AM
I have made a new picture of the problem. Here's the speed of 25mm/s, and I've used A4988 stepper drivers with 1/16 microstepping (I've obviously corrected Marlin's configuration):


VDX
Re: Problems generating/interpreting G code correctly.
September 17, 2017 12:10PM
... hmmm ... looks like the radii and curves are calculated wrong confused smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Problems generating/interpreting G code correctly.
September 17, 2017 12:20PM
Maybe you're the first who actually uses the arc commands with Marlin? Or there's a bug in the inkscape plugin?
PS: Just opened the gcode file in CNC-Viewer and it looked OK. So it seem to be Marlin messing up the data ( surprise, surprise )

Edited 1 time(s). Last edit at 09/17/2017 12:28PM by o_lampe.
Re: Problems generating/interpreting G code correctly.
September 17, 2017 05:06PM
Quote
o_lampe
Maybe you're the first who actually uses the arc commands with Marlin? Or there's a bug in the inkscape plugin?
PS: Just opened the gcode file in CNC-Viewer and it looked OK. So it seem to be Marlin messing up the data ( surprise, surprise )

Ok, I uploaded the Repetier firmware to my controller, and despite some problems configuring the firmware, I got it to work:



I'm very surprised at such a bug in Marlin. Is it really because you do not use arcs when generating g code for 3D printers, or just because inkscape uses the G02 and G03 commands in an abnormal way.
I chose Marlin because it seemed as if it was the most used, and therefore the most supported, but this makes me doubt the quality of the software.
VDX
Re: Problems generating/interpreting G code correctly.
September 17, 2017 05:18PM
... last time, when I've checked this with Marlin, it simly ignored G2/G3.

There are other programs too, handling G2/G3 different or erroneous -- so I'm used to convert curves or splines in segments with variable resolutions ... that seems to be usual with nearly all my CAD/CAM softwares confused smiley


Viktor
--------
Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Re: Problems generating/interpreting G code correctly.
September 19, 2017 06:06AM
Yesterday I tested my CNC-mill for the first time and took your gcode file.
With DuetWiFi and RRF it looks like the math is correct in RRF. ( but the mechanical accuracy needs some tweaking )


Re: Problems generating/interpreting G code correctly.
September 19, 2017 10:05AM
The G02/G03 arc commands originated back when most G-code programs were being written by hand. There are two different ways to calculate the control point coordinates so you have to make sure the firmware and CAM/Post are on the same page. ( [machmotion.com] )

Modern CAM generally segments all curves into lines and does not produce any arcs at all. Computer generated tool-paths are often too complex to be represented with G2/G3, and if your program is going to be twenty thousand lines of G1 anyways there is no point trying to slip in one or two arcs to save space.


Re: Problems generating/interpreting G code correctly.
September 19, 2017 12:38PM
Quote
o_lampe
Yesterday I tested my CNC-mill for the first time and took your gcode file.
With DuetWiFi and RRF it looks like the math is correct in RRF. ( but the mechanical accuracy needs some tweaking )

[attachment 98210 B_gravur.jpg]

Thats good to see. smiling smiley

I am also going to update to a 32-bit controller at a later time, but as long as I'm not done with the printer, I will stick to Mega + RAMPS ..

Quote
691175002
Modern CAM generally segments all curves into lines and does not produce any arcs at all. Computer generated tool-paths are often too complex to be represented with G2/G3, and if your program is going to be twenty thousand lines of G1 anyways there is no point trying to slip in one or two arcs to save space.
I suppose that this also applies to slicers. It's nice to know that I still have the possibility of using Marlin.
Re: Problems generating/interpreting G code correctly.
September 20, 2017 02:09AM
You could try grbl on your Mega/RAMPS. I'm sure this has been done before. ( maybe not with CoreXY kinematics )

PS: What's the name of the font you've used and which inkscape-extension did you use to generate gcode? ( I'm getting bored of milling "B"s only winking smiley )

Edited 1 time(s). Last edit at 09/20/2017 05:58AM by o_lampe.
Re: Problems generating/interpreting G code correctly.
September 20, 2017 08:27AM
Quote
o_lampe
PS: What's the name of the font you've used and which inkscape-extension did you use to generate gcode? ( I'm getting bored of milling "B"s only winking smiley )

I'm at work right now, but I'll make a quick guide when I get home. Just remember that I'm not an expert on inkscape or g-code. winking smiley
Re: Problems generating/interpreting G code correctly.
September 20, 2017 04:09PM
Start downloading and installing inkscape ... You know the routine ... smiling smiley
In Inkscape, go to Extension-> Gcodetools-> Orientation Points:


Just use the default values and press Apply:


This will create your building area. Unfortunately, there is an error in the plugin, and the point 100; 0 is not set correctly in inkscape. Double-click the object so that you can choose the right point as I've done below (if the selection does not look like mine, then press a blank space on the document a few times and try again).


In the toolbar, change X to 100, then 100; 0 point is located correctly:


Like this:


Go to Extensions-> Gcodetools-> Tools library:


Use the default setup and press Apply:


This will generate an object with your tool setup. The interesting thing for me is feed, which is the mm/min. When you are going to mill, there are certainly others that are interesting:


Select the writing tool and start typing. I use Sans-serif, as it's a simple font:


Use the select tool, and select the text:

Re: Problems generating/interpreting G code correctly.
September 20, 2017 04:11PM
Go to Path->Object to Path. This will convert the text to paths. Inkscape stores text like this, as a text-object, which can be edited later on. We need it to be paths, that can be converted to g-code:


While your text is still selected, go into extensions-> Gcodetools-> Path to Gcode:


Enter the Preferences tab and make sure the folder, the code is stored in, exist:


Go back to Path to Gcode and press Apply. This will save your g-code in the folder you selected:

Re: Problems generating/interpreting G code correctly.
September 21, 2017 01:32AM
Thank you for the elaborate description! thumbs up

I used to go to " engraving" right away and was frustrated because the origin and the tool weren't specified. Also the result was a solid object instead of outlines.
Sorry, only registered users may post in this forum.

Click here to login