CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > G-Code Programing


G-Code Programing Discuss G-code programing and problems here!


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 12-23-2008, 11:41 AM
 
Join Date: Mar 2005
Location: usa
Posts: 214
Harryman is on a distinguished road
Tool length setter

I'm using an electronic tool touch off setter so I can maintain an accurate local Z zero when changing tools on my benchtop mill. It's wired into my controller and functions as a switch.

Here's the scenario I'd like to have happen. I have a Z zero position I use for my rotary axis a known distance (-28.65mm) above the top of the toolsetter. After a tool change, I'd like to touch off on the toolsetter and reset local Z at -28.65 and return to local X0Y0 so I'm ready to run the next program.

I can send the spindle to the toolsetter, manually touch off and trip the switch, G92 Z-28.65 and it works fine.

If I run this:

G53 Z0 [Lift Z Head]
G53 X276 Y125 [Move to XY position of tool measure switch]
L91 G0 Z-100 [Move down the rapid distance]
L91 G1 Z-250 M28 F20 G31 [Move down to tool switch]
g92 z-28.65 [set LZ at TOOL SWITCH HEIGHT]
G53 Z0 [Lift Z Head]
G0X0Y0 [RETURN TO LOCAL XY ZEROS]

It runs but doesn't set a new Z position, Z zero remains whatever my previous local Z zero was.

What am I missing?

Thanks,

Harry
__________________
www.harryhamilldesigns.com
CAD sculpting and services
Reply With Quote

  #2   Ban this user!
Old 12-31-2008, 09:15 AM
 
Join Date: Mar 2005
Location: usa
Posts: 214
Harryman is on a distinguished road

bumpy
__________________
www.harryhamilldesigns.com
CAD sculpting and services
Reply With Quote

  #3  
Old 12-31-2008, 01:40 PM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

I am assuming that this line:
L91 G1 Z-250 M28 F20 G31 [Move down to tool switch]
permits the tool to move freely downwards until it hits the switch?

It would appear that you are trying to avoid setting (and using) tool length offsets?

G53 is the machine coordinate system. Chances are good that you cannot alter the position of the G53 coordinate system. The G92 is a coordinate system shift. Since you cannot shift the G53 system, I would think that you would have to specify one of the available work offsets (G54) at the start of your code, so that the G92 shift can actually be applied to something.

For example, if machine home is initially synonymous with the G54 workshift, then
G00 G53 X0Y0Z0 will return the machine to home.
and
G00 G54 X0Y0Z0 will return the machine to the same position, until such time that you shift the Z value with the G92. Setting the G92 after the G54 workshift has been called (established as current), then you should see a new position established for every tool. Maybe. I don't know what controller you are using.
__________________
First you get good, then you get fast. Then grouchiness sets in.

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

  #4   Ban this user!
Old 12-31-2008, 02:48 PM
 
Join Date: Jan 2007
Location: MI. USA
Posts: 203
CarbideBob is on a distinguished road

Yup, the G53 on the next line cancels out your G92 preset.

If you want to return Z to the original zero replace the G53 Z0 line with:
G91 G28 Z0
G90

Warning: This may or may not work on your control.
On a Fanuc there is a parameter that controls whether or not a G28 (reference point return) cancels a G92.
Bob
__________________
You can always spot the pioneers -- They're the ones with the arrows in their backs.

Last edited by CarbideBob; 12-31-2008 at 03:49 PM.
Reply With Quote

  #5   Ban this user!
Old 12-31-2008, 05:19 PM
 
Join Date: Mar 2005
Location: usa
Posts: 214
Harryman is on a distinguished road

I am assuming that this line:
L91 G1 Z-250 M28 F20 G31 [Move down to tool switch]
permits the tool to move freely downwards until it hits the switch?
Correct, the switch is triggered, the move is stopped and we go to the next line of code.

It would appear that you are trying to avoid setting (and using) tool length offsets?
Ummm, I think I am. I'm just trying to define where in space the tip of the tool is after swapping them. By changing the tool setter Z height setting in different macros, I can set Z zero (local) for different fixtures.

I'm using Wincnc, which normally saves the offsets after measuring with a G37 and then uses them with soft limits to keep from dinging your table. I'm not sure if what I'm doing is the best way to go about it, but it seemed like a good idea at the time. Feel free to tell me I'm trying to reinvent the wheel.

So, I need to get out of G53 by calling a G54 before calling a G92?

What about this?

G53 Z0 [Lift Z Head]
G53 X276 Y125 [Move to XY position of tool measure switch]
L91 G0 Z-100 [Move down the rapid distance]
L91 G1 Z-250 M28 F20 G31 [Move down to tool switch]
G54
G92 Z-28.65 [set LZ at TOOL SWITCH HEIGHT]
G91 G28 Z0 [Lift Z Head] - Is this going to home Z or just send it to zero?
G90 - What's the G90 for?
G0X0Y0 [RETURN TO LOCAL XY ZEROS]

