Gcode import

cnc-club.ru for English speaking users

Gcode import

Сообщение ChrisInNewbury » 07 июн 2011, 03:45

Would people think it useful to be able to import Gcode from a file in order to view and, perhaps, edit the toolpath?
I believe there exist Gcode viewers, but don't know of any free ones.
If there's sufficient interest I might try to do it.
If you are interested, please reply to this topic, and give some thoughts on features you'd like to see.
My thoughts/questions are:
- How to show a 3D toolpath in a 2D drawing program?
Perhaps show three projections - XY, XZ and YZ, or isometric, or use the Orientation points to control this?
Perhaps show only a slice for a particular Z value or range?
- How sophisticated do we want to be?
Support for parametric code?
expressions? (e.g. G01 X#3 Y[#2+4])
merely able to read back files created by Gcodetools?

No promises, but I'd like to do a simple version for myself anyway.
Chris
ChrisInNewbury
Новичок
 
Сообщения: 20
Зарегистрирован: 19 апр 2011, 02:32
Откуда: Newbury, Berkshire, England
Репутация: 0
Медальки:

Re: Gcode import

Сообщение ChrisInNewbury » 08 июн 2011, 02:56

I have just written a 3D viewer - it generates left and right eye views of the toolpath. If you look at them with your eyes crossed, or diverging if you prefer, you can see the two images as a 3D picture. For engraving, you can see quite clearly how the engraved object will look.
This can be used both to view the engraving function's output and to display any existing gcode file, as it can import gcode. The functionality is working but the user interface isn't yet ready for the world. The display of gcode isn't easy to see in 3D, unless your gcode engraves something very complex, as it just has the tooltip. The display of engraving is much better as it shows the path of the side of the tool along the engraved groove.

If anyone wants to see a sample image (750kb svg file), please email me.
Chris
ChrisInNewbury
Новичок
 
Сообщения: 20
Зарегистрирован: 19 апр 2011, 02:32
Откуда: Newbury, Berkshire, England
Репутация: 0
Медальки:

Re: Gcode import

Сообщение Nick » 08 июн 2011, 05:00

Hi there !

Sorry for the late answer, I'm on vacation and traveling somewhere in France :cheesy:!


So before you spend to much time try nc-corrector it's free and written for windows:
http://www.nc-corrector.inf.ua/index_EN.htm

Or try EMC2 it has it's own built into GUI Gcode preview.

------------------------------
To do isometric view we can apply transform to ordinal paths.

Take a look at Gcodetools -> Tools library (just check tools).
Use the Console, Luke.
Аватара пользователя
Nick
Мастер
 
Сообщения: 22330
Зарегистрирован: 23 ноя 2009, 16:45
Откуда: Gatchina, Saint-Petersburg distr., Russia
Репутация: 1332
Заслуга: Developer
Медальки:

Re: Gcode import

Сообщение ChrisInNewbury » 08 июн 2011, 13:23

Hi Nick,
I hope you're enjoying la belle France.
My initial goal was to import gcode so as to view it and, perhaps, edit the shape before re-exporting. While thinking about how best to display gcode of engravings, I thought of using 3D stereo pairs.
Thank you for pointing me to NC Corrector. It is very good but shows only the tooltip, not the solid you get after machining. With engraving, that is hard to visualise. So I have created a 3D stereo pair of images in Gcodetools' engraving module. See the attached file. View it at a size so that the two images are nearly as far apart as your eyes, then look into the distance so that you see the left image with your left eye, right with your right eye. They should appear 3D. (Some people prefer crossed-eye images, I prefer uncrossed.)

Each line is the left edge of the V shaped tool as it moves along the path. Its right edge is also cutting the opposite side at the same time. The white spaces are possibly misleading - the tool actually follows the bottom of the V, not the edge of the path, near reflex corners, and it goes right in to sharp corners. I colour the edges to suggest light from top left.
With a shape such as this with two holes in it, there are three toolpaths cut - each path edge is 'hugged' by the tool's left edge, but the bottom of the V should be sharp as the two opposite cuts coincide, in theory. The tool's edge (as it appears in 3D) should always be at right angles to the path. For a normal V shaped cutter, the tool's depth is equal to the length of the line and should never exceed the path's radius on a bend.

I haven't uploaded this version of Gcodetools, but the engraving algorithm is almost the same as the one I uploaded last week. I have fixed one minor bug - rounding errors could cause an error on certain almost horizontal paths.

Chris
Вложения
Gcode import g94368.png
Stereo pair of engraved letter 'a'
ChrisInNewbury
Новичок
 
Сообщения: 20
Зарегистрирован: 19 апр 2011, 02:32
Откуда: Newbury, Berkshire, England
Репутация: 0
Медальки:

Re: Gcode import

Сообщение Nick » 09 июн 2011, 21:34

Hi Chris!

Wow! I have no words to describe it! Just Wow :)!
I'm familiar with this kind 3d technic but I've not ever seen how it's made! This is really awesome!

