Страница 1 из 2

Gcode for paths

Добавлено: 06 апр 2011, 15:02
Grumpy Mike
I have just got the gcodetools working, however there are a few problems. I don't get all the menu options like the manual says. Specifically I can't get anything to change the X and Y shift.
When I output a path of some text into Gcode the straight line stuff works fine but the arc segments look all wrong. For example one line reads:-
G03 X64.156616 Y181.767328 Z-0.900000 I0.334845 J-0.160290
As I understand Gcode the I and J gives the coordinates of the center of the circle. You can see this is a long way off the X & Y which is the end point. The net result on my system is that there are lots of large circles instead of the small arcs making up the path of the letter.
I have the latest 1.6 version and am running Inkscape 0.47 on a Mac.
Any idea what is going on?

Re: Gcode for paths

Добавлено: 06 апр 2011, 15:12
Have you tried or previewed this Gcode?
Yes the radius can be huge, but still arc will be small. It's just a little segment of the big circle. This means that path bends slightly, so to fit it best we have to use segments of big circles. For example straight line is a segment of circle with infinite radius.

About shifting, rotating and scaling. Now Orientation points are used for those purposes. When you apply Path to Gcode, you can notice that two arrows with texts are added to the drawing. They define the Orientation. You can define scaling, rotation and shifting by scaling, rotating and moving those points or changing values of the connected text.

You can make a template drawing, add there orientation points and tool definition and even draw your CNC Machine to be more user readable. Save it to a file for use it as a template for further work.

Re: Gcode for paths

Добавлено: 06 апр 2011, 16:59
Grumpy Mike
Thanks for that it makes sense with large radius, and small arcs.
root писал(а):Have you tried or previewed this Gcode?
I have just tried previewing it. The problem is that I am on a Mac and I don't have any preview applications that work with G2 & G3 codes, therefore I am trying to write my own in processing. This works on the test circles and arcs I put in. However on further investigation it is the G2 commands from the exported code that I am having trouble with. If I just leave the G3 commands in then the output looks reasonable.
Therefore I am inclined to think there is something wrong with my viewing program that is wrong. Do you know of any preview programs that work on a Mac?

Re: Gcode for paths

Добавлено: 06 апр 2011, 17:26
Good question...

You should look for gcode viewers written in python or java or online ones...

How do you control your cnc from MacOS?

PS are there any win emulators like wine in MacOS?

When you apply Path to Gcode from Gcodetools, A new group is added to the drawing, each piece of it is one of G01 G02 or G03 codes. G01 are red ones. G02 and G03 are blue and green.

Re: Gcode for paths

Добавлено: 06 апр 2011, 18:04
Grumpy Mike
root писал(а):How do you control your cnc from MacOS?
I wrote my own application in Processing:-
http://www.thebox.myzen.co.uk/Hardware/ ... rsion.html

I have written several Gcode generators but I want to be able to use a drawing tool like Inkscape to do text and more complex PCBs.
root писал(а):are there any win emulators like wine in MacOS
There are but I have not had much luck using them with Gcode viewers. Unfortunately I am not so much a software person and I had great difficulty getting Inkscape running with all the messages saying it was missing extensions. It's like one of those old fashioned adventure games. You can't run this because you haven got that, you go and get that but you can't have it until you get the other and then you need another widget to install it. And so it continues ....

Re: Gcode for paths

Добавлено: 06 апр 2011, 18:19
If you are fine with G01 codes you can do the folowing:

Select all paths then Extensions - Modify Path - Add nodes. Choose Ditance mode and set up preferred arc length. Apply.
Then press F2 and button which makes segments straight. When you apply Path to Gcode to such path (polyline) there will be only G01.

It's a quick but nasty solution.

Re: Gcode for paths

Добавлено: 06 апр 2011, 19:42
Grumpy Mike
root писал(а): Then press F2 and button which makes segments straight.
Just pressing F2 brings up the path editor. Export of Gcode still has G2 & G3.
If I select all the paths and hit the make segments straight tool, then try and export the gcode, inkscape brings up a blank dialogue box and crashes ( well after 40 minuites of high speed fan activity I did a force quit ).
So quick and dirty but not a solution.
Most of the other so called Gcode viewers on the Mac have issues. ReplicatorG doesn't show anything from Inkscape exported code even when you remove all the Z commands by hand. Plesent3D will not handle G0 codes let alone G2 & G3.
Anyway thanks for the input.

Re: Gcode for paths

Добавлено: 06 апр 2011, 19:48
Can you attach your svg file which causes Inkscape crash?

Hmm replicator works on MacOs? I'll check what why it does not work with this Gcode...
I remember that there was a little problem with Replicator on which we've made a little trick :).

Re: Gcode for paths

Добавлено: 06 апр 2011, 20:28
Grumpy Mike
Ok, file is attached.
Can you look at this code for me. It is the Gcode produced from a simple circle. You will see it has 8 segments. Can you use a Gcode viewer and confirm it is a circle (or ellipse)

Код: Выделить всё

G00 Z5.100000
G00 X11.570237 Y10.373333

