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:

Programming similar to internal subs but using incremental or work shift on mills?


honeybunches
 Share

Recommended Posts

So we have been programming using internal subs for years.  Mostly works fine for us.  If memory serves the beginning of a program will have the prep functions and tool, then the list of offsets.  Then the tool path operations are listed below for each tool starting with a line number and ending with an M99.  

What I would like to do is invoke this exact same functionality as the internal sub calls and use of M99 but instead of assigning a different offset, I would like to simply work shift relative to the first offset (G54 for example).  

I am not even sure if G52 can do this but wondering if....

T1

G54

G52 Y4

G52 Y8

etc

Can we do something similar to this?  This should be an easier tweak to our post than starting over!  The overall goal here is to reuse the exact same tool path operations but at different locations.  Not create multiples of the same paths as so many  do.  

 

 

Link to comment
Share on other sites

Colin, is this setup as an internal sub post?  Problem is I have our post now about how I like it! lol  I hate to start over.  Would it be too difficult to modify our post that currently outputs multi offsets as local subs, and get it to spit out G52s?  Will the program otherwise work like this or are there other tweaks?  It would help to see sample code of a G52 local sub program.  We use one of the general variable boxes in MCX.  When set to 1, it outputs as one offset as normal but if set to 2 or more, it generates as G54, G55, G56, etc, and reorganizes as a local sub program.  problem I see is I would need to list out all the different G52s in MCX somewhere or have to hand code them later.  

 

Link to comment
Share on other sites

Colin, I found some of your webinar vids which are quite helpful.  I think primarily at this time, I am trying to determine if what I am asking is even possible from a machine controller standpoint.  I am sure we can figure out how to get the code spit out as needed, but knowing what is needed is probably the first step.  

Could you or anyone speak to the repeating G52 or G92, or otherwise incremental step or workshift from an offset, listed in a program without the need to regenerate the toolpath code many times?  As in our internal or local sub posting, the list of offsets is in the prep functions of the program and the controller goes up to grab each offset in the list as they are ran.  I guess I could call our machine support group on that but not sure how helpful they might be on that.  

Link to comment
Share on other sites

Dude,

You are exactly on the correct tract with G52.

Your request is exactly the functionally that I ended up adding. Look at the comments for "mi1$":

# --------------------------------------------------------------------------
# Misc. Values:
# --------------------------------------------------------------------------
# Integers:
#
# mi1 - Work coordinate system
#        0 = Reference return is generated and G92 with the
#            X, Y and Z home positions at file head.
#        1 = Reference return is generated and G92 with the
#            X, Y and Z home positions at each tool.
#        2 = WCS of G54, G55.... based on Mastercam settings.
#        3 = G52 Work Shift, (Current Work Offset still remains)
#        4 = Both Work Offset (G54's) and Work Shift (G52)
#        NOTE: G52 Work Shift uses Home Position Values.
#              G52 X0. Y0. Z0. Resets Work Shift

 

I literally set this up to use the "Coordinate" method in the Transform Subroutine output. It is setup so you can call up the Active Work Offset (G54), then do a bunch of "G52 Shifts", all while calling the subroutine to repeat the cut, at the new location. It even outputs the G52 XYZ Zero at the end...

G52

G52 is a "Global Work Shift". It is simply a + or - move, in XYZ, from wherever the current "Active Work Offset" is set. It is true that we can use "G52 Work Shift" to move the "active zero position", then repeat the same subroutine call (G65 P1001).

I would still recommend that you include the "M99" at the end of the Subroutine that you are writing, because you still want it to "return" after the call to make the cut. Fortunately, an active "G52 Shift", is cancelled simply by calling "G52 X0. Y0." after you completed all of the parts where you wanted your Subroutine to cut.

Remember that G52 is essentially an "Incremental Shift" to the active Zero Point. On newer machines, this should always be the "multi-offset" type; G54-G59, with or without the "extended series" of offsets.

The cool thing about the shift, is if you properly setup the "first offset" location, and your fixture is well built, then each time you "shift", it is always relative to just the single zero point.

G92

G92 is a very "old school" method of setting a Zero Point location. It is typically used on older machines, that didn't have a lot of memory or capability. The purpose of G92 is to "assign the current spindle position" to a location, relative to a Program Zero Point. This sounds really complex, but is simpler than it sounds at first.

G92 is typically used by a machinist/operator/programmer in the NC Code, to tell the machine's control unit, "where is the position of the tool, relative to Program Zero". The usage can widely vary. The question is, "are you setting 'zero', with G92, or a position relative to zero. What do I mean by "Relative to Zero"?

With G92, in almost 100% of the use cases, the Operator of the machine is required to drive the tool to a "known location". Either the Zero Point, or some position "relative" to a known feature on the part.

G92 always tells the machine "Zero is wherever you are currently at. Full Stop. If, you are using Zero values."

G92 X0. Y0. Z0.  <-- This line tells the control, "The Spindle is at Zero."