But I have a problem with crossing the eyes, and only managed to get the 3d picture on smaller images. May be it'll be better to place the letters closer. No meter will they intersect or not.

PS Fell free to upload such thing to the main stream :).
PSS This if really awesome idea!!! I'm shocked :cheesy:!
Use the Console, Luke.
Аватара пользователя
Nick
Мастер
 
Сообщения: 22330
Зарегистрирован: 23 ноя 2009, 16:45
Откуда: Gatchina, Saint-Petersburg distr., Russia
Репутация: 1332
Заслуга: Developer
Медальки:

Re: Gcode import

Сообщение ChrisInNewbury » 10 июн 2011, 03:58

Hi Nick,
Thanks. I'm glad you're happy with my ideas. I'm sure you'll agree this 3D view tells you a lot more than a toolpath image in NC Corrector.
I will upload it tomorrow. Have you tried my last upload? The engraving function is practically the same as you can see in the 3D images, but it just doesn't display in 3D. I hope it is clear that the quality of the engraving is very good even with very few nodes.
I have tested it with Milo and Nicolas. They seem good, but I note that there is a tiny path between the a and s of Nicholas - almost invisible - but it confuses the algorithm. It would be better to separate the letters.
By the way, I have corrected the spelling of 'definition' saved with the tool, as in 'tool definition' but I still recognise tools in an svg file that was created with 1.6.04, so my code matches 'tool definition' or 'tool defention'.
I save the 3D images in a layer I create called 3D, so it is possible to view them on their own.
I should ask the user if they prefer crossed eye or uncrossed 3D, but I have so far not changed the inx file at all. Anyway, the left and right eye images are separate groups so you can swap them or change separation easily, depending on the size of the object.
Personally, I prefer the 3D images, but I still generate the circles.
Best wishes
Chris
ChrisInNewbury
Новичок
 
Сообщения: 20
Зарегистрирован: 19 апр 2011, 02:32
Откуда: Newbury, Berkshire, England
Репутация: 0
Медальки:

Re: Gcode import

Сообщение Nick » 12 июн 2011, 00:23

Yea it will be good to left user choose what way he prefers crossed eyes or not.

Do you know how raster images with same effect are made?
Use the Console, Luke.
Аватара пользователя
Nick
Мастер
 
Сообщения: 22330
Зарегистрирован: 23 ноя 2009, 16:45
Откуда: Gatchina, Saint-Petersburg distr., Russia
Репутация: 1332
Заслуга: Developer
Медальки:

Re: Gcode import

Сообщение ChrisInNewbury » 12 июн 2011, 16:17

The general principle is that what you want the left eye to see is moved a little to the right if it has positive Z (out of the page) and vice versa. The maths is very simple: Xleft=X0+k.Z, Xright=X0-k.Z
I experimented with different k values and currently use k=0.12, but users might like to be able to change this.
For magic eye raster pictures (SIRDS), you typically have a repeated, perhaps pseudo-random, pattern. Each dot serves two purposes - it is the left eye's dot for one X and the right eye's dot for a different X. So the distance from one instance of a particular dot of the pattern to the next is some constant (for Z=0) plus or minus k.Z where Z is the Z value for the point in the image for which these two dots are the left and right eyes' dots. You use plus or minus to generate images seen in cross-eyed or uncrossed (wide- eyed?) mode. If you use the wrong viewing mode you just see Z reversed.
I guess we could try to generate SIRDS for viewing of 3D machining, but you'd need to create a complete 3D raster. I don't think it would have any great advantage over my current vector-based method.
By the way, I'm going to add the outline to my 3D images to make them clearer.

Chris
ChrisInNewbury
Новичок
 
Сообщения: 20
Зарегистрирован: 19 апр 2011, 02:32
Откуда: Newbury, Berkshire, England
Репутация: 0
Медальки:


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

Кто сейчас на конференции

Зарегистрированные пользователи: aftaev, Alex lamaka, Alex_C, alexx.bit, Anatolie, Bing [Bot], dima7411, error101, Finam, gendos, Google [Bot], Google Feedfetcher, grek, Igor26rus, jb_arch, krab13, Lebede, leprud, MGG, Montis, niksooon, Nixon, NKS, odekolon, selenur, sima8520, sivolap36, sorter, SovietTwins, timo13, tooshka, tronhejm, ukr-sasha, vektor_z, Yahoo [Bot], Yandex [bot], Владимир_36

Поделиться

cron
Reputation System ©'