586,009 active members*
4,895 visitors online*
Register for free
Login
Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2003
    Posts
    168

    Help with "re-machining" G-code.

    SolidModel -> MeshCAM v3 [Windows and Linux/WINE] -> G-code -> TurboCNC v3.1a [DOS]

    I need to remachine a piece that's pretty good, but has an obvious mistake.

    Firstly, I am new to doing real CNC, and I'm doing it on my home-brew machine, and this is only my third piece, but it is also my largest and best-so-far, and I'd like to save it.

    The solid model was too big for MeshCAM: so I split it into two smaller models to be G-coded separately and combined later, into one G-code program that would yield a seamless model.

    Problem: After combining and only after machining, it was clear that MeshCAM had been misled (by me, who had used different Zmax values for each half of the model) about the Z=0 reference in the first part, such that the elevations of the first part are 0.1" higher than the second, and thus there is a 0.1" wall/offset at the join between the two parts, where it's supposed to be seamless.

    Question: What edits could be made to the first part's G-code so that it can be re-run to remove the 0.1" from the surface of only the first part and result in a seamless boundary at the interface to the second part, as intended?
    ---
    I suspect it might be done by a little "fibbing" about what the current value of Z is.

    For example, if TurboCNC sees an instruction to G01 Z-0.1, it will proceed differently if it thinks it's already AT Z=-0.1 than if it thinks it is at Z=0.

    Thank you for any insights, and extra thanks for an example.
    --
    cnczane
    --
    Dan

  2. #2
    Join Date
    Mar 2003
    Posts
    35538
    Question: What edits could be made to the first part's G-code so that it can be re-run to remove the 0.1" from the surface of only the first part and result in a seamless boundary at the interface to the second part, as intended?
    ---
    I suspect it might be done by a little "fibbing" about what the current value of Z is.
    Yes, just change the Z value prior to running the g code.

    I'm guessing though, that you'll still not get it perfect after re-machining.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  3. #3
    Join Date
    Jul 2003
    Posts
    168
    Quote Originally Posted by ger21 View Post
    Yes, just change the Z value prior to running the g code.

    I'm guessing though, that you'll still not get it perfect after re-machining.
    Thanks, Gerry.

    I'm just trying to make it look less like a piece of firewood.

    It's not as simple as change the Z BEFORE running the code; I simplified the example to try to give a clear picture.

    However, I need to change the Z INSIDE the code. Here's why.

    The "wall" is between two areas that should align. I'm not really keen to recut the entire first section (which your suggestion would accomplish) because it'll take hours and because I don't think my machine will be able to hold accuracy over the whole area again.

    Rather, what I'm anxious to try to smooth out the discontinuity over a span of rows:
    - to back off say 20 rows from the discontinuity
    - and remachine only that set of rows
    - while lowering the cutting depth 1/20th of the discontinuity before each pass

    In TurboCNC, my first try at this involved using G53/G92 because the TurboCNC manual said:
    " G92 This code sets the position of any or all axes to a specific value. Use this
    to reset the position inside a program. No motion will occur."
    and
    " You must be in the master coordinate system [G53] to use this code. All of the
    other offsets (1-20) follow the master. Ergo, if the origin in offset 1 is set
    to be exactly 3" away from the master origin (in G53 mode), then that
    relationship is maintained as the master origin moves.
    " Use jog mode to setup the coordinate offsets (tool offsets) and save them
    through the file menu. This command is not modal in versions 3.1 and up."
    and
    " This code sets the position of any or all axes to a
    specific value. Use this to reset the position inside a
    program. No motion will occur.
    " In machine coordinate (G53 T0) mode, the machine
    coordinates themselves are updated.
    " In any fixture offset mode (G54-G59) and T0, the fixture
    offset is updated.
    " In any tool offset mode (T1-T20), the tool offset is
    updated.
    " This code is not modal."

    I didn't set any offsets, and assumed they defaulted to 0. Thus, T1-20's coordinates would be identical to T0's.

    I tried:
    M03
    (STOCK/BLOCK, 16.496, 11.25, 0.406, -0.000, -0.000, 0.406)
    ...
    ; END ROUGH
    ; FINISH PARALLEL X
    (TOOL/MILL,0.1250,0.06250,1.000,0.0)
    M6 T5012500
    ; FINISH PARALLEL X S 3rd
    G00 X0.000 Y0.002 Z0.020
    G01 X0.000 Y0.002 Z-0.164 F5.0
    G01 X0.004 Y0.002 Z-0.164 F20.0
    ...
    G01 X16.496 Y3.161 Z-0.158 ; note ending Z=-0.158
    ; ROW 51, nom. - btwn Sections 1 and 2 at ROW 70, a Z discrepancy of -0.04"
    ; resulting in an apparent "wall" at Row 70
    ; begin "adjusting Z" to take out an extra 0.002" in the next 20 rows (20*0.002=0.04)
    G53 ; must be in "Tool 0" mode (abs.) for G92 command to be recognized
    ; redefine Z 0.002" higher than where it ended, causing Z to be cut deeper
    G92 Z-0.156
    G01 X16.496 Y3.163 Z-0.158
    ...
    etc.

    This approach failed because, I think, of my M6 T5012500 line. I always understood the "T" part to be an arbitrary string (in MeshCAM), to help me identify which tool was being called for in a tool change. (I do remember wondering why it would only take numbers...) I've been encoding my tool names like this from Day One, long before I ever had a machine to work on. "T5" tells me it's a ball-end, "0125," 0.12500".

    In looking at why my G53/G92 failed, my reading now suggests that "T" is an actual G-code which not only prompts the user for which tool to change, but also changes to that tool's coordinate system(?). G53/G92 are for "T0".

    I should state that I don't zero my two tools and set any tool offsets before I run the code. Because I have only one tool change (from 1/2" rougher to 1/8" finisher), I wait for the M6 "tool-change" command and zero the finisher at that time.

    I've been using M6 to pause the machine to alert me and to permit me to change tools but now I think M6 has also been telling the G-code interpreter to "switch to the '5012500' coordinate system." G53/G92 may have changed "T0"s position, but they did nothing for "T5012500"s.

    My next try will be to redefine my finish tool to say T2 and to use:
    ...
    G01 X16.496 Y3.161 Z-0.158 ; Note, machine thinks it's at Z=-0.158
    M6 T2
    G55 ; change T2's coord. system
    G92 Z-0.156
    G01 X16.496 Y3.163 Z-0.158 ; machine thinks it's at Z=-0.156 so will cut -0.002
    ...
    --
    Dan

  4. #4
    Join Date
    Mar 2003
    Posts
    35538
    This approach failed because, I think, of my M6 T5012500 line. I always understood the "T" part to be an arbitrary string (in MeshCAM), to help me identify which tool was being called for in a tool change. (I do remember wondering why it would only take numbers...) I've been encoding my tool names like this from Day One, long before I ever had a machine to work on. "T5" tells me it's a ball-end, "0125," 0.12500".
    T is the tool#, so you're telling TurboCNC to change to tool # 5012500

    M6 T5 means change to tool #5. Generally, people use tool numbers from 1-255 or higher, if they have more.
    In looking at why my G53/G92 failed, my reading now suggests that "T" is an actual G-code which not only prompts the user for which tool to change, but also changes to that tool's coordinate system(?). G53/G92 are for "T0".
    G53 is machine coordinates, which are the absolute coordinates of your machine's axis'.
    G92 can offset the G53 coordinate system.

    It really doesn't matter which tool is currently active. However, if you have a tool length offset applied, it appears that this offset may be changed to reflect the G92 offset.
    In any tool offset mode (T1-T20), the tool offset is
    updated.
    Not 100 % sure on how that works exactly, as I've never used G92, and never used TurboCNC on an actual machine. It's been years since I've had a copy running.


    I've been using M6 to pause the machine to alert me and to permit me to change tools but now I think M6 has also been telling the G-code interpreter to "switch to the '5012500' coordinate system." G53/G92 may have changed "T0"s position, but they did nothing for "T5012500"s.
    There is no 5012500' coordinate system.
    As stated before, G53 is the machine coordinate system. Generally, cutting is done in a work offset coordinate system (fixture offset), typically G54 through G59. Each system contains XY and Z offsets, which are relative to the G53 coordinates, which can be modified by the G92 offsets. Confusing?
    If the Work Offsets are zero, the the work offset system is the same as the G53 system.

    My next try will be to redefine my finish tool to say T2 and to use:
    ...
    G01 X16.496 Y3.161 Z-0.158 ; Note, machine thinks it's at Z=-0.158
    M6 T2
    G55 ; change T2's coord. system
    G92 Z-0.156
    G01 X16.496 Y3.163 Z-0.158 ; machine thinks it's at Z=-0.156 so will cut -0.002
    What you probably want to do, is set your G54 offsets to zero, and start in the G54 system.
    Set the Z offset in your G55 system to -.156, and just switch to G55 when you change to T2.
    No need to mess with G92.



    It's not as simple as change the Z BEFORE running the code; I simplified the example to try to give a clear picture.

    However, I need to change the Z INSIDE the code. Here's why.

    The "wall" is between two areas that should align. I'm not really keen to recut the entire first section (which your suggestion would accomplish) because it'll take hours and because I don't think my machine will be able to hold accuracy over the whole area again.

    Rather, what I'm anxious to try to smooth out the discontinuity over a span of rows:
    - to back off say 20 rows from the discontinuity
    - and remachine only that set of rows
    - while lowering the cutting depth 1/20th of the discontinuity before each pass

    What I would do, is make a copy of the g-code, and edit out everything you don't need.
    Then just change the Z zero, and run only the code that you need.
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  5. #5
    Join Date
    Jul 2003
    Posts
    168
    It'll take a while to digest this, but I am sure the answer is in your long reply.

    I just came back to report that my latest attempt:
    G55
    G92 Z-0.156
    complained that "Must be in T0 mode to use this command [G92]..." or something like it.

    Many thanks.
    --
    Dan

  6. #6
    Join Date
    Jul 2003
    Posts
    168
    Quote Originally Posted by ger21 View Post
    Each system contains XY and Z offsets, which are relative to the G53 coordinates, which can be modified by the G92 offsets. Confusing?
    Speaking for all newbies Everywhere: "Yes."

    If the Work Offsets are zero, the the work offset system is the same as the G53 system.
    Only I don't think it did that. However: I did not explicitly set any work offsets, ASSUMING that "if I didn't SET them, they MUST be zero." (?)

    What you probably want to do, is set your G54 offsets to zero, and start in the G54 system.
    But I don't know how to set my G54 offsets to zero nor how to start in the G54 system, (but that part I suspect is just the G54 command). Do I define these offsets in TurboCNC setup BEFORE I actually load and run the code?

    Set the Z offset in your G55 system to -.156, and just switch to G55 when you change to T2.
    What I need to do is to re-machine the 40 rows, dropping down 0.001" with each new row, for a total drop of 0.04", thus smoothing out the difference over many rows.

    I think I need to be able to (re)set the Z offset in G55 on-the-fly, inside the program to do this.

    No need to mess with G92.
    ...which will avoid it messing with me...


    What I would do, is make a copy of the g-code, and edit out everything you don't need.
    Then just change the Z zero, and run only the code that you need.
    This is what I've done. I only run that subset of the code, after aligning my tool over where the program is about to begin. I'm hung up on the "just change the Z zero." (The "just" stings because it suggests it's really simple--and I can't figure it out!)
    --
    Dan

  7. #7
    Join Date
    Mar 2003
    Posts
    35538
    But I don't know how to set my G54 offsets to zero nor how to start in the G54 system, (but that part I suspect is just the G54 command). Do I define these offsets in TurboCNC setup BEFORE I actually load and run the code?
    Setup > Manage Fixtures

    Fixture 1 = G54
    Fixture 2 = G55

    and so on.

    To start in the G54 system, just put a G54 at the start of your g-code, or use the MDI window (F9) and type G54.

    You can change during the program by just calling the new offset (fixture).


    What I need to do is to re-machine the 40 rows, dropping down 0.001" with each new row, for a total drop of 0.04", thus smoothing out the difference over many rows.
    OK, that's a lot trickier.
    I think I need to be able to (re)set the Z offset in G55 on-the-fly, inside the program to do this.
    I don't believe that's possible.
    It looks like you only get 6 offsets (fixtures) in TurboCNC, so they are not really a viable option.

    Here's what you could do.

    Between each "row", in your g-code, use G92 to lower the axis .001. When the row finishes, move to Z0, and use G92 to set the position to -.001. If you need to move up out of the way first, you could move to Z0.5, and G92 to Z.499.

    So between each "row" of g-code, you'd do this:

    G0 Z0.5
    G92 Z0.499

    It looks like you'll want to be in G53, and use T0 for all cutting. This makes it less confusing, then switching tools. Although you may be able to do this:

    T0
    G0 Z0.5
    G92 Z0.499
    T1 (or whatever tool you're using)
    Gerry

    UCCNC 2017 Screenset
    http://www.thecncwoodworker.com/2017.html

    Mach3 2010 Screenset
    http://www.thecncwoodworker.com/2010.html

    JointCAM - CNC Dovetails & Box Joints
    http://www.g-forcecnc.com/jointcam.html

    (Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

  8. #8
    Join Date
    Jul 2003
    Posts
    168
    Well, it worked pretty well, but it was a nail-biter until the very end when it became clear
    that the calculations were close.

    For each of the 40 rows prior to the 0.04" discontinuity,
    I did something like this.
    M6 T0 ; I had just the one tool, so I renamed it T0, and skipped trying to figure out G54, etc.
    ...
    G01 X... Y... Z-0.150 ; I take note where last row ended
    M00 ; I inserted a pair of pauses so I could confirm that the Z values were actually changed by the G92
    G53
    G92 Z-0.149 ; reset Z-axis up 0.001"
    M00 ; Z changed by +0.001"?
    G01 X... Y... Z-0.150 ; which causes this to be cut 0.001" deeper than it would have been
    ...

    Thanks for ALL the assistance.
    --
    Dan

Similar Threads

  1. Machining 1" wide x 2-1/4" deep slot
    By midguard in forum Uncategorised MetalWorking Machines
    Replies: 4
    Last Post: 02-16-2011, 12:15 AM
  2. Replies: 2
    Last Post: 04-09-2010, 04:56 PM
  3. Heidenhain TNC2500 or TNC360 Teksoft Post Processor " G " code ISO
    By RMARCH in forum Bridgeport / Hardinge Mills
    Replies: 0
    Last Post: 06-11-2009, 05:51 PM
  4. Replies: 23
    Last Post: 02-25-2009, 10:49 PM
  5. Post adds "A0." code and machine stops
    By lookingforhelp1 in forum Fanuc
    Replies: 10
    Last Post: 08-29-2008, 06:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •