G02 & G03 codes are reversed on post.

G02 & G03 codes are reversed on post.

clarenceVH8JF
Enthusiast Enthusiast
2,551 Views
18 Replies
Message 1 of 19

G02 & G03 codes are reversed on post.

clarenceVH8JF
Enthusiast
Enthusiast

I have a older Hurco Hawk30 mill and the problem I'm having is the posted g code from fusion is good as far as I can tell but when I bring it over to the mill I have to manually go in and swap out all the G02 codes for G03 and vise versa. I'm figuring it's probably something to do with my machine so I was wondering if there is a setting in Fusion the will swap these in the G code processor? Or a setting in the machine setup that will do this? 

 

This is the code Fusion outputs

0 Likes
Accepted solutions (1)
2,552 Views
18 Replies
Replies (18)
Message 2 of 19

clarenceVH8JF
Enthusiast
Enthusiast

So after some more digging into this. Hurco's website has G02 being CW and G03 as CCW, but Fusion outputs the opposite. Does this mean different machine manufacturers use different G code? I have set the post processor to the Hurco brand for G code output but I'm still getting this probem.

0 Likes
Message 3 of 19

HughesTooling
Consultant
Consultant

Edit . Seems to be another problem with the Forum software, can't embed pictures!

 

What post are you using? All my posts output G2 clockwise, here's an example in a backplot. Don't suppose the post you're using has an option to reverse arcs on the post dialog options?

image.png

 

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 4 of 19

clarenceVH8JF
Enthusiast
Enthusiast

Yep yours is different than mine

Capture.JPG

I selected hurco as the post config. Looked through the config file and didn't see anything that would swap the arc direction.

0 Likes
Message 5 of 19

clarenceVH8JF
Enthusiast
Enthusiast

Ok so I have discovered that in the X,Y plane G02 & G03 post CW & CCW as they should but in the X,Z plane they do not and are reversed. Any idea why?

I am still kinda new to all this so it might be something I just don't understand yet.

0 Likes
Message 6 of 19

clarenceVH8JF
Enthusiast
Enthusiast

After reading this I think I understand now why its doing the switch-a-roo thing.Capture.JPG

