Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Haas Error Code 304 help


Aaron Clements
 Share

Recommended Posts

Hey evryone! Newish to the programming world but ive ran many machines in the past; setup, touchoff, toolchange, etc. Currently was thrown into a position where I have to edit programs basically by myself. Current program threw a error code 304. im stummped on what to do. below is the code. It starts on N83 and throws the code at N108. Any help would be greatly appreciated:

N83 X3.9013 Y.2715 S2800 M3
N84 G1 Z-.475 F42.
N85 G41 D3 X3.8388 Y.1633
N86 G3 X3.8305 Y.132 I.0541 J-.0313
N87 G1 Y.0852
N88 G3 X3.8564 Y.073 I.026 J.0215
N89 G1 X4.0941
N90 X7.1063
N91 G2 X7.2495 Y.0137 I0. J-.2025
N92 G1 X7.3045 Y-.0414
N93 G2 X7.3638 Y-.1846 I-.1432 J-.1432
N94 G1 Y-.4454
N95 G2 X7.3045 Y-.5885 I-.2025 J0.
N96 G1 X7.2495 Y-.6436
N97 G2 X7.1063 Y-.7029 I-.1432 J.1432
N98 G1 X4.0941
N99 X3.8721
N100 G3 X3.8391 Y-.7298 I0. J-.0337
N101 G1 Y-.8013
N102 G3 X3.8471 Y-.8313 I.06 J0
N103 G40 G1 X3.9071 Y-.9352
N104 G0 Z.1
N105 X3.8863 Y.2715 
N106 G1 Z-.488 F42.
N107 G41 D3 X3.8288 Y.1633
N108 G3 X3.8155 Y.132 I.0541 J-.0313

 

Link to comment
Share on other sites

It looks like on the N108 line you have a bad number. 

If you don't have a good understanding how the G2 / G3 code works I'd recommend looking into that. If I tried to explain it it would just sound like gibberish. 

Regardless, if you do out the math (or use a CAD software) the N108 line will not compute out correctly. Basically you are asking the machine to make an impossible move. I can try to give a better explanation if you want but that's the gist of your issue.

Link to comment
Share on other sites

Try reducing the entry/exit arc clearance. Using proper size mill or threadmill meaning to have good enough clearance for E.mill to lead in out and reducing entry/exit arc solved my problem and also having large negative wear is the problem too depending on the size of the e.m and finish geom. Good luck!

Link to comment
Share on other sites
16 minutes ago, Jake L said:

It looks like on the N108 line you have a bad number. 

If you don't have a good understanding how the G2 / G3 code works I'd recommend looking into that. If I tried to explain it it would just sound like gibberish. 

Regardless, if you do out the math (or use a CAD software) the N108 line will not compute out correctly. Basically you are asking the machine to make an impossible move. I can try to give a better explanation if you want but that's the gist of your issue.

Could you please try and explain it. I would appreciate any help i can get

Link to comment
Share on other sites

See here

https://www.haascnc.com/service/alarm-search.alarm=ngc_304-0000.html

From above link:

Alarm Search Results: 304 INVALID I, J, OR K IN G02 OR G03

The center point of the arc is incorrectly defined. Possible causes are: 1) Incorrectly defined I, J, or K values. The I, J, and K values define the distance and direction in X, Y, and Z from the start point of an arc to the center. Make sure that the values are signed correctly (+/-). 2) Incorrect plane selection. Make sure that the active plane is correct. Only the I, J, or K values specific to the selected plane are allowed (G17 uses I/J, G18 uses I/K, and G19 uses J/K). 3) Incorrectly defined arc end points. Make sure that the end points for the start and end of the arc are programmed correctly. In this example, point 1 is the start point and point 2 is the end point of the arc. The J-value is negative (-) because the distance along the Y Axis from the start point to center is negative. The I-value is positive (+) because the distance along the X Axis from the start point to center is positive.

 

  • Like 1
Link to comment
Share on other sites

To add to what Jake said,

There is not enough room for the arc move to complete.

N85 and N107 are the same values but the following G3 lines have different X values so the math

does not work out to complete the arc 2nd time around.

@ N107 add .015 to the x value (difference in X values in following G3 lines) 

Edited by AHarrison1
Corrected value
  • Like 1
Link to comment
Share on other sites
32 minutes ago, Jake L said:

It looks like on the N108 line you have a bad number. 

If you don't have a good understanding how the G2 / G3 code works I'd recommend looking into that. If I tried to explain it it would just sound like gibberish. 

