Hello Guest it is March 28, 2024, 03:27:14 PM

Author Topic: G-Code newbie - G54 always in code from Fusion?  (Read 13538 times)

0 Members and 2 Guests are viewing this topic.

G-Code newbie - G54 always in code from Fusion?
« on: March 07, 2017, 05:49:29 PM »
Just getting a grip on G-code.  I'm finding that code I generate with the Fusion 360 post processor inserts a G54 at the beginning.  So if I try run a part with a saved G55, it won't use it, uses the G54 anyway.  Am I mising something?

Can I just delete the line with the G54 from the code. any reason not to?   
Does the code need to specify an offset? 
Won't it just default to G54 if I don't manually choose a different one in Mach?

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #1 on: March 08, 2017, 08:54:47 AM »
Must say only a novice at using Fusion 360 and have only played with the lathe function and not the other Cam functions in Fusion 360.

In Fusion 360 Cam you define the SETUP which includes all of the parameters associated with how the part will be machined. It includes stock size, tool to be used, orientation of the stock, post processor to be used, etc, etc.

The post processor, which you select, posts gcode based on the SETUP in Fusion. Have a look at the generated code. There is probably a line in the beginning of the gcode file for a G28 ( return to home ).

So the G28 command ( read the G28 command definiton in the Mach manual ) sends you home. Now Mach needs to know where the part is. You must define to Mach where the part is and  G54 is the default Work offset when Mach is started. Work offsets are from home to the part.

So, starting from home to machine the part, the work offset provides the distance the part is away from home amd Mach takes that work offset into consideration. If you want to use a different work offset, maybe G55,then the Gcode file must give that instruction to Mach.

BASIC SUMMARY OF ABOVE:
YOU must define to Mach where Machine zero is, where home is, where the part is.
             AND UNDERSTAND THAT
What code is generated by the post processor should be in agreement with the way you have set up Mach / are working.

NOTE:
How you work, level of controller automation etc, etc, has an influence on what the posted gcode should provide.

RICH
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #2 on: March 08, 2017, 10:13:57 AM »
I understand that an offset is necessary to define the part location in machine coordinates.

My question is whether it would be detrimental to just delete the G54 line in the program, since Mach seems to use the G54 offset as a default anyway, if there is no offset specified in the code.  My reason is that with the G54 in the code, I can't use any other saved offset, should I want to.  

Or am I supposed to change the G54 to G5x in the code before running the program?

I am running a little cnc router for banjo making, not automated at all.

Thank your for your patience RICH.

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #3 on: March 09, 2017, 06:17:14 AM »
Change the G54 to whatever work offset you want to use in the code.

Is there a choice in Fusion 360 Setup to define or select the work offset you want to use?
I know there is not in the Lathe module and can't speak for the mill module.

RICH

Offline RICH

*
  • *
  •  7,427 7,427
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #4 on: March 09, 2017, 08:51:49 AM »
If you have no automation and want to work as simple as as possible consider the following:

Assuming there are no homing / limit switches,not using soft limits, don't want to fool around with work offsets, no tool changing, using G90 absolute mode, and in your config for DRO's
nothing is checked...........THEN

- Start Mach
- Open the work offset table via Config>Fixtures......
  and if there are any work offset values for G54 change   the values to 0.00 for X,Y,Z and save.
- With the stock in the vise, move the axes such that tool is
  located at the basis for the Gcode program. ie; say top and
  center of the stock
- Click Mach coord's button, Click the Reference All Home button
- Move the tool to some point / start position.ie; above the   stock
- Run the Gcode for the part

You should modify the posted Gcode to remove G28, G54 and any other commads which are of no value, BTW, if you have no spindle speed control then you will need to change the feed rate and Mode from G95 to G94. The only Gcode you should need is the actual code associated with the part machining.

===================================================

Comments for understanding:

Actual posted gcode is probably pre compensated for the tool
to be used. The controlled point ( end & center of the end mill)
was moved to some point on the stock which represents a reference point / basis of the gcode. Since Machine Coordinates=Work Coordinates and the controlled point is at the reference point of the gcode then DRO value of X,Y,Z=0 is the same for all three.

Just something to try and it's about as simple as you can get.

RICH

Offline Wip

*
  •  5 5
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #5 on: March 19, 2017, 08:40:51 PM »
Hi Rich,

Thank you for this post!  Brand new to using a CNC / Fusion / G-Code / Mach3...and loving it!

Everything was working great except for the fact that on every program (G Code created with Fusion 360 Generic Mach3 post process) the machine would move to the starting point without raising the bit off Z zero...resulting in a nice straight groove across the face of the stock...or, if I manually raised the Z a little and started the program from there then it wouldn't cut all the way through the stock.  Also, at the end of the program it would only raise to the Z zero height and then return to X zero and Y zero resulting in another nice straight groove across the face of the finished part.  GAAAAAH

My machine is a simple 3-axis router DIY setup WITHOUT limit/home switches and I haven't learned enough yet to use soft limits, work offsets, etc. etc.  Like you said, trying to start as simple as possible.

Taking your advice I changed the start of the program from this:
(CAM CLAMP)
(1)
(T1  D=0.25 CR=0. - ZMIN=-0.67 - FLAT END MILL)
G90 G94 G91.1 G40 G49 G17
G20
G28 G91 Z0.
G90

(2D CONTOUR1)
M5
M9
T1 M6
S10000 M3
G54
M9
G0 X2.0088 Y2.8883
G43 Z0.65 H1
Z0.25
G1 Z-0.125 F10.
X2.016 Y2.9256 F20.
etc. etc. etc.

To this instead:
G20
G90
G0 Z0.25
G0 X2.0088 Y2.8883
G1 Z-0.125 F10.
X2.016 Y2.9256 F20.
etc. etc. etc.