And if I understand this correctly the problem lies with my machine interpreting the g-code in the XZ plane  instead of the ZX plane (prob cause its older than me. And I'm no spring chicken).

I guess my question is, is there a setting in Fusion somewhere that can accommodate this switch when it is processing the g-gode?

0 Likes
Message 7 of 19

HughesTooling
Consultant
Consultant

@clarenceVH8JF wrote:

After reading this I think I understand now why its doing the switch-a-roo thing.

And if I understand this correctly the problem lies with my machine interpreting the g-code in the XZ plane  instead of the ZX plane (prob cause its older than me. And I'm no spring chicken).

I guess my question is, is there a setting in Fusion somewhere that can accommodate this switch when it is processing the g-gode?


 

I tested your code in my backplotter and noticed the same, wasn't sure what's considered clockwise in the XZ plan.

 

Is the post you're using one of the generic ones or one you've downloded? if it's a generic one make a copy of it and put it in your personal posts folder, see below for the location.

Edit the post and look for the onCircular function and it should have something like below. For the ZX and YZ lines change to (clockwise ? 3 : 2) you might find there are 2 or 3 places you need to make the change depending on the post.  

image.png

 

Mark

 

Do not put custom posts in the generic posts folder. Use the personal folder, or another location. Or enable cloud posts and upload to the cloud assets posts folder.

Fusion 360 CAM Personal Posts Folder Locations

_______________________________________________________________________________

Microsoft Windows:
%appdata%\Autodesk\Fusion 360 CAM\Posts

Mac / Apple / OSX:
/Users/<user id>/Autodesk/Fusion 360 CAM/Posts

 

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 8 of 19

clarenceVH8JF
Enthusiast
Enthusiast

It's been a few days I know (maple syrup season started here).

 

So this is what I have in my post

var start = getCurrentPosition();

  if (isFullCircle()) {
    if (isHelical()) {
      linearize(tolerance);
      return;
    }
    switch (getCircularPlane()) {
    case PLANE_XY:
      if (properties.isnc) {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), irOutput.format(cx - start.x, 0), jrOutput.format(cy - start.y, 0), getFeed(feed));
      } else {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), iOutput.format(cx), jOutput.format(cy), getFeed(feed));
      }
      break;
    case PLANE_ZX:
      if (properties.isnc) {
        // right-handed
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), irOutput.format(cx - start.x, 0), krOutput.format(cz - start.z, 0), getFeed(feed));
      } else {
        // note: left hand coordinate system
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 3 : 2), iOutput.format(cx), kOutput.format(cz), getFeed(feed));
      }
      break;
    case PLANE_YZ:
      if (properties.isnc) {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), jrOutput.format(cy - start.y, 0), krOutput.format(cz - start.z, 0), getFeed(feed));
      } else {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), jOutput.format(cy), kOutput.format(cz), getFeed(feed));
      }
      break;
    default:
      linearize(tolerance);
    }
  } else {
    switch (getCircularPlane()) {
    case PLANE_XY:
      if (properties.isnc) {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), irOutput.format(cx - start.x, 0), jrOutput.format(cy - start.y, 0), getFeed(feed));
      } else {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(17), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx), jOutput.format(cy), getFeed(feed));
      }
      break;
    case PLANE_ZX:
      if (isHelical()) {
        linearize(tolerance);
        return;
      }

      if (properties.isnc) {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), irOutput.format(cx - start.x, 0), krOutput.format(cz - start.z, 0), getFeed(feed));
      } else {
        // note: left hand coordinate system
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 3 : 2), xOutput.format(x), yOutput.format(y), zOutput.format(z), iOutput.format(cx), kOutput.format(cz), getFeed(feed));
      }
      break;
    case PLANE_YZ:
      if (isHelical()) {
        linearize(tolerance);
        return;
      }

      if (properties.isnc) {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), jrOutput.format(cy - start.y, 0), krOutput.format(cz - start.z, 0), getFeed(feed));
      } else {
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(19), gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), zOutput.format(z), jOutput.format(cy), kOutput.format(cz), getFeed(feed));
      }
      break;
    default:
      if (properties.allow3DArcs) {
        // make sure maximumCircularSweep is well below 360deg
        // we could use G2.4 or G3.4 - direction is calculated
        var ip = getPositionU(0.5);
        writeBlock(gAbsIncModal.format(90), gMotionModal.format(clockwise ? 2.4 : 3.4), xOutput.format(ip.x), yOutput.format(ip.y), zOutput.format(ip.z));
        writeBlock(xOutput.format(x), yOutput.format(y), zOutput.format(z), getFeed(feed));
      } else {
        linearize(tolerance);
      }
    }
  }
}

 

As they already say clockwise should I be changing then to counter-clockwise?

0 Likes
Message 9 of 19

clarenceVH8JF
Enthusiast
Enthusiast

So in this part here I'm assuming that if I switch around "(cx - start.x, 0), krOutput.format(cz - start.z, 0), getFeed(feed))" with "(cx), kOutput.format(cz), getFeed(feed))" then the post will start from the last position and draw the ark starting with the opposite plane it was before?

case PLANE_ZX:
      if (properties.isnc) {
        // right-handed
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 2 : 3), irOutput.format(cx - start.x, 0), krOutput.format(cz - start.z, 0), getFeed(feed));
      } else {
        // note: left hand coordinate system
        writeBlock(gAbsIncModal.format(90), gPlaneModal.format(18), gMotionModal.format(clockwise ? 3 : 2), iOutput.format(cx), kOutput.format(cz), getFeed(feed));
      }
      break;

 

0 Likes
Message 10 of 19

HughesTooling
Consultant
Consultant
Accepted solution