Thanks for all your help, it's confusing trying to figure this out.
__________________
www.harryhamilldesigns.com
CAD sculpting and services
Reply With Quote

Sponsored Links
  #6  
Old 01-01-2009, 11:30 AM
HuFlungDung's Avatar
Moderator
 
Join Date: Mar 2003
Location: Canada
Posts: 4,825
HuFlungDung is on a distinguished road

The only reason to check each and every tool with the presetter (after every tool change) is to ensure superior accuracy of tool position (if you fuss about 10ths of a thousandth) or to perhaps detect tool breakage. It could also prevent a tool crash (I suppose) if you were doing manual tool changes and inadvertantly put a tool in the spindle out of sequence. Are any of these reasons valid for your application?

If not, I would suggest you practice conventional setup: set the tool length offsets as the distance from the tooltip at G53 Z0 (home) versus the Z axis position with tooltip at the presetter.

Most likely your control uses G43 H_ to enable a tool length offset for a given tool.

After this is done then you can use a method similar to what you laid out in your first post, to establish the difference between the presetter switch and the work Z0 (top of stock). The difference between the presetter height and the stock height then becomes a Z value in the G54 work shift and is a constant for all tools, because all tools are set relative to the presetter.

I think if I were you that I would eliminate the confustion created by the difference in height between your indexer axis and the tool presetter. That is just one extra factor that you don't need to be concerned with except on those occasions when you are actually doing 4th axis work. In that instance, then the G54 Z value is your 28.65 value that you have applied as a constant in your first post.
__________________
First you get good, then you get fast. Then grouchiness sets in.

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

  #7   Ban this user!
Old 01-01-2009, 04:35 PM
 
Join Date: Jan 2007
Location: MI. USA
Posts: 203
CarbideBob is on a distinguished road

First a disclaimer, I've never used Wincnc. However, I do contract cnc program optimization for a big, dumb Giant Manufacturing company so I've worked with all kinds of cnc controls.

In the world of cnc programing there are many different ways to accomplish the same thing. Give ten different programmers the same task and you'll get ten totally different programs.

There are several ways of moving your program zero around. Most programmers get comfortable with one method and stick with it. There is no one "right" way to do it. I'd suggest you pick up a book like "CNC Programming Handbook" by Peter Smid as a good starting point.

G53 is the machines base coordinate system. It's zeros are set by where the machine homes itself. These zeros are known as the machine's reference points. On older machines this is the only coordinate system that the control understands.

A G92 is a coordinate preset command. The X,Y,Z numbers on this command are preset into the controller at the current position.
Think of a readout on a manual machine, a pointer in the spindle, and a 1-2-3 block in your vise. You move the pointer to the left side of your 1-2-3 block and zero the readout. You have preset your X to zero. You could also move your pointer to the right side of the block and preset a 3.00 into the readout giving you the same "0" point in space. This is what a G92 does. Since it "shifts" the zero point this command is known as a coordinate system shift. On early machines this is the only way to create a new zero point. Typically this zero point is defined at some convenient point on the workpiece.

Later on G54..G59 coordinate systems were added. These are known as workpiece coordinate systems. This eliminated the need for G92's and allowed you to set your own coordinate system for your parts. The offset between the machine's (G53) coordinate system and your part program's are stored in a table and you can switch between the differing "zeros" by selecting what coordinate system you are in at any given moment. Once you specify a coordinate system (G53,G54,G55,etc) the machine interprets your X,Y,Z values as being in the selected coordinates until you call up a different system.
In your example you call G53 on the first two lines, The second G53 does nothing as you are already in the G53 system. This is known as a modal command. Once set you stay in this "mode" until an alternate coordinate system is selected.

A G28 is a reference point return command. It's usage is to return the machine to the original "home" position. But if you give a G28 by itself the control doesn't know which axis you want to return so here is where the command gets a little tricky. Early controls used hardwired logic and a letter like "Z" had to be followed by a number.
G28 is technically defined as return to the reference point moving though the point called out on the line. Since we have shifted the coordinates using a G92 we may not know what a "safe" intermediate point is.
This is the reason for the G91. G91 is "incremental mode". This means the axis values specified in the line are incremental distances from where we are.
If you used programmed:
G91 G01 Z1.0 F10
Z1.0
Z1.0
The Z axis would move 1 inch up as each line was executed. Note that G91, G01, F10 are all "modal" commands. Once they are read they stay in effect until you change them.
By using G91 G28 Z0 the intermediate point to move through while returning to the machine's home position is zero distance from where we are. This way we can return to Z home without caring about where we are now. A typical program will use G91 G28 X0 Y0 Z0 in the beginning to return all three axis to the home position when starting.
A program on an older machine would often start like this:
G91 G28 Z0.0 (return Z to Home)
G28 X0.0 Y0.0 (return X and Y to Home)
G90 (absolute programming mode)
G92 X-40.5 Y-23.2 Z12.1 (preset the readout telling the machine that the workpiece zero was -40.5,-23.2, and 12.1 from the home switches)