If I have my head wrapped around this:
G20 is important because that defines programming in inches (the units the part is designed with)
G90 is absolute reference and important for simple simple
I don't fully understand what the Z0.25 was in the original code but I 'moved' it up and put G0 in there to raise the Z first and foremost
Then it moves to starting point, Z drops in and off it goes.  ;D

The other key part was at the end...the original Fusion code has:
M9
G28 G91 Z0.
G28 X0. Y0.
M30

And I just deleted all of it...granted the machine just 'stops' at the end of program and doesn't return to home or anything but that prevents any grooves getting cut in the finished part.

Is there a G code (G30?) with maybe G0 Z1.0 to raise the bit up and then move the router back to the home starting point?

Anyway, long post but thank you again!



Re: G-Code newbie - G54 always in code from Fusion?
« Reply #6 on: March 19, 2017, 09:11:10 PM »
Hi Wip, sounds like you're in the same boat as me, and probably lots of others!  It's fun, except of course when it's maddening!

I won't try to directly answer your question, not qualified, but I will say that learning how to use soft limits and offsets is something you want to do right away.  Once I got that, things started going WAY better.

I'm thinking that's most likely your problem - you will want machine coordinate Z-0 at the top of your Z travel, and then use the Z offset to bring the cutter down to the correct position for cutting your program. 

Good luck!

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #7 on: March 20, 2017, 12:07:33 AM »
This is the answer G28 G91 Z0. as rich said read what this means, I have never had fusion drag the cutter over the part as I set home before I do anything.

Start up rules to live by start the machine and clear the estop, home the machine after this whatever goes.

Wip what you have deleted you can change it in the post to not put out a G28 but do a G54

Start code with G28 set to No in the pre post diag

(T1  D=3. CR=0. - ZMIN=-4.25 - FLAT END MILL)
N10 G90 G94 G91.1 G40 G49 G17
N15 G21

(2D CONTOUR2)
N20 M5
N25 M9
N30 T1 M6
N35 S21000 M3
N40 G54
N45 M9

end code with G28 set to no

N46520 G0 Z15.

N46530 M9
N46535 X0. Y0.
N46540 M30

Offline Wip

*
  •  5 5
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #8 on: March 20, 2017, 08:42:52 AM »
Dixedanc and Dude1...thank you for the help!

Dixedanc - "you will want machine coordinate Z-0 at the top of your Z travel, and then use the Z offset to bring the cutter down to the correct position for cutting your program.", to accomplish that would I start the machine and open up Mach3...jog the machine to say the lower left corner and raise the Z and then hit "REF ALL HOME" to zero the machine coordinates (because I don't have switches, the 'poor man's version', no automation)...then jog the machine over to position on the stock and zero out XYZ (not the machine coordinates - just 'normal'? XYZ - not sure what the term is for XYZ coordinates that aren't the machine coordinates...but understand that there is a significant difference  :))

I've tried the above in simulation (leaving the code exactly as is from Fusion - with the G28 in play) and it looks like I'd drag the cutter.  Still in simulation...if I do all of the above but then raise the cutter manually up after zeroing it on top of the part but NOT re-zeroing with the new + value before starting the run...then it appears that it moves to where it wants to start, cycles the Z and then drops in.  So the 'work around' in that case is just don't forget to manually raise the Z...

Dude1 - looking at your advice, if I understand correctly - in Fusion 360 I should set "useG28" to "No" - doing that the new code produced by Fusion looks similar to what you typed out.  

New question...doing that do I now need to actually set some numbers in the Work Offsets config / G54 fixture line?

And second new question...I don't have a vice or anything and just stick the stock down to the table wherever looks good...is G54 'absolute'? (meaning from 'job to job' when I re-zero the cutter on the stock the G54 will reference the most current zero, not whatever zero was when I saved the G54 fixture?)

I haven't tried that yet...and may answer my own question.  I don't have my head fully wrapped around G54 either...but thinking based on my "sticking the stock wherever looks good" method I probably don't want to have a G54 saved in Mach3...but will essentially manually set the G54 for the 'job' when I zero out the router on the stock.  And if I just remember to add a line with something like "G0 Z0.5" before everything else the cutter will rise up and not drag over the stock if I forget to manually raise it before starting the program.

Third new question...is there a way to get Fusion to automatically always just insert the "lift the Z before doing anything else" command? :) 

Thank you again for taking the time to reply!
« Last Edit: March 20, 2017, 09:01:57 AM by Wip »

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: G-Code newbie - G54 always in code from Fusion?
« Reply #9 on: March 20, 2017, 05:19:54 PM »
You may have the stupid bug that makes Mach3 do a ghost offset, I call it a ghost as you can't find it and putting in the cancel tool offset codes clears it, Just type G40 and G49 into the MDI and hit enter.

Setting your home (machine zero) then going and setting the work zero sets the G54, G54 is the first offset if you don't set anything in fusion it just defaults to that if you home the machine and set the work zero.

The big problem with useing G54 at the end is if something is in the way you can hit it, useing G28 the Z axis goes up out of the way, then X and Y move.

It's easy to forget to set your clearances height high enough to clear everything in fusion, the bits of code i posted above is with the clearances height set to 15 mm.

One thing your need to do is read the manual for Mach3 it has almost all you need to know in it, this sort of thing comes up quite often here or on the fusion forum, And by hell there are some dangerous twats out there who will say you are wrong when your not,
(Not meaning you Wip your still seeking info, you know when you have one off those twats they lead by saying i have been programing computers for x amount of time )

Sticking the stock anywhere is what i do it's a big machine so most of the time to home the machine it moves in meters so I turn the home switches off and home in places.

Try putting the G40 and G49 in and try again to see if it comes good