G01 Z-0.025000 F100.0
G02 X10.401668 Y7.552154 Z-0.025000 I-3.989755 J0.000000 F400.000000
G02 X7.580501 Y6.383586 Z-0.025000 I-2.821168 J2.821162
G02 X4.759332 Y7.552154 Z-0.025000 I0.000000 J3.989730
G02 X3.590763 Y10.373333 Z-0.025000 I2.821185 J2.821180
G02 X4.759335 Y13.194496 Z-0.025000 I3.989706 J0.000000
G02 X7.580501 Y14.363052 Z-0.025000 I2.821165 J-2.821193
G02 X10.401665 Y13.194496 Z-0.025000 I0.000000 J-3.989749
G02 X11.570237 Y10.373333 Z-0.025000 I-2.821135 J-2.821163
G01 X11.570237 Y10.373333 Z-0.025000
G00 Z5.100000
It could just be my Inkscape is screwed in some way.

Re: Gcode for paths

Добавлено: 06 апр 2011, 21:49
Got it. To solve ReplicatorG problem see http://cnc-club.ru/forum/viewtopic.php? ... r%2A#p1957

Re: Gcode for paths

Добавлено: 06 апр 2011, 21:57
I've tried to make midi beater, only with G01.

So firstly I made a union of the paths Ctrl+"+", so it will be easier to work with them,then I added nodes with maximum space 1px. It becomes a path with 1119 nodes. Then F2, Ctrl+A (It took about 4-7 seconds), then made all segments straight. And exported to Gcode (it took 4-5 sec).

Which distance did you define when you did Add nodes? And how many nodes had the path after adding nodes?

Here's ngc file:
(39.94 КБ) 1602 скачивания
I must say that 1px is quite small distance, and path will look smooth. Here's a screenshot of remade path:

Re: Gcode for paths

Добавлено: 11 апр 2011, 19:09
Grumpy Mike
Thanks a lot for that. I have now got the system working for what I want it to do. My main problem was with the I&J absolute / relative mode and the fact that I hadn't appreciated that a G2 & G3 command does not only circular arcs but also helical arcs.

Anyway I have now written a Gcode viewer in Processing so that it is available to anyone on any platform including the Macintosh.

You can down load it from here:- http://www.thebox.myzen.co.uk/Mac_Apps/Processing.html

Re: Gcode for paths

Добавлено: 11 апр 2011, 20:40
eeemmm... how to run .pde files?

Re: Gcode for paths

Добавлено: 14 апр 2011, 16:01
Grumpy Mike
Nick писал(а):eeemmm... how to run .pde files?
You load in from the Processing language. It's free http://processing.org/
Best of all it runs on all systems, Mac, PC & linux

Now that I have it running I am having a problem with scale. In inkscape I have a rectangle 0.8" wide by 0.6" high however in the Gcode it comes out at 16.220813 by 12.179534 units. Am I missing something else?

Re: Gcode for paths

Добавлено: 14 апр 2011, 16:27
Delete all orientation points.
Open Options or Preferences tab in Gcodetools and setup units = inches. (Default units are mm)

Re: Gcode for paths

Добавлено: 14 апр 2011, 21:05
Grumpy Mike
But the rectangle is 20.32 X 15.245 mm when inkscape is set in mm and so is Gcodetools but the gcode outputs 16.220813 by 12.179534.

Re: Gcode for paths

Добавлено: 15 апр 2011, 11:33
There's one more thing.
There are two way that inkscape can calculate object sizes:
  • visual bounding box (the default one)
    it will include stroke width, filters like blur and etc. You can see that if you change stroke width or set it to none the size of the object changes.
  • actual bounding box
    Will calculate bounding box on path's node position. It equals to set stroke to none and remove all effects.
It's better to use second way to get exact sizes. You can change this setting in preferences dialog Ctrl+Shift+P -> the topmost option.

PS Attach your svg, I'll take a look.

Re: Gcode for paths

Добавлено: 14 янв 2012, 21:28
Hi, I am a novice to gcodetools and i am having trouble with the G02 amd G03 codes. I am using 1.7 gcodetools extensions, inkscape 48 and Mach3.

here is a simple elipse path followed by the mach3 screen shot of the gcode
inkscape path to gcode.jpg (12240 просмотров) <a class='original' href='./download/file.php?id=3718&sid=26e5c7b1fd1ca78bf9bcf725504e3b6e&mode=view' target=_blank>Загрузить оригинал (13.07 КБ)</a>
here we see arcs allover the place and curves that are probably straight lines
mach3 toolpath.jpg (12240 просмотров) <a class='original' href='./download/file.php?id=3719&sid=26e5c7b1fd1ca78bf9bcf725504e3b6e&mode=view' target=_blank>Загрузить оригинал (20.2 КБ)</a>
Here is the gcode file
(2.44 КБ) 1561 скачивание
minimum arc radius = 0.1
biarc intoplation tol = 1

I am really not sure what is going on or what i am doing wrong can you help :|

Re: Gcode for paths

Добавлено: 16 янв 2012, 09:05
Attach your svg please.
It looks like one of the axis is flipped.

The Gcode seems to be fine, probably there's mach misconfiguration.
Here's an illustration of the first arc:

Re: Gcode for paths

Добавлено: 16 янв 2012, 10:21
Many thanks for your reply.

here is the svg file
(33.34 КБ) 1283 скачивания
I will look at my Mach configurations.

I really appreciate your help