G90 cancels the G91 and returns the control to absolute programming.
I'd suggest playing with G90 (absolute) and G91 (incremental) modes using G01 moves at slow feedrates (so you can hit the cycle stop before you run into something) to get an understanding of what they do.

Once cncs got tool changers the idea of tool offsets were added to the language. This way you had one programming zero point even though your tools were differing lengths. You would store the difference between the the actual length of the tool and a "zero" length tool in the "H" registers.
Now when you pick up tool# 1 you issue a "G43 H01". This tells the control to add the value in the H01 register to the Z axis values when moving. G43 is tool length plus compensation". A G49 command cancels the tool length compensation. You store the lengths for each tool in a different H register and now you can change tools without having to move your program Z zero to account for differing lengths.

Nowadays most programmers will use G54 to set the workpiece zero in space and the H registers to compensate for different length tools.

I'm sure all the above is clear as mud. It's a lot easier to explain when I'm standing in front of someone and waving my arms around. I usually spend two or three days teaching these concepts to a newcomer.

Read up on cnc programming and play around with some of these commands at very slow machine speeds. Keep you hand on the "Oh-****" button, everyone crashes a machine while learning.
Bob
__________________
You can always spot the pioneers -- They're the ones with the arrows in their backs.

Last edited by CarbideBob; 01-01-2009 at 04:56 PM.
Reply With Quote

  #8   Ban this user!
Old 01-01-2009, 06:14 PM
 
Join Date: Mar 2005
Location: usa
Posts: 214
Harryman is on a distinguished road

Wow, thanks for all the info!

I worked on it for several hours today and made some headway in both getting the mill to respond the way I'd like and in understanding what's going on a bit.

I'm milling jewelry in multiple steps, most things in a combination of flat milling and rotary. Almost everything is done in the rotary one way or another so it's key. Alignment has to be dead on, when I'm milling .75mm prongs from several directions being off a tenth or even a few hundreths of a mm ruins a piece. So, I need to have Z zero exactly on A axis rotation and tool tips have to be at the same zero as well. At least for WinCnc, tool offsets would probably work if I had a tool changer or accurately remountable tools. They're straight shanks with collars and won't mount in precisely the same depth in the collet each time. I'm using 1/8" shank conical cutters with tips in the .005" - .001" range. They tend to break easily too, so I'd be changing and having to keep track of which tool had which offset, which seemed like more effort than it's worth.

I realized G53 was machine coordinates, but didn't realize it was modal, that explains a lot. I can see now I wouldn't need it on the second line.

I didn't realize that all those commands are modal - the fog is beginning to lift. I've been mainly using simple Gcode commands like G0 and G92's to traverse to a point and set zeros before running a program.

In Wincnc: G28 homes all axis, G28Z homes only Z etc. From what I can understand, G91 G28 Z0 is equivalent? It's tells the machine, just go home from here, wherever here happens to be?

Thanks for book idea, I've looked in our local library system for anything on Gcode (you never know) without any luck and all I can find elsewhere is pretty cryptic.

I ended up getting this to work today and it does what I want, but I'd like to get it correct if it seems wacky. (Besides the extra G53, that'll come out..... G0 X276Y125 should work?)

G53 Z0 [Lift Z Head]
G53 X276 Y125 [Move to XY position of tool measure switch]
L91 G0 Z-98 [Move down the rapid distance]
L91 G1 Z-15 M28 F20 G31 [Move down to tool switch]
G92 Z-28.65 [set LZ at TOOL SWITCH HEIGHT]
L90 G0Z65 F800 [Lift Z Head AND RESTORE FEEDRATE]
L92Z [CANCEL G92 RESTORE]
L90 G0X0Y0 [RETURN TO LOCAL XY ZEROS]
__________________
www.harryhamilldesigns.com
CAD sculpting and services
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help!- Tool Setter Macro for M-V60C and Metrol Setter mitshack Mazak, Mitsubishi, Mazatrol 0 10-06-2008 08:39 AM
Need Help!- Tool setter macro for M-V60C and Metrol setter mitshack General CNC (Mill and Lathe) Control Software (NC) 0 10-06-2008 08:38 AM
Depth setter / tool length input? thackman Syil Products 1 06-26-2008 04:08 PM
Tool Setter GARY DAVIS Fadal 6 03-18-2008 07:44 PM
tool setter ACME General Metalwork Discussion 8 07-30-2005 11:15 AM




All times are GMT -5. The time now is 12:09 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361