G92 X10. Y0. Z-3.  <-- This says "The spindle is 10 inches negative from Program Zero in X, Spindle is on Center-line for Program Zero in Y, and Spindle is 3 inches above Program Zero for Z.

So, any positive value for XYZ after G92 "shifts" the Program Zero Point, relative to the current Spindle Location, in a positive direction from the Spindle Gauge Line. The negative coordinates shift it the opposite direction. For X (+ = Right, - = Left). For Y (+ = Back, - = Front), For Z (+ = Up, - = Down).

 

T1 M06

G92 X0. Y0. Z-10.     <--- This tells the Control, the spindle is centered on the Program Zero, and it is 10 inches above the Program Zero Point.

 

I would recommend against using G92, unless there is a specific reason why it would make a good addition to your shop. You'll never see me recommending that people use G92.

G52 work shifts, relative to an Active Work Offset? This is supported in the Haas Post I mentioned...

 

 

 

 

 

 

Link to comment
Share on other sites

never used G52. Mixing that and G92 is a recipe for disaster for mere mortals, in my opinion.

Mix G52, G54 AND G92 methods all together and you have a 1000% chance of calamity, in my mortal opinion.

hand that off to another experienced operator... :shudder:

 

I'd use G54 with

G54

G10 L2 P1 G90 X10.1234 Y11.1234 Z-5.1234 (set table location of first part or zero)

call sub

G10 L2 P1 G91 Y4 (shifts incrementally)

call sub

G10 L2 P1 G90 Y0 (resets shift to zero IIRC)

G10 L2 P1 G91 X8

call sub

Link to comment
Share on other sites

Appreciate the replies guys.  I am still in the planning stage for a more "system wide" adoption that will work going forward, not just solve a today issue.  G10 is a call to actually change the offset table, correct?  Can also be executed with a variable but not sure if there is any advantage there.  I am trying to determine if there is any advantage one way with the G10 vs G52?  They both mostly do the same thing.  The concern I have with messing with an offset just looking at the value, you don't know where you are.  Its easy to play with nice round numbers, but not so much with X-3.54923+2.43948.  I think some of our machines have an actual work shift display value which might be nice.  The G54 never changes but the work shift will and we can visually see if it is zeroed as a check.  

However, what I would like to do is be able to program the shifts (or offset changes) in MC.  

What we do now is simply program ONE part.  Then we use our sub post with misc variable setting to the number of offsets we want to run.  If we input 4, the post will auto generate G54-G57 in a local sub program utilizing M97 local subroutines, and M99 returns.  Example here.  

T1 M6

G54 (other prep functions)

M97 P200

G55

M97 P200

G56

M97 P200

(somehow cancel workshift here)

M30

------------------------------------------------------

N200

Do stuff here....

M99

In the case above, I can go make adjustments to any of the offsets it will run.  I also have a plan for restarts in the middle of a program.  

If I could replace the G55-56 above with a G52, I would be good with that.  Or another method maybe using the G10.  However, in all cases, I cannot simply setup a "times to repeat" and enter a shift value and let it rip because if one position needs tuned you have no way to adjust each position, one position is damaged and cannot run, or the program needs restarted mid program, there is no way to know where you are with certainty.  

Here is "sort of" what I would like to achieve but not certain all machines will work with this.  We have more than just Fanuc.  One is a Dynapath and I KNOW on it we have done repeats like this but maybe not how I would like to do it.  I might just accept doing it with offsets and subs in that one.  

T1 M6

G54 (other prep functions)

M97 P200

G54 G52 X4.0

M97 P200

G54 G52 X8.0

M97 P200

(somehow cancel workshift here)

M30

------------------------------------------------------

N200

Do stuff here....

M99

Above is what I have in my head.  Maybe G52 needs a separate line but in this case, I am clearly calling my one and only G54 zero point and simply step known distances from it.  Yes you can probably just make her repeat 20x with one line but with the above, I can easily restart and can even add a comment for each position for clarity.  If X at ANY position needs changed, that becomes easy.  I cannot get my head around how a control knows to return to the NEXT M97 line when using M99.  

 

The way I understand G92 is it was used before coordinate offsets or maybe just an alternative to.  I have heard of programs where they want to go to a program and hit go in which fixtures never move so they just use G92 in the program.  I am not a fan.  I will never understand people spending 6-8 figures on a machine and won't spend 5min for setup verification.   I get the need to eliminate setup steps but in a case where the machine could home out in the wrong position, or whatever, a program should drive to the or each of the zero points and force the operator to use an indicator to verify it is on.  

Link to comment
Share on other sites

I've worked on older fanuc boring mills where SOP was to set G92 zero point for x and y plus Z0 for tool tip.

 switching over to TLOS and fixture offset was a comedy of errors due to the global and unseen G92 shift messing with everything.

G10 g90 literally sets the offset

G10 g91 shifts it.

 

Study up on G10, it can write to all kinds stuff on a fanuc.

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...