G2 or G3
19 Apr 2020 04:10 #164576
by sm
Hello Everyone,
I have this model on the picture.
My program generates the following gcode for it:
================
G21
G92.1
G40
G49
G91.1
G61.1
G94
G17
F0.07
G1 X2.000 Y0.000
G04 P180
G2 X2.729 Y0.913 R2.652
G04 P180
G2 X2.992 Y2.050 R2.625
G04 P180
G2 X2.700 Y3.581 R4.080
G04 P180
G2 X2.382 Y4.307 R12.646
G04 P180
G2 X2.020 Y5.012 R12.647
G04 P180
G2 X1.690 Y5.827 R7.817
G04 P180
G2 X1.453 Y6.673 R7.856
G04 P180
G2 X1.596 Y8.356 R2.846
G04 P180
G2 X2.564 Y9.460 R2.242
G04 P180
G2 X4.000 Y10.000 R4.876
G04 P180
G2 X3.731 Y8.860 R3.609
G04 P180
G2 X3.802 Y7.684 R4.573
G04 P180
G2 X4.253 Y6.288 R5.964
G04 P180
G2 X4.589 Y5.629 R10.613
G04 P180
G2 X4.970 Y4.994 R10.763
G04 P180
G2 X5.266 Y4.271 R3.201
G04 P180
G2 X5.381 Y3.499 R3.277
G04 P180
G2 X5.037 Y2.030 R2.468
G04 P180
G2 X3.723 Y0.761 R3.525
G04 P180
G2 X2.000 Y0.000 R10.482
G04 P180
G40
M30
M2
============
When I load this gcode file into linuxcnc, it shows on the its picture all path fine except arcs for three lines below:
G2 X2.729 Y0.913 R2.652
G04 P180
G2 X2.992 Y2.050 R2.625
G04 P180
G2 X2.700 Y3.581 R4.080
Those are three arcs immediately after entry straight line.
This is not a first time I see this strange thing in linuxcnc and only way to fix it in gcode I have found is to change G2 to G3:
G3 X2.729 Y0.913 R2.652
G04 P180
G3 X2.992 Y2.050 R2.625
G04 P180
G3 X2.700 Y3.581 R4.080
To my surprise it works fine and part is made as expected. But, honestly it makes no sense to me, as cutter moves in CW and G3 supposed to be CCW.
If someone, could please explain this behavior of linuxcnc to me - I would really appreciate it as I could fix my program. In this particular case it was relatively easy to fix it this manually and make linuxcnc happy, but I have some other files with hundreds lines of code and fixing this problem manually would be a nightmare.
Or maybe there is nothing wrong with gcode generated by my program and it is linuxcnc?
Thank you!
I have this model on the picture.
My program generates the following gcode for it:
================
G21
G92.1
G40
G49
G91.1
G61.1
G94
G17
F0.07
G1 X2.000 Y0.000
G04 P180
G2 X2.729 Y0.913 R2.652
G04 P180
G2 X2.992 Y2.050 R2.625
G04 P180
G2 X2.700 Y3.581 R4.080
G04 P180
G2 X2.382 Y4.307 R12.646
G04 P180
G2 X2.020 Y5.012 R12.647
G04 P180
G2 X1.690 Y5.827 R7.817
G04 P180
G2 X1.453 Y6.673 R7.856
G04 P180
G2 X1.596 Y8.356 R2.846
G04 P180
G2 X2.564 Y9.460 R2.242
G04 P180
G2 X4.000 Y10.000 R4.876
G04 P180
G2 X3.731 Y8.860 R3.609
G04 P180
G2 X3.802 Y7.684 R4.573
G04 P180
G2 X4.253 Y6.288 R5.964
G04 P180
G2 X4.589 Y5.629 R10.613
G04 P180
G2 X4.970 Y4.994 R10.763
G04 P180
G2 X5.266 Y4.271 R3.201
G04 P180
G2 X5.381 Y3.499 R3.277
G04 P180
G2 X5.037 Y2.030 R2.468
G04 P180
G2 X3.723 Y0.761 R3.525
G04 P180
G2 X2.000 Y0.000 R10.482
G04 P180
G40
M30
M2
============
When I load this gcode file into linuxcnc, it shows on the its picture all path fine except arcs for three lines below:
G2 X2.729 Y0.913 R2.652
G04 P180
G2 X2.992 Y2.050 R2.625
G04 P180
G2 X2.700 Y3.581 R4.080
Those are three arcs immediately after entry straight line.
This is not a first time I see this strange thing in linuxcnc and only way to fix it in gcode I have found is to change G2 to G3:
G3 X2.729 Y0.913 R2.652
G04 P180
G3 X2.992 Y2.050 R2.625
G04 P180
G3 X2.700 Y3.581 R4.080
To my surprise it works fine and part is made as expected. But, honestly it makes no sense to me, as cutter moves in CW and G3 supposed to be CCW.
If someone, could please explain this behavior of linuxcnc to me - I would really appreciate it as I could fix my program. In this particular case it was relatively easy to fix it this manually and make linuxcnc happy, but I have some other files with hundreds lines of code and fixing this problem manually would be a nightmare.
Or maybe there is nothing wrong with gcode generated by my program and it is linuxcnc?
Thank you!
Attachments:
Please Log in or Create an account to join the conversation.
19 Apr 2020 04:36 #164580
by cmorley
The following user(s) said Thank You: sm
Please Log in or Create an account to join the conversation.
19 Apr 2020 07:05 #164603
by sm
yes, I would think all lines should be cw (G2) and this is what has been initially written to gcode file.
and I also forgot to add that three other lines:
G2 X3.731 Y8.860 R3.609
G04 P180
G2 X3.802 Y7.684 R4.573
G04 P180
G2 X4.253 Y6.288 R5.964
have to be changed to:
G3 X3.731 Y8.860 R3.609
G04 P180
G3 X3.802 Y7.684 R4.573
G04 P180
G3 X4.253 Y6.288 R5.964
and linuxcnc was happy all the rest lines, meaning they all (the rest lines) are still G2.
It just doesn't make sense to me, because according to this code line direction of cutting should be changed.
and this is what I am reading in linuxcnc documentation:
"A circular or helical arc is specified using either G2 (clockwise arc) or G3 (counterclockwise arc) at the current feed rate. The direction (CW, CCW) is as viewed from the positive end of the axis about which the circular motion occurs."
so, as I understand it, very first arc move starts from point X2.000 Y0.000 and it goes CW - values for X and Y are increasing positively, meaning it goes towards right side, which should be considered CW.
and later (close to the top of this model as you can curves goes to top point. and here linuxcnc agrees that it would be CW and not CCW. so, why on the earth at the top points of this model (very bottom of it and very top of it), when direction of curve changes, linuxcnc thinks direction should flip?
It is not clear to me from linuxcnc documentation, what is considered to be center of rotation 0,0,0 or the the start of arc. but in any case it doesn't sound consistent to me.
because: let's take bottom of this model. if linuxcnc consider here CCW calculating it from HOME (0,0,0) - then it goes to the right, so it should be CW. and only third curve, which starts going to the left, might be considered CCW. But in this case several following curves should be also considered CCW, until the moment curve bends and starts going to the right again and ending up at the very top.
Instead linuxcnc drew me this model correctly, when I changed to CCW only first three curves and other three going from the very top. and it is happy with all the rest curves coded with G2.
I don't get it.
and I also forgot to add that three other lines:
G2 X3.731 Y8.860 R3.609
G04 P180
G2 X3.802 Y7.684 R4.573
G04 P180
G2 X4.253 Y6.288 R5.964
have to be changed to:
G3 X3.731 Y8.860 R3.609
G04 P180
G3 X3.802 Y7.684 R4.573
G04 P180
G3 X4.253 Y6.288 R5.964
and linuxcnc was happy all the rest lines, meaning they all (the rest lines) are still G2.
It just doesn't make sense to me, because according to this code line direction of cutting should be changed.
and this is what I am reading in linuxcnc documentation:
"A circular or helical arc is specified using either G2 (clockwise arc) or G3 (counterclockwise arc) at the current feed rate. The direction (CW, CCW) is as viewed from the positive end of the axis about which the circular motion occurs."
so, as I understand it, very first arc move starts from point X2.000 Y0.000 and it goes CW - values for X and Y are increasing positively, meaning it goes towards right side, which should be considered CW.
and later (close to the top of this model as you can curves goes to top point. and here linuxcnc agrees that it would be CW and not CCW. so, why on the earth at the top points of this model (very bottom of it and very top of it), when direction of curve changes, linuxcnc thinks direction should flip?
It is not clear to me from linuxcnc documentation, what is considered to be center of rotation 0,0,0 or the the start of arc. but in any case it doesn't sound consistent to me.
because: let's take bottom of this model. if linuxcnc consider here CCW calculating it from HOME (0,0,0) - then it goes to the right, so it should be CW. and only third curve, which starts going to the left, might be considered CCW. But in this case several following curves should be also considered CCW, until the moment curve bends and starts going to the right again and ending up at the very top.
Instead linuxcnc drew me this model correctly, when I changed to CCW only first three curves and other three going from the very top. and it is happy with all the rest curves coded with G2.
I don't get it.
Please Log in or Create an account to join the conversation.
- empireages
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 2
21 Apr 2020 13:19 #164961
by empireages
Replied by empireages on topic G2 or G3
It looks like your object is 2 b-splines. Perhaps this can interest you :
g5.2 g5.3
g5.2 g5.3
Please Log in or Create an account to join the conversation.
21 Apr 2020 16:45 #164979
by sm
Thank you. initially lines of this model were nurbes curves (created in Rhinoceros) , but I spent time converting them all to lines and arcs, so, gcode could be written.
G5.2/G5.3 are still experimental and I don't think I want to deal with experimental stuff. Plus, my program is already written to extract coordinates from rhino's file and write gcode for it as G1/G2/G3.
G5.2/G5.3 are still experimental and I don't think I want to deal with experimental stuff. Plus, my program is already written to extract coordinates from rhino's file and write gcode for it as G1/G2/G3.
Please Log in or Create an account to join the conversation.
21 Apr 2020 18:30 #164991
by sm
True, Chris.
but in my particular case, I think G2/G3 is what is needed.
Perhaps I am wrong and I would love to hear other opinions, so, let me explain a bit.
The reason I decided to stick with G2/G3 is because these codes are for arcs. and according to linuxcnc manual (and how I understood it) it is better for small arcs. another words, when arc is getting closer to full circle, linuxcnc cannot guarantee the precision. In my case it is ok. the machine I have built is for flat application - it cuts out elements of mosaic out of hard/brittle materials (glass, natural stone). because of this, I realized (actually number of cuts told me this), that I have to chop lines and arc into pretty small ones, to find the balance between feed rate and ability to cut certain pretty hard materials like agate.
so, arcs in my files are very small and should be perfect for G2/G3. and those are relatively easy to program - all you need is end point and radius.
but in my particular case, I think G2/G3 is what is needed.
Perhaps I am wrong and I would love to hear other opinions, so, let me explain a bit.
The reason I decided to stick with G2/G3 is because these codes are for arcs. and according to linuxcnc manual (and how I understood it) it is better for small arcs. another words, when arc is getting closer to full circle, linuxcnc cannot guarantee the precision. In my case it is ok. the machine I have built is for flat application - it cuts out elements of mosaic out of hard/brittle materials (glass, natural stone). because of this, I realized (actually number of cuts told me this), that I have to chop lines and arc into pretty small ones, to find the balance between feed rate and ability to cut certain pretty hard materials like agate.
so, arcs in my files are very small and should be perfect for G2/G3. and those are relatively easy to program - all you need is end point and radius.
Please Log in or Create an account to join the conversation.
Time to create page: 0.132 seconds