Regardless, if you do out the math (or use a CAD software) the N108 line will not compute out correctly. Basically you are asking the machine to make an impossible move. I can try to give a better explanation if you want but that's the gist of your issue.

Will learn more how the G2/G3 code works. I wouldn't mind reading what you have to say though. I am currently using Mastercam CodeExpert. Any more explanations Ill gladly read and figure out!

Link to comment
Share on other sites
8 minutes ago, AHarrison1 said:

To add to what Jake said,

There is not enough room for the arc move to complete.

N85 and N107 are the same values but the following G3 lines have different X values so the math

does not work out to complete the arc 2nd time around.

@ N107 add .01 to the x value (difference in X values in following G3 lines) 

I think I see what youre saying, Just changed the X3.8288 to X3.8288 in N107, didnt work. will now try changing the x in N108 and see what that does

Link to comment
Share on other sites
4 minutes ago, Aaron Clements said:

I think I see what youre saying, Just changed the X3.8288 to X3.8288 in N107, didnt work. will now try changing the x in N108 and see what that does

The X difference in N86 and N108 is .015, this should be the same difference in N85 and N107.

Try change N107 to x 3.8238

Link to comment
Share on other sites

I have to ask...

If you are using Mastercam Code Expert, do you not have access to the Mastercam Program, so you can just "program the path" using the software, and then output the NC Code using the Post Processor function?

Mastercam makes outputting the code, super easy, so you don't have to figure this out on your own.

I noticed you are also using Cutter Compensation. Is it possible that you are programming using "Wear" compensation in the Toolpath, but then performing Tool Probing on the machine, and you're measuring "the diameter"?

With Mastercam, you can control the Lead In Lines, and the Lead In Arcs (size and "sweep angle") to configure the Lead In/Out to your personal preferences.

But once you learn how to output proper entry/exit in Mastercam, you would never have to hand-edit the G-code...

Link to comment
Share on other sites

Also, kudos to you for jumping in and trying to solve the problem. You're making a great effort, and I applaud you for it. But that said, it sounds like you need some basic CNC Training. Fortunately, you've come to the right place on the internet to get help for both Mastercam and Haas machines. (I happen to work for the Haas HFO for the Federal Govt.)

https://www.haascnc.com/myhaas/Haas_Learning_Resources.html

Download a copy of the Mill Operator's Manual - Programming Guide:

 https://www.haascnc.com/content/dam/haascnc/en/service/manual/operator/english---mill-ngc---operator's-manual---2020.pdf

Also, a copy of the Mill - Programming Workbook, is very handy:

https://www.haascnc.com/content/dam/haascnc/en/service/reference/programming-workbooks/mill---programming-workbook.pdf

And, if you get stuck on the answers, there is an Answer Book:

https://www.haascnc.com/content/dam/haascnc/en/service/reference/programming-workbooks/mill---programming-workbook---answers-book.pdf

And finally, here is a link to sign up for the online "Haas Operator Certification" course, if you're interested...

https://learn.haascnc.com/

  • Thanks 3
  • Like 3
Link to comment
Share on other sites

Alright here goes my explanation:

When a G2 / G3 code is called there are a handful of values the machine cares about.

1. The start point, or the x, y values the machine is currently at before starting the G2 / G3 line of code

2. The end point, or the x, y values on the G2 / G3 line 

3. The center point of the arc, or the i and j values on the G2 / G3 line. This is a little more complicated because the i and j values are offset values. For example if you start at x = 1.0 y = 1.0 and i = 0  j = -1.0 then the center point would be (x + i , y + j). In this example that means your center point would be (1.0 + 0 , 1.0 + (-1.0)) or (1.0 , 0).

4. Finally the arc radius can be calculated from the #1 start point and #3 center point. In the example above the radius of the arc would be 1.0

 

For a G2 / G3 line to execute, the #2 endpoint must lie on the #4 radius. 

If we use the example above, the code would look something like this:

N100 G01 X1.0 Y1.0

N101 G02 X2.0 Y0.0 I0.0 J-1.0

This code would execute properly because the point X = 2.0 Y = 0.0 does fall on the defined radius (a rad with radius = 1.0 and center point at (1.0 , 0)).

 

Now if we alter the code a bit:

N100 G01 X1.0 Y1.0

N101 G02 X3.0 Y0.0 I0.0 J-1.0

With the new endpoint x value being x = 3.0, the end point is no longer on the defined radius.

