Gcode for paths

cnc-club.ru for English speaking users
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Gcode for paths

Сообщение Grumpy Mike »

Hi,
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?
Thanks
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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.
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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?
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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.
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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 ....
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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.
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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.
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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 :).
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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.
Thanks.
Вложения
Midi Beater engraving.svg
(12.38 КБ) 1475 скачиваний
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

Got it. To solve ReplicatorG problem see http://cnc-club.ru/forum/viewtopic.php? ... r%2A#p1957
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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:
output.ngc
(39.94 КБ) 1752 скачивания
I must say that 1px is quite small distance, and path will look smooth. Here's a screenshot of remade path:
Вложения
Inkscape add nodes.png (15792 просмотра) <a class='original' href='./download/file.php?id=1383&sid=3243e187c4e852886c59245956d3214b&mode=view' target=_blank>Загрузить оригинал (170.86 КБ)</a>
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

eeemmm... how to run .pde files?
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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?
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

Delete all orientation points.
Open Options or Preferences tab in Gcodetools and setup units = inches. (Default units are mm)
Grumpy Mike
Новичок
Сообщения: 8
Зарегистрирован: 06 апр 2011, 14:47
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение 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.
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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.
CraftCadet
Новичок
Сообщения: 5
Зарегистрирован: 04 янв 2012, 23:34
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение CraftCadet »

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 (15283 просмотра) <a class='original' href='./download/file.php?id=3718&sid=3243e187c4e852886c59245956d3214b&mode=view' target=_blank>Загрузить оригинал (13.07 КБ)</a>
here we see arcs allover the place and curves that are probably straight lines
mach3 toolpath.jpg (15283 просмотра) <a class='original' href='./download/file.php?id=3719&sid=3243e187c4e852886c59245956d3214b&mode=view' target=_blank>Загрузить оригинал (20.2 КБ)</a>
Here is the gcode file
output_0023.ngc
(2.44 КБ) 1721 скачивание
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 :|
Аватара пользователя
Nick
Мастер
Сообщения: 22776
Зарегистрирован: 23 ноя 2009, 16:45
Репутация: 1735
Заслуга: Developer
Откуда: Gatchina, Saint-Petersburg distr., Russia
Контактная информация:

Re: Gcode for paths

Сообщение Nick »

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:
Вложения
G2 gcode.png (15271 просмотр) <a class='original' href='./download/file.php?id=3735&sid=3243e187c4e852886c59245956d3214b&mode=view' target=_blank>Загрузить оригинал (61.93 КБ)</a>
CraftCadet
Новичок
Сообщения: 5
Зарегистрирован: 04 янв 2012, 23:34
Репутация: 0
Контактная информация:

Re: Gcode for paths

Сообщение CraftCadet »

Many thanks for your reply.

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

I really appreciate your help
Ответить

Вернуться в «English forum»