Before you change anything, on the post dialog have you tried setting Use ISNC or BNC mode to Basic NC Mode? From your screenshot it looks like the post is setup for for Right hand or Left hand. Note the left hand has the 2 - 3 reversed in the clockwise check.

 (clockwise ? 3 : 2)

image.png

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 11 of 19

clarenceVH8JF
Enthusiast
Enthusiast

I have not tried changing that setting.

My mill has both those options as well and I have them both mill and fusion set to ISO.

I'll give it a try tomorrow.

0 Likes
Message 12 of 19

clarenceVH8JF
Enthusiast
Enthusiast

Yes Siry, It worked!

Apparently Basic is different than ISO when it comes to the G02 & G03 comands.

Thanks so much Hughes.

Message 13 of 19

msinghSPP37
Explorer
Explorer

Hey Mark,

 

I am just wondering how you find this setting for ISO NC and Basic NC.

 

I don't have that option in my window? 

 

See attached. 

 

Thank you so much! 

 

My machine is a Masterwood 316K 

 

I am using the Masterwood post processor. 

 

I have attached it for extra information.

 

Thank you again. 

Screenshot 2023-08-25 at 12.23.18 pm.png

0 Likes
Message 14 of 19

HughesTooling
Consultant
Consultant

@msinghSPP37 That setting was only for the Hurco post and not a general setting on other post.

 

What problem do you have? The problem in this thread was specific to the way the Hurco control works with arcs that are not on the XY plane.

 

Are you seeing the problem with only arcs? Pretty unusual to have this problem on a mill\router.

 

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes
Message 15 of 19

msinghSPP37
Explorer
Explorer

Hi Mark,

 

Thank you for getting back to me so quickly. 

 

My CNC router is a Masterwood 316K with a CN10 controller. 

 

The post processor I am using in Fusion is the only Masterwood controller I can find which was and still is in Beta. It does not output the correct G code.

 

The current issues I am facing are:

1. The output G03 and G02s are the wrong way around. I go through and manually to change these.

2. The output doesn't have I and J in each line. The 316K gets an error if there is no value in each line even if its referenced in the previous line.

3. I have to delete any codes apart G72 and G01, G02, G03 because its not relevant to the 316K.

 

This post has opened up a bit of a rabbit hole for me as I am now trying to learn how to mod/build a post processor for the 316K... I see there's been quite a few people asking for one with no success. 

 

Thank you so much for your time,

 

Below is an example of a working code:

 

1 CV150 LC

2 242000 121500 3000

3 1

4 0

5 1

6 0

%

 

@p1=6

@Anonymous=6

 

G72 X148.81 Y101.515 Z=P2 S18 E1 T26

G02 X148.81 Y101.515 I150. J150.

G01 Y91.515

G02 X148.81 Y91.515 I150. J150.

G01 Y81.515

G02 X148.81 Y81.515 I150. J150.

G01 Y71.515

G02 X148.81 Y71.515 I150. J150.

G01 Y61.515

G02 X148.81 Y61.515 I150. J150.

G01 Y56.0191

G02 X148.107 Y56.0191 I150. J150.

.

 

 

 

 

 

0 Likes
Message 16 of 19

HughesTooling
Consultant
Consultant

@msinghSPP37 Would you mind starting a new thread in the manufacture forum as your problem is different to this thread. Be easier for others to find if you mention your machine and controller in the title as well.

 

Thanks Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Message 17 of 19

msinghSPP37
Explorer
Explorer
Hi Mark, yes I will do this now. Thank you.
0 Likes
Message 18 of 19

steveHDPJT
Advocate
Advocate

What software are you using there to visualize the toolpath of the posted code @HughesTooling ?

0 Likes
Message 19 of 19

HughesTooling
Consultant
Consultant

@steveHDPJT wrote:

What software are you using there to visualize the toolpath of the posted code @HughesTooling ?


I use NC-Corrector.

 

Mark

Mark Hughes
Owner, Hughes Tooling
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


0 Likes