584,860 active members*
5,163 visitors online*
Register for free
Login
IndustryArena Forum > MetalWorking Machines > Tormach Personal CNC Mill > Having Trouble Rotating Hand Written G-Code w/ PCNC 1100
Results 1 to 14 of 14
  1. #1
    Join Date
    Jan 2014
    Posts
    35

    Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    I have some G-code written by hand that has evolved over a number of years... however it is not very efficient in it's current orientation. Ideally I would rotate by 90 degrees and then somehow translate so I can make 3 parts from one piece of large stock (there are 3 tool changes in the program). I've been trying to wrap my head around m68 but with no luck.

    I zero the program by touching the front left top of the stock (from my POV sitting in a chair in front of the machine).

    Can anyone provide some advice or tips?

    I am using Camotics to simulate the program. I'm concerned also that Camotics will do one thing and Pathpilot yet another. My machine is currently 5 hours away because I moved and so it's a PITA to go and use it.

    Pardon if this sounds stupid, I have no machining background, I happen to make just enough parts with the PCNC to justify owning an older barebones one.

  2. #2
    Join Date
    Nov 2012
    Posts
    591

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    I assume you mean G68, not M68?

    When you rotate the coordinate system, you also need to offset it. Let's assume you rotate 90 degrees clockwise. What was 1 inch +Y will now be 1 inch +X. Also, if you touch off front-left before rotation, that 0,0 will now be back-left after rotation.
    What's extra annoying is that rotation happens AFTER all offsets, so if you want to offset by 1 inch positive Y, you have to un-rotate that offset in your calculator (in the previous example, Y+1 becomes X-1 after un-rotating) and then add that offset to your G54 or whatever, so that it then becomes a Y+1 after the rotation.

    Here's another option:
    Open your G-code file, and save a copy (you know, for backup purposes!)
    Now, for every line, where you see an X value, you change it to the same value, but negative, in Y. And wherever you see a Y value, change it to the same in X. Where you see I, make it negative J, and where you see J, make it I.
    This will manually rotate the entire coordinate system. You can verify it in your tool path preview program.
    Example:

    G0 X5 Y2
    G2 I1 J2 X6 Y3.732

    This turns into:

    G0 Y-5 X2
    G2 J-1 I2 Y-6 X3.732

    Making three parts manually requires more editing, but at this point, it's just copy-and-paste.
    Find each tool change. Copy the code after the tool change until the next tool change, and paste it two more times.
    Now, right after the tool change, Add a G54 line. Before the first copy, add a G55 line. Before the second copy, add a G56 line. Do this for each tool section.
    Now, when you touch off parts, you have to touch them off three times; once for G54, once for G55, and once for G56. Then, when you go, the mill will cut all three parts, each based on their individual touch-off.

    Luckily, rotation happens AFTER work offset, meaning it rotates around your work offset zero, which means that you don't need to do anything more to rotate the program than what you already did above.

  3. #3
    Join Date
    Apr 2013
    Posts
    1788

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    If you want to test your code but have no machine nearby you could use Tormach's virtual PP. See https://www.tormach.com/pathpilot/

  4. #4
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Thanks for the tips! The G-Code is quite long but I'll try to write a script to update the coordinates. I signed up for the Virtual PathPilot so that's a huge help. Camotics wasn't always 1:1 with Pathpilot, so I get some surprises after simulation.

  5. #5
    Join Date
    Oct 2005
    Posts
    1145

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    IF you have an older Tormach 1100 that runs Mach3 then the virtual PathPilot will not do you any good
    as it does NOT use G68 for coord rotation.

    (;-) TP

  6. #6
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Quote Originally Posted by jwatte View Post
    Here's another option:
    Open your G-code file, and save a copy (you know, for backup purposes!)
    Now, for every line, where you see an X value, you change it to the same value, but negative, in Y. And wherever you see a Y value, change it to the same in X. Where you see I, make it negative J, and where you see J, make it I.
    This will manually rotate the entire coordinate system. You can verify it in your tool path preview program.
    I ended up search/replace " " with "," and loading the G-code into Excel as CSV (it's 2500 rows, so beyond manual editing). I then replaced X in the left hand column with Y- and so forth. I normally write the code as G01X10Y10 but there were 197 lines where there was a space between the Gxx and the first coordinate, so I had to manually fix those.

    Dont forget to search and replace "--" with "". Then save the file, open in NotePad, and replace "," with a " " to get back to well formed g-code.

    PathPilot virtual seems to have been down but it's working again today (I used Camotics last night, but as usual, it is painful and kept crashing or hanging [tool paths calculate OK, but it can't simulate the work piece]). Found and fixed some errors (all in the lines where I manually edited). Now I'm moving on to the offsets.

    Thanks!

  7. #7
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Quote Originally Posted by vmax549 View Post
    IF you have an older Tormach 1100 that runs Mach3 then the virtual PathPilot will not do you any good
    as it does NOT use G68 for coord rotation.

    (;-) TP
    I do have an older one but I upgraded to PathPilot when it came out. Mach3 drove me nuts.

  8. #8
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Quote Originally Posted by jwatte View Post
    I assume you mean G68, not M68?

    When you rotate the coordinate system, you also need to offset it.
    Ok, one Q. I duplicated my G-code 3 times and put g54, 55, 56 right before each block.

    I then go into PathPilot work offset table. I had assumed g54 would be set to 0,0,0, and I could add 9 inches to each X offset (since my part is 8 inches or so wide) so g55 is 9,0,0 etc. However, g54 is 3.555, -1.3208, -4.7255. Now I can just add 9 inches , but wondering where those seemingly random numbers originate from...

    EDIT: Just tried copy g54 offsets to g55 and g56 and then adding 9 and 18 to X respectively, and it appears to work as I thought it would. Just have no idea where those initial settings came from.

  9. #9
    Join Date
    Nov 2012
    Posts
    591

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Those numbers are where the spindle was located when you zeroed the axes. E g, "zeroing an axis" really means "put the negative value of the absolute position of the spindle, into the work coordinate system offset."
    So, if the absolute value is X=2.5, Y=-1, Z=6, and you "zero axis" on all three axes, the G54 coordinate system will be X=-2.5, Y=1, Z=-6.
    The DRO values you see for where the spindle is, are calculated as "the absolute position of the spindle (relative to the home of each axis) PLUS the current work coordinate system offset."
    So, absolution position X=2.5, plus G54 offset X=-2.5, means that the DRO reads 0.

    (Actually, hmm, I'm not at the machine right now, and I'm not sure if the absolute position is copied into G54 and the G54 offset subtracted; or whether the negative of the absolute position is copied into G54 and the G54 offset added -- it's the same result in the end, but if you edit G54 directly, obviously the sign matters :-)

  10. #10
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Well after all that prep work, I get majorly delayed by snow and then stuck outside the shop because the garage door is broken and I've forgotten the door key, I manage to pry the door open using a bicycle frame, then I realize the electrician has wired the wrong receptacle on the wall so I hard wire the machine to the panel, then the PathPilot hard drive dies booting the machine (click click click). I kept my Mach3 hard drive just in case so I guess I'll be tossing that in and hoping it runs. I found the PathPilot install CD if I can somehow find a hard drive on a Sunday out in the boonies while it's snowing again.

    One note for anyone else copy pasting their G-code: there are commands to end a program. If you include those when you duplicate your code... well you still only get one part.

  11. #11
    Join Date
    Jun 2015
    Posts
    4131

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    hy mojo

    I have some G-code written by hand that has evolved over a number of years...
    yeah, me too ...

    I have no machining background
    so far, i always believed that someone who is building a g-code over 'years' has machining background hmm, whatever

    Ideally I would rotate by 90 degrees and then somehow translate so I can make 3 parts from one piece of large stock (there are 3 tool changes in the program). I've been trying to wrap my head around m68 but with no luck.
    i have no experience with your type of machine, but i use simple G code :
    ... enable transformation : activate translation_among_x translation_among_y rotation_of_current_coordinates
    ... cutting
    ... disable transformation
    * i don't know the g code for your machine, but i guess that it should be inside the manuals

    even if it works, i don't always use it for long setups, because it is causing downtime with re-positioning, so i have a general code, that is build in this way :
    ... toolpath is not like X10 Y12, but like X10+tx Y12+ty, where tx & ty are variables, that can be edited inside the program, so to translate the entire toolpath
    ... i use also a coordinate transformation, going from rectangular (xoy) to polar coordinates(r alfa), thus being able to rotate a point like alfa=mod[alfa+rotation,360]; i use mod so to avoid generating an angle >360 / kindly
    Ladyhawke - My Delirium, https://www.youtube.com/watch?v=X_bFO1SNRZg

  12. #12
    Join Date
    Oct 2005
    Posts
    1145

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Coordinate rotation in PathPilot does work well why not use it. It is controlled by the gcode G10 L2 Rxx.

    Move to teh Point of origin of the PART. Input G10 L2 R90 . The toolpath will rotate 90 CCW . Cut your part and then clear the rotation with G10 L2 R0. Move to the next point of origin for the part and repeat . THAT is the easy/simple way to use it. You can make it as complicated as you want.

    One thing though when you jog it will jog in teh original plane But when it is controlled from Gcode it moves in the Rotated plane.

    Just a thought, (;-) TP

  13. #13
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Quote Originally Posted by jwatte View Post
    Those numbers are where the spindle was located when you zeroed the axes. E g, "zeroing an axis" really means "put the negative value of the absolute position of the spindle, into the work coordinate system offset."
    So, if the absolute value is X=2.5, Y=-1, Z=6, and you "zero axis" on all three axes, the G54 coordinate system will be X=-2.5, Y=1, Z=-6.
    The DRO values you see for where the spindle is, are calculated as "the absolute position of the spindle (relative to the home of each axis) PLUS the current work coordinate system offset."
    So, absolution position X=2.5, plus G54 offset X=-2.5, means that the DRO reads 0.

    (Actually, hmm, I'm not at the machine right now, and I'm not sure if the absolute position is copied into G54 and the G54 offset subtracted; or whether the negative of the absolute position is copied into G54 and the G54 offset added -- it's the same result in the end, but if you edit G54 directly, obviously the sign matters :-)
    With the physical machine, if you are in the g54 offset and you zero the machine, g54 offsets are adjusted accordingly. I had to re-zero the z axis for a tool change, and would have to manually update g55 and g56.

    My question was more about the virtual pathpilot... A fresh install of PathPilot 1.x has a work offset table that is all zeroed out. On virtual, it is not.

    Anyway to follow up, I was able to machine my parts. It was painful as I had problems with the controller; it would freeze on the Tormach logo. Pressing ESC showed an error which said to run fsck manually, but I couldn't figure out a way to drop to grub or a shell. Not sure what happened as the machine worked a few months ago. I ran to Walmart and bought a hard drive, but had the same error after a fresh install, so I grabbed another old PC that I luckily had not yet thrown out. That one did boot, but if I left it idle the interface would freeze (though the mouse cursor still worked). Luckily it did not freeze while the program was running. I did have to re-zero the Z once as mentioned above, and luckily PathPilot can resume where it left off after restarting (unlike Mach3), which is good because I think I ended up having eight freezes (gotta move quick).

    Thanks all for the advice on the offsets... it made my life a lot easier; I'd never messed around with that table and it was super helpful for efficiently using my stock. I tweaked my g-code to streamline and have a list of other improvements I can now focus on instead of mucking around with my plywood fixtures...

  14. #14
    Join Date
    Jan 2014
    Posts
    35

    Re: Having Trouble Rotating Hand Written G-Code w/ PCNC 1100

    Quote Originally Posted by deadlykitten View Post
    so far, i always believed that someone who is building a g-code over 'years' has machining background hmm, whatever
    Well, I have an engineering degree vs this topic where nobody ever sat me down and explained how it works. The business just ramped up faster than I expected and I was spending too much money outsourcing short runs of relatively simple parts; Tormach was able to make a machine appear in my driveway in two weeks and I slapped a basic software pipeline and g-code together over Christmas... and it worked for five years. If I milled three parts in one evening, I was happy, but now I have to churn out eight in the same amount of time.

Similar Threads

  1. Other use for my PCNC 1100
    By rdsi in forum Tormach Personal CNC Mill
    Replies: 1
    Last Post: 10-13-2017, 09:22 PM
  2. PCNC 1100
    By ConveyTrex in forum Tormach Personal CNC Mill
    Replies: 1
    Last Post: 12-14-2016, 01:20 PM
  3. PCNC 1100 vs PCNC 770 (Is the 1100 worth it)
    By thunderdork in forum Tormach Personal CNC Mill
    Replies: 30
    Last Post: 09-21-2016, 08:43 PM
  4. WTS: PCNC 1100
    By HLF Ordnance in forum Tormach Personal CNC Mill
    Replies: 2
    Last Post: 07-13-2012, 01:41 PM
  5. PCNC 1100 help
    By jedge in forum Tormach Personal CNC Mill
    Replies: 6
    Last Post: 10-23-2010, 11:58 PM

Tags for this Thread

Posting Permissions

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