This is what is causing your machine to alarm out. The machine does the necessary computations (finding the #3 center point and #4 radius) and then tries to go to the #2 endpoint and realizes the endpoint does not fall on the defined radius.

  • Thanks 2
  • Like 4
Link to comment
Share on other sites
On 6/22/2023 at 3:17 PM, AHarrison1 said:

The X difference in N86 and N108 is .015, this should be the same difference in N85 and N107.

Try change N107 to x 3.8238

 

On 6/22/2023 at 3:17 PM, AHarrison1 said:

The X difference in N86 and N108 is .015, this should be the same difference in N85 and N107.

Try change N107 to x 3.8238

N76 M01 (T3- 3/8 EM./D21)
N77 G0 G90 X7.301 Y-.315 S2700 M3
N78 G43 H3 Z.1 M8
N79 G1 Z-.271 F42.
N80 X4.4995
N81 Y-.5062
N82 Y0.
N83 X3.9013 Y.2715 S2800 M3
N84 G1 Z-.475 F42.
N85 G41 D3 X3.8388 Y.1633
N86 G3 X3.8305 Y.132 I.0541 J-.0313
N87 G1 Y.0852
N88 G3 X3.8564 Y.073 I.026 J.0215
N89 G1 X4.0941
N90 X7.1063
N91 G2 X7.2495 Y.0137 I0. J-.2025
N92 G1 X7.3045 Y-.0414
N93 G2 X7.3638 Y-.1846 I-.1432 J-.1432
N94 G1 Y-.4454
N95 G2 X7.3045 Y-.5885 I-.2025 J0.
N96 G1 X7.2495 Y-.6436
N97 G2 X7.1063 Y-.7029 I-.1432 J.1432
N98 G1 X4.0941
N99 X3.8721
N100 G3 X3.8391 Y-.7298 I0. J-.0337
N101 G1 Y-.8013
N102 G3 X3.8471 Y-.8313 I.06 J0
N103 G40 G1 X3.9071 Y-.9352
N104 G0 Z.1
N105 X3.8863 Y.2715 
N106 G1 Z-.488 F42.
N107 G41 D3 X3.8238 Y.1633
N108 G3 X3.8155 Y.132 I.0541 J-.0313
N109 G1 Y.0852
N110 G3 X3.8564 Y.058 I.041 J.0215
N111 G1 X4.0941
N112 X7.1063
N113 G2 X7.2389 Y.0031 I0. J-.1875
N114 G1 X7.2939 Y-.052
N115 G2 X7.3488 Y-.1846 I-.1326 J-.1326
N116 G1 Y-.4454
N117 G2 X7.2939 Y-.5779 I-.1875 J0.
N118 G1 X7.2389 Y-.633
N119 G2 X7.1063 Y-.6879 I-.1326 J.1326
N120 G1 X4.0941
N121 X3.8721
N122 G3 X3.8241 Y-.7283 I0. J-.0487
N123 G1 Y-.8013
N124 G3 X3.8321 Y-.8313 I.06 J0
N125 G40 G1 X3.8921 Y-.9352
N126 G0 Z.1
N127 X3.9226 Y.1288
N128 G1 Z-.27 F32.
N129 G41 D3 X4.0308 Y.0663
N130 G3 X4.0621 Y.0579 I.0313 J.0541
N131 G2 Y-.6879 I0 J-.3729
N132 G3 X4.0321 Y-.6959 I0 J-.06
N133 G1 G40 X3.9292 Y-.7559
N134 G0 Z1. M9
N135 G91 G28 Z0 M5
N136 T4 M06
N137 M01 (T4- #29 DRILL)
N138 G0 G90 X4.8819 Y-.315 S2500 M3
N139 G43 H4 Z-.2 M8
N140 G99 G81 Z-.35 R-.2 F22.
N141 X6.063
N142 G80 M9
N143 G91 G28 Z0 M5

 

This is what im working with. Originally designed for a Leadwell vertical cnc mill, i have to transfer it over to a Haas VF4. theres slight differences that ive changed but n108 worked only to stop at 110. Same code. Ill be watching and learning as much as i can but any guidance would help!

Link to comment
Share on other sites

Try this:

Take the original program, and run it "as-is".

But, before you run the code, go to your Tool Diameter Offset (for T21, this would be "D21"), and set it to "0.0".

Does it work with "No Diameter Offset" present?

IF YES, then you've likely got a program which is setup to run "Wear Compensation", not "full diameter compensation".

 

Link to comment
Share on other sites

Here is how I fixed this.

I went into Mastercam, and I plotted all of the points for both passes. I do this so I can draw lines and arcs, and "try to get an idea of what you're doing".

There were some issues in how the 0.015" offset Finish Pass was created, that for some reason worked on the Leadwell, but fails on the Haas in Grapics.

So, once I figured out that this pass was deeper, and was offset 0.015", I was able to construct geometry, and do things like "trim to the correct intersection points".

No warranty for this code is expressed, or implied, so USE AT YOUR OWN RISK!!!!

But, that said, I was able to get this modified code to successfully run in Graphics mode on my Haas NGC Simulator.

I included my Mastercam File, to show you how I laid out the points. the Green geometry (in general) is the 2nd pass, and the blue geometry is the first pass I plotted.

%
O04445
G00 G90 G40 G80
N76 M01 (T3- 3/8 EM./D21, FIXED 2ND PASS)
T3 M06 
N77 G0 G90 X7.301 Y-.315 S2700 M3
N78 G43 H3 Z.1 M8
N79 G1 Z-.271 F42.
N80 X4.4995
N81 Y-.5062
N82 Y0.
N83 X3.9013 Y.2715 S2800 M3
N84 G1 Z-.475 F42.
N85 G41 D3 X3.8388 Y.1633
N86 G3 X3.8305 Y.132 I.0541 J-.0313
N87 G1 Y.0852
N88 G3 X3.8564 Y.073 I.026 J.0215
N89 G1 X4.0941
N90 X7.1063
N91 G2 X7.2495 Y.0137 I0. J-.2025
N92 G1 X7.3045 Y-.0414
N93 G2 X7.3638 Y-.1846 I-.1432 J-.1432
N94 G1 Y-.4454
N95 G2 X7.3045 Y-.5885 I-.2025 J0.
N96 G1 X7.2495 Y-.6436
N97 G2 X7.1063 Y-.7029 I-.1432 J.1432
N98 G1 X4.0941
N99 X3.8721
N100 G3 X3.8391 Y-.7298 I0. J-.0337
N101 G1 Y-.8013
N102 G3 X3.8471 Y-.8313 I.06 J0
N103 G40 G1 X3.9071 Y-.9352
N104 G0 Z.1
N105 X3.8876 Y.2777 
N106 G1 Z-.488 F42.
N107 G41 D3 X3.8258 Y.1708
N108 G3 X3.8155 Y.132 I.0671 J-.0388
N109 G1 Y.0803
N110 G3 X3.8564 Y.058 I.041 J.0264
N111 G1 X4.0941
N112 X7.1063
N113 G2 X7.2389 Y.0031 I0. J-.1875
N114 G1 X7.2939 Y-.052
N115 G2 X7.3488 Y-.1846 I-.1326 J-.1326
N116 G1 Y-.4454
N117 G2 X7.2939 Y-.5779 I-.1875 J0.
N118 G1 X7.2389 Y-.633
N119 G2 X7.1063 Y-.6879 I-.1326 J.1326
N120 G1 X4.0941
N121 X3.8721
N122 G3 X3.8241 Y-.7284 I0. J-.0487
N123 G1 Y-.8013
N124 G3 X3.8341 Y-.8388 I.075 J0.
N125 G40 G1 X3.8941 Y-.9427
N126 G0 Z.1
N127 X3.9226 Y.1288
N128 G1 Z-.27 F32.
N129 G41 D3 X4.0308 Y.0663
N130 G3 X4.0621 Y.0579 I.0313 J.0541
N131 G2 Y-.6879 I0 J-.3729
N132 G3 X4.0321 Y-.6959 I0 J-.06
N133 G1 G40 X3.9292 Y-.7559
N134 G0 Z1. M9
N135 G91 G28 Z0 M5
M30
%

test nc code arc issue.mcam O4445.nc

Comparison between original and fixed file.PNG

  • Like 1
Link to comment
Share on other sites

Hopefully, if you look at my Mastercam File, you can see how I constructed the geometry, and was able to make some assumptions about how the path was originally constructed, so I could fix the issues. There were IJ Center point errors, yes, but also the XY positioning "start points", and even the "entry/exit" lines (point before the Arc Start Point or after the final endpoint (G40) needed to be adjusted, to maintain parallelism and proper tangency.

One thing that makes this very difficult, are the changes needed in not only the I-J values (describing the Arc Center, relative to the START POINT), but also the shifting of the "start/end" XY coordinates, due to offsetting an arc that is a "partial arc", where the entry line is not tangent to the arc start point. In this case, you've got to offset, and retrim at the intersections.

Link to comment
Share on other sites

I also have a Classic Haas Control Hardware Simulator, running Version 18 Software (Maincon board configuration).

Our Federal Phone Support Haas Guru has multiple sets of hardware boards, from the old Motorola processors, through the cold-fire series, up to the last CHC versions. He can swap out components to configure the Haas to diagnose most CHC issues over the phone for our Federal Customers.

Link to comment
Share on other sites
On 6/26/2023 at 12:35 PM, Colin Gilchrist said:

Here is how I fixed this.

I went into Mastercam, and I plotted all of the points for both passes. I do this so I can draw lines and arcs, and "try to get an idea of what you're doing".

There were some issues in how the 0.015" offset Finish Pass was created, that for some reason worked on the Leadwell, but fails on the Haas in Grapics.

So, once I figured out that this pass was deeper, and was offset 0.015", I was able to construct geometry, and do things like "trim to the correct intersection points".

No warranty for this code is expressed, or implied, so USE AT YOUR OWN RISK!!!!

But, that said, I was able to get this modified code to successfully run in Graphics mode on my Haas NGC Simulator.

I included my Mastercam File, to show you how I laid out the points. the Green geometry (in general) is the 2nd pass, and the blue geometry is the first pass I plotted.

%
O04445
G00 G90 G40 G80
N76 M01 (T3- 3/8 EM./D21, FIXED 2ND PASS)
T3 M06 
N77 G0 G90 X7.301 Y-.315 S2700 M3
N78 G43 H3 Z.1 M8
N79 G1 Z-.271 F42.
N80 X4.4995
N81 Y-.5062
N82 Y0.
N83 X3.9013 Y.2715 S2800 M3
N84 G1 Z-.475 F42.
N85 G41 D3 X3.8388 Y.1633
N86 G3 X3.8305 Y.132 I.0541 J-.0313
N87 G1 Y.0852
N88 G3 X3.8564 Y.073 I.026 J.0215
N89 G1 X4.0941
N90 X7.1063
N91 G2 X7.2495 Y.0137 I0. J-.2025
N92 G1 X7.3045 Y-.0414
N93 G2 X7.3638 Y-.1846 I-.1432 J-.1432
N94 G1 Y-.4454
N95 G2 X7.3045 Y-.5885 I-.2025 J0.
N96 G1 X7.2495 Y-.6436
N97 G2 X7.1063 Y-.7029 I-.1432 J.1432
N98 G1 X4.0941
N99 X3.8721
N100 G3 X3.8391 Y-.7298 I0. J-.0337
N101 G1 Y-.8013
N102 G3 X3.8471 Y-.8313 I.06 J0
N103 G40 G1 X3.9071 Y-.9352
N104 G0 Z.1
N105 X3.8876 Y.2777 
N106 G1 Z-.488 F42.
N107 G41 D3 X3.8258 Y.1708
N108 G3 X3.8155 Y.132 I.0671 J-.0388
N109 G1 Y.0803
N110 G3 X3.8564 Y.058 I.041 J.0264
N111 G1 X4.0941
N112 X7.1063
N113 G2 X7.2389 Y.0031 I0. J-.1875
N114 G1 X7.2939 Y-.052
N115 G2 X7.3488 Y-.1846 I-.1326 J-.1326
N116 G1 Y-.4454
N117 G2 X7.2939 Y-.5779 I-.1875 J0.
N118 G1 X7.2389 Y-.633
N119 G2 X7.1063 Y-.6879 I-.1326 J.1326
N120 G1 X4.0941
N121 X3.8721
N122 G3 X3.8241 Y-.7284 I0. J-.0487
N123 G1 Y-.8013
N124 G3 X3.8341 Y-.8388 I.075 J0.
N125 G40 G1 X3.8941 Y-.9427
N126 G0 Z.1
N127 X3.9226 Y.1288
N128 G1 Z-.27 F32.
N129 G41 D3 X4.0308 Y.0663
N130 G3 X4.0621 Y.0579 I.0313 J.0541
N131 G2 Y-.6879 I0 J-.3729
N132 G3 X4.0321 Y-.6959 I0 J-.06
N133 G1 G40 X3.9292 Y-.7559
N134 G0 Z1. M9
N135 G91 G28 Z0 M5
M30
%

test nc code arc issue.mcam 296.87 kB · 0 downloads O4445.nc 1.53 kB · 0 downloads

Comparison between original and fixed file.PNG

Holy crap thank you! So that section did up working! For everyone wondering why i dont go in on mastercam and fix it, the machinist that was at the company for 30 years was very old school. Programmed all on the machine. wasnt till a few years ago he started doing all this on the computer and almost everything is a 2D wire drawing that are hard to read. Still learning how to make them solids so i can read and understand better! Will definitely be using the links you have posted to help me out! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...