1WP: G Code, interplay between polar, incremental, and plane selection.

The #1 community for Gun Owners in Indiana

Member Benefits:

  • Fewer Ads!
  • Discuss all aspects of firearm ownership
  • Discuss anti-gun legislation
  • Buy, sell, and trade in the classified section
  • Chat with Local gun shops, ranges, trainers & other businesses
  • Discover free outdoor shooting areas
  • View up to date on firearm-related events
  • Share photos & video with other members
  • ...and so much more!
  • CathyInBlue

    Grandmaster
    Rating - 0%
    0   0   0
    The 6 year old Haas manual I've found says that with G16, Y becomes the angle and X becomes the radius. I agree that it would make more sense for R and A to replace respectively X and Y outright, but I have to stick to what the documentation tells me. For instance, other than looping and branching statements, I've seen no instructions or options that use multiple letters (RPT6). According to the documentation I have, G70 X2 Y0 I60 L6 will handily achieve the six 60° 4" bolt hole circle without any resorting to polar coordinates.

    What is the make/model/submodel/features of the machine you work with? I'd love to add direct support for it into my compiler.
     

    rhino

    Grandmaster
    Rating - 100%
    24   0   0
    Mar 18, 2008
    30,906
    113
    Indiana
    The entirety of the MTTC offering for the Summer evapourated. Their explanation was "circumstances beyond our control."

    There don't appear to be any distance learning classes, state-wide, college-wide for the Summer session.

    I'm gonna try to cut a deal where if I deliver a working compiler by the start of MTTC 242 in the Fall, if I then pass 242, they give me credit for 208. The system also kicked out my registration for the Fall PLC level I course because they don't have me down as having passed INDT 100 and INDT 113. 113 is Basic Electricity. I have an all but dissertation for an MS in Physics. I've taken more than my fair share of electrodynamics classes and am conversant with Maxwell's Equations, nevermind Ohm's Law. LinuxGizmos:* all about Linux-powered devices is my Christmas wish list. I just want to learn industrial PLCs.

    Talk about "First World Problems"…

    Your adviser should be able to override the problem with prerequisites. I registered for Accounting 101 a few summers ago and got rejected because I did not have the math prerequisites. Which is kind of funny since I'd been teaching physics and math there for over 5 years at the time. I sent a copy of my undergrad transcript to the adviser and she fixed it.

    I'm too old and crusty for the g-code business, but one aspect has me curious. I've noted in the discussion that when you change coordinate systems, the new coordinates are always relative to the previous rather than absolute with respect to some fixed point of reference. Is there a reason for that? Seems to me it would make sense to be able to choose relative or absolute. Of course, that may be a silly idea since I have no experience here and I don't really know what I'm talking about.
     

    jblomenberg16

    Grandmaster
    Rating - 100%
    67   0   0
    Mar 13, 2008
    9,920
    63
    Southern Indiana
    Cathy-

    Sounds like you are in it pretty deep. Rhino pointed me towards the thread, but unfortunately you are in a lot deeper than I ever got doing CNC programming back in the early days of my career. We did have a guy that was a wizzard at doing some of the polar stuff when we had to do some complex boring that required not just a nice interpolated radius, but a profile at the same time.

    From what I remember is that the Polar stuff still obeys some of the same conventions as to +/- movements in the X-Y-Z planes, but as you've found, establishing your origin is part of the fun. A lot of what we were doing used a probe to establish a new origin, such as off an exisiting machined surface, or in teh center of a bore that we needed to keep a tight relationship with.
     

    CathyInBlue

    Grandmaster
    Rating - 0%
    0   0   0
    Your adviser should be able to override the problem with prerequisites. I registered for Accounting 101 a few summers ago and got rejected because I did not have the math prerequisites. Which is kind of funny since I'd been teaching physics and math there for over 5 years at the time. I sent a copy of my undergrad transcript to the adviser and she fixed it.

    I'm too old and crusty for the g-code business, but one aspect has me curious. I've noted in the discussion that when you change coordinate systems, the new coordinates are always relative to the previous rather than absolute with respect to some fixed point of reference. Is there a reason for that? Seems to me it would make sense to be able to choose relative or absolute. Of course, that may be a silly idea since I have no experience here and I don't really know what I'm talking about.
    Yes, indeed. As mentioned in the OP, when just sticking to the 3D Cartesian coordinate system, at any time, you are free to throw out the G90 instruction and the machine will interpret all further (X,Y,Z) coordinates as absolute, relative each and every one to the fixed coordinate system origin that has been configured, just as any geometry buff would understand the coordinates. Then, you can throw out the G91 instruction and the machine will interpret all further (X,Y,Z) coordinates as incremental, relative each and every one to the immediately preceding point's coordinates.

    Under G90, absolute positioning, issuing instructions to occur at (1,1,1) over and over and over will see all instructions executed at the same point, (1,1,1). Under G91, incremental positioning, using instructions to occur at (1,1,1) over and over and over will see the first instruction occur at (1,1,1) and the next instruction at (2,2,2) and the next instruction at (3,3,3), then (4,4,4), (5,5,5), etc. That's a simple and easy concept to grasp. And, of course, any coordinate is free to be negative.

    Now, hitting the G16, polar coordinates, instruction, suddenly, X, Y, and possibly Z are subject to markedly different interpretations, at least, those are the parameters that are affected in the resources I have for learning G code. Now, similarly to the Cartesian coordinate system under the effects of G90 vs. G91, immediately upon entering G16, we get a new coordinate origin with the 0° direction being, by default, in the +X, straight east, right-hand direction. Then, consider the following program:

    "line-to 2 45; line-to 2 135; line-to 2 225; line-to 2 315;"

    A) If the angles are always relative to that original 0° line and the radius (always 2 in this example) is always distance from the original origin, that program creates a sort of squarish lowercase e, about 2.828" on a side.

    B) If the angles are always relative to that original 0° line, but the radius is the distance from the current point to the destination point, that program creates a 2" square diamond shape with the end point being the same as the starting point.

    C) If the angles are always relative to the direction of the immediately previous line/vector of motion, with the initial vector defaulting to the same as the other two origins, and the radius is the distance from the current point to the destination point, then that program creates a sort of saw-tooth pattern.

    I doubt that C is the default implementation in any machine, but I can see it being a configurable optional implementation. With C, you could create any regular polygon with integer length sides very easily. "line-to 2 72;" repeated 5 times creates a pentagon with 2" sides. "line-to 2 60;" repeated 6 times creates a hexagon with 2" sides, etc. Do to the same with interpretation A, it would be similarly simple to create any regular polygon with vertices which land on a circle of integer radius. "go-to 2 0; line-to 2 72; line-to 2 144; line-to 2 216; line-to 2 288; line-to 2 0;" would create a regular pentagon that could fit inside a 2" radius circle. "go-to 2 0; line-to 2 60; line-to 2 120; line-to 2 180; line-to 2 240; line-to 2 300; line-to 2 0; would create a regular hexagon that could fit inside a 2" radius circle. Now, flip that around, using C's interpretation to create regular polygons that could fit within a circle of integer radius will require some math to pre-calculate the lengths of the sides, and using A's interpretation to create regular polygons that have sides of integer lengths will require some math to pre-calculate the distances of the vertices from the central origin. All three implementations/interpretations of polar coordinates in a CNC machine make some form of milling/turning easier and makes another form less easy. I'm just trying to figure out which make/model/submodel machines rely on which interpretation(s) and whether or not G90/G91 and/or G17/G18/G19 plane selection would alter any given make/model/submodel machine's interpretation(s).

    Cathy-

    Sounds like you are in it pretty deep. Rhino pointed me towards the thread,
    Ci. Muchas gracias, señor.

    but unfortunately you are in a lot deeper than I ever got doing CNC programming back in the early days of my career. We did have a guy that was a wizzard at doing some of the polar stuff when we had to do some complex boring that required not just a nice interpolated radius, but a profile at the same time.

    From what I remember is that the Polar stuff still obeys some of the same conventions as to +/- movements in the X-Y-Z planes, but as you've found, establishing your origin is part of the fun. A lot of what we were doing used a probe to establish a new origin, such as off an exisiting machined surface, or in teh center of a bore that we needed to keep a tight relationship with.
    Yeah. Trying to create software tools to support other software tools frequently requires one to do everything down to, and even including, reading the source code for the core system, in order to support it properly in the higher level tool system.
     
    Last edited:

    rhino

    Grandmaster
    Rating - 100%
    24   0   0
    Mar 18, 2008
    30,906
    113
    Indiana
    All three implementations/interpretations of polar coordinates in a CNC machine make some form of milling/turning easier and makes another form less easy. I'm just trying to figure out which make/model/submodel machines rely on which interpretation(s) and whether or not G90/G91 and/or G17/G18/G19 plane selection would alter any given make/model/submodel machine's interpretation(s).

    I just had a thought. You're coming at this from a solid comprehension of coordinate systems in a mathematical sense and it seems like you are equally versed in applying the basic ideas in meat space.

    If these multiple and apparently sometimes contradictory interpretations arose from multiple sources, what if one or more of the people who conceived them did not have a similar grounding in the way coordinate systems are used in mathematics? Perhaps they found a system that works for them and is repeatable, but maybe doesn't quite fit into a more conventional understanding? It could explain multiple paths that seem to be different, but arrive at the same destination.
     

    CathyInBlue

    Grandmaster
    Rating - 0%
    0   0   0
    I'm using official Haas manuals and training materials for using Haas machines.

    Come to think of it, ATM, my "G code compiler" is really more of a "G code assembler", just putting human readable mnemonics on G code instructions and their parameters. Ultimately, I can choose a single, "canonical" interpretation of my choice on polar coords and allow them to be used on any make/model/submodel machine, doing the calculations at compile time to convert from polar to the underlying Cartesian coords.
     
    Last edited:
    Rating - 100%
    28   0   0
    Oct 3, 2008
    4,260
    149
    On a hill in Perry C
    The 6 year old Haas manual I've found says that with G16, Y becomes the angle and X becomes the radius. I agree that it would make more sense for R and A to replace respectively X and Y outright, but I have to stick to what the documentation tells me. For instance, other than looping and branching statements, I've seen no instructions or options that use multiple letters (RPT6). According to the documentation I have, G70 X2 Y0 I60 L6 will handily achieve the six 60° 4" bolt hole circle without any resorting to polar coordinates.

    What is the make/model/submodel/features of the machine you work with? I'd love to add direct support for it into my compiler.

    I think a lot just depends on the type of controller a person uses and how that controller reads the instructions. I did notice an error in my code from my previous post. I could have left out the G70. We use the RPT on an ancient CMS machine. It is not necessary on any of the others but if I left it out and tried to run that program on The Beast, it would sit there and happily run that line all day long, or until the operator stopped it. WIth the RPT6 it runs that 6 times then goes to the next line. Not sure if it is a feature or a workaround for an error. Also on that machine X+ is to the left, 9 o'clock position.

    Got the chance to fiddle with it a little today in regards to milling. I think I'm even more confused than I was before. Seems some of our machines support different types of polar programs. In one mode after the G16 each angle is based off the previous movement's angle, using it as 0. Another mode all the angles are based off the X+, and do not use the angle of the previous movement. Some you can do a X,Y from the angle specified, others can only do a movement along the vector of the angle. Did talk with a couple of the engineers at work who have done a bunch of programming, when I mentioned polar all I got was blank looks.

    As far as what types of machines we have, in the metal area we have 2 Trumpf lasers, one a sheet machine and the other a tube machine. In the wood/laminate/plastic area we have the above mentioned CMS Series 10; 3 Buselattos, 2 are XL6000s and 1 is a XL4000; a Homag BAZ, and 5 Thermwoods of various types.
     

    CathyInBlue

    Grandmaster
    Rating - 0%
    0   0   0
    Seems some of our machines support different types of polar programs. In one mode after the G16 each angle is based off the previous movement's angle, using it as 0. Another mode all the angles are based off the X+, and do not use the angle of the previous movement. Some you can do a X,Y from the angle specified, others can only do a movement along the vector of the angle. Did talk with a couple of the engineers at work who have done a bunch of programming, when I mentioned polar all I got was blank looks.

    :( :crying: :wallbash: :bash:
     
    Top Bottom