Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Bob49 on April 13, 2019, 03:33:06 PM

Back when I used Mach3, I used to check the travels in my programs for obvious travel issues with the min/max values mach showed. It was helpful as most of my programs run once only so there's always a bit of anxiety when pushing the go button.
When I moved to Mach4 a few years back I tried using the feature there, but never could get my brain around something in the x, y, z displays. Yesterday I decided to give it another try. Think I've sorted out the values are all in machine coordinates and for X and Y, the math computes to reflect my programs. Z however is way out of range. This morning I took another look and seen that if the Z values were correct in the min/max dro's my mill head would travel below the table by a rather large amount. An example, the last program I checked in the min/max readouts should have showed me a combined z travel of right at 3.9". Instead it reflected a total z travel of over 10". I reloaded a few programs I've already made parts with and I see the same thing. The programs didn't do what the z min/max values say.
If it just reads the program and reflects the values from that, there is a problem I'm not understanding. Is it possible it takes tool changes into account? That's not helpful to me in evaluating a program if that's the case. I can't get the math to work out though if that's the case, and I don't know why the Z tool change position in my M06 macro would be included in those travel values. Anyone use that feature and have an understanding of it?
Regards
Bob

Hi,
the program extents can be seen on the Toolpath tab. They can be displayed in either machine coordinates OR work
coordinates. There is a button to select which.
Check also the Machine Diagnostics tab that the g92, Work Shift, and Head Shift offsets are all, zero.
Craig

Hi Craig,
Thanks for the quick response.
Your pic of the Toolpath tab is exactly where I'm viewing the min/max values as well as the current position in the top dro's. Toggling the machine coordinates on and off only changes the values in the current position x, y and z dro's there. The dro's in the min and max don't change with that toggling. The values in the current x, y and z dro's show the correct position of the head and table with the machine homed to the home/limit switches. And reflect correctly the position in G54 work offset.
In checking the values you mentioned on the diagnostics tab, they are all zero's in those 3 offsets you mentioned. I've never gotten any of the min/max values to toggle between machine coordinates and my work offset. Even so, doing the math on x and y shows the current program travels, just not so with Z ever. It's always wrong.
Regards
Bob

Toggling the machine coordinates on and off only changes the values in the current position x, y and z dro's there. The dro's in the min and max don't change with that toggling.
Regards
Bob
FYI ... same here,
Russ

I don't know how I did it, but now the extents DO show in Machine coords. ? ? ? ? :o
And I cant get it to go back to Program coords.
Standing by ........... curiously interested.
Thanks

Hi,
I've just been experimenting and I find that Current Positions changes between machine coords an work coords
but the Max and Min extents remain in machine coordinates.
Within that limitation (Max and Min in machine coords) all axes (x, Y ,Z) display correctly.
Craig

What would prevent Z from displaying correctly in my use with X and Y displaying correctly? Those values clearly are incorrect in my version of Mach. Wonder if there's a way to get min and max to display in the current offset (G54, etc). It would be a bit easier to confirm the program travels are correct and not have some outlier that might cause a problem. I can deal with all in machine coordinates if that's all that can be had there.
I'm using a licensed version of build 3233 if that has any bearing things.
Thanks
Bob

Hi,
I opened the screen editor to have a look at how the Max and Min DROs are fed. I have attached a pic of the
properties of the Max_X DRO. Note that it is fed directly from a register. There does not appear to be any code
to switch back and forth between the register (machine coordinate) and work coordinates. It would appear to me
therefore that the Max and Min extents can only be displayed as machine coordinate values.
If you wish to have Max and Min work coordinate values it would be simple enough to make another six DRO's
and populate them with the corresponding register value minus the current axis offset, is the work coordinate.
Alternatively you could change the existing DRO's to be driven by a script that does the same thing.
Craig

Hi,
on my installation the Max and Min of all three axes is reading correctly albeit in machine coordinates only.
I can't think of a reason that the Z axis alone would be out of whack excepting a corrupt copy of Mach.
I'm using build 4095 currently.
See my previous post for an idea or two to display a work coordinate Min/Max.
Craig

Hi,
sorry, my reply #7 should have an attachment.....have since edited it to include it.
Craig

Yeah, I see it now. Maybe I'm just not understanding the Z values in the min/max dro's. My thinking I should be able to apply a bit of math like I did on X and Y and match that up with the extremes of my particular program the dro's are analyzing. In one case my Z travel extreme would have been right at 3.9". See the attached pic for what I got as a readout.

There is a G43 Z20 there,
And the z extents are just over 20 .

also, I found that if the program coords overlap the machine coords, the Z pos will show above the home on the Z. If it is homed at z0.00 and all z moves are .

Dang, good catch. I bet I read that line 10 times and read it as 2.0 every time. 2.0 is what it should be so I guess I just expected that when I read it. That's one of the few lines I have to edit on most programs so I fat fingered it.
Thanks for the help, I'll fix that and see what I get.
Regards
Bob

Hi,
if you really want DROs to read in work coordinates, and it seems its only the Z axis which is giving you grief
there is room in the existing DRO block/container for two new DROs, Z_MAX and Z_MIN.
I fiddled around with the screen editor and ended up with these DRO's. Have yet to write the code to drive it....
but first step.
Craig

I corrected the Z20. for H2 in the program. Found my extreme +Z in the program is 3.0, extreme Z is .9127. Total of 3.9127 in my pea brain. Of course that changed the DRO readings and I did the math between the two readings for Z and got exactly 1.5" more than the 3.9127". So I guess I'm still not quite getting it right. I looked for a  or + value in the programmed don't find any other than those I mentioned. The Z3.0 moves are in prep for a tool change, all the g43's then set the new tool at Z2.0. I'll drop the program in this response along with another screen shot fo the dro's.
That might be something worth exploring, getting them to read in work coordinates. The  Z values that are displayed in machine coordinates are a bit confusing.

%
O1000
N1 G49 G54 G80 G40 G90 G94 G17 G98
N2 G20
( TOOL: T2 SPOT DRILL D 0.500 )
N3 T2 M6
( OPERATION: SPOT DRILLING.1 )
N4 G0 X.8125 Y.4375
N5 G43 Z2.0 H2
N6 G1 Z.6 F20.
N7 Z.1 F10.
N8 G81 X.8125 Y.4375 Z.03 R.1 F6.4
N9 G80
N10 G0 Z1.1
N11 Z3.
N12 X0 Y0
( TOOL: T8 3/16" DRILL )
N13 T8 M6
( OPERATION: DRILLING DEEP HOLE.1 )
N14 X.8125 Y.4375
N15 G43 Z2.0 H8
N16 G1 Z.35 F20.
N17 M07
N18 Z.1 F10.
N19 G83 X.8125 Y.4375 Z.8563 R.1 Q.1 F3.84
N20 G80
N21 G0 Z3.
N22 X0 Y0
( TOOL: T11 3/8" DRILL )
N23 T11 M6
( OPERATION: DRILLING.1 )
N24 X.8125 Y.4375
N25 G43 Z2.0 H11
N26 G1 Z.6 F20.
N27 M07
N28 Z.1 F10.
N29 G81 X.8125 Y.4375 Z.9127 R.1 F7.68
N30 G80
N31 G0 Z1.1
N32 M09
N33 Z3.
N34 X0 Y0
( TOOL: 1/4" LONG END MILL )
N35 T17 M6
( OPERATION: PROFILE CONTOURING.1 )
N36 X1.825 Y.1625
N37 G43 Z2.0 H17
N38 M07
N39 G1 Z.1275 F10.
N40 X1.725 F19.2
N41 X1.625
N42 Y.0375
N43 Y.2875
N44 Z.3725 F60.
N45 G0 X1.825 Y.1625
N46 Z.245
N47 G1 Z.255 F10.
N48 X1.725 F19.2
N49 X1.625
N50 Y.0375
N51 Y.2875
N52 Z.245 F60.
N53 G0 X1.825 Y.1625
N54 Z.1175
N55 G1 Z.3825 F10.
N56 X1.725 F19.2
N57 X1.625
N58 Y.0375
N59 Y.2875
N60 Z.1175 F60.
N61 G0 X1.825 Y.1625
N62 G1 Z.01 F10.
N63 Z.51
N64 X1.725 F19.2
N65 X1.625
N66 Y.0375
N67 Y.2875
N68 Z.01 F60.
N69 G0 Z.3725
N70 X1.825 Y.225
N71 G1 Z.1275 F10.
N72 X1.725 F19.2
N73 X1.5625
N74 Y.0375
N75 Y.2875
N76 Z.3725 F60.
N77 G0 X1.825 Y.225
N78 Z.245
N79 G1 Z.255 F10.
N80 X1.725 F19.2
N81 X1.5625
N82 Y.0375
N83 Y.2875
N84 Z.245 F60.
N85 G0 X1.825 Y.225
N86 Z.1175
N87 G1 Z.3825 F10.
N88 X1.725 F19.2
N89 X1.5625
N90 Y.0375
N91 Y.2875
N92 Z.1175 F60.
N93 G0 X1.825 Y.225
N94 G1 Z.01 F10.
N95 Z.51
N96 X1.725 F19.2
N97 X1.5625
N98 Y.0375
N99 Y.2875
N100 Z.01 F60.
N101 G0 Z.3725
N102 X1.825 Y.2875
N103 G1 Z.1275 F10.
N104 X1.725 F19.2
N105 X1.5
N106 Y.0375
N107 Y.2875
N108 Z.3725 F60.
N109 G0 X1.825 Y.2875
N110 Z.245
N111 G1 Z.255 F10.
N112 X1.725 F19.2
N113 X1.5
N114 Y.0375
N115 Y.2875
N116 Z.245 F60.
N117 G0 X1.825 Y.2875
N118 Z.1175
N119 G1 Z.3825 F10.
N120 X1.725 F19.2
N121 X1.5
N122 Y.0375
N123 Y.2875
N124 Z.1175 F60.
N125 G0 X1.825 Y.2875
N126 G1 Z.01 F10.
N127 Z.51
N128 X1.725 F19.2
N129 X1.5
N130 Y.0375
N131 Y.2875
N132 Z.01 F60.
N133 G0 Z.3725
N134 X1.825 Y.35
N135 G1 Z.1275 F10.
N136 X1.725 F19.2
N137 X1.4375
N138 Y.0375
N139 Y.2875
N140 Z.3725 F60.
N141 G0 X1.825 Y.35
N142 Z.245
N143 G1 Z.255 F10.
N144 X1.725 F19.2
N145 X1.4375
N146 Y.0375
N147 Y.2875
N148 Z.245 F60.
N149 G0 X1.825 Y.35
N150 Z.1175
N151 G1 Z.3825 F10.
N152 X1.725 F19.2
N153 X1.4375
N154 Y.0375
N155 Y.2875
N156 Z.1175 F60.
N157 G0 X1.825 Y.35
N158 G1 Z.01 F10.
N159 Z.51
N160 X1.725 F19.2
N161 X1.4375
N162 Y.0375
N163 Y.2875
N164 Z.01 F60.
N165 G0 Z.3725
N166 X1.825 Y.4125
N167 G1 Z.1275 F10.
N168 X1.725 F19.2
N169 X1.375
N170 Y.0375
N171 Y.2875
N172 Z.3725 F60.
N173 G0 X1.825 Y.4125
N174 Z.245
N175 G1 Z.255 F10.
N176 X1.725 F19.2
N177 X1.375
N178 Y.0375
N179 Y.2875
N180 Z.245 F60.
N181 G0 X1.825 Y.4125
N182 Z.1175
N183 G1 Z.3825 F10.
N184 X1.725 F19.2
N185 X1.375
N186 Y.0375
N187 Y.2875
N188 Z.1175 F60.
N189 G0 X1.825 Y.4125
N190 G1 Z.01 F10.
N191 Z.51
N192 X1.725 F19.2
N193 X1.375
N194 Y.0375
N195 Y.2875
N196 Z.01 F60.
N197 G0 Z.3725
N198 X1.825 Y.475
N199 G1 Z.1275 F10.
N200 X1.725 F19.2
N201 X1.3125
N202 Y.0375
N203 Y.2875
N204 Z.3725 F60.
N205 G0 X1.825 Y.475
N206 Z.245
N207 G1 Z.255 F10.
N208 X1.725 F19.2
N209 X1.3125
N210 Y.0375
N211 Y.2875
N212 Z.245 F60.
N213 G0 X1.825 Y.475
N214 Z.1175
N215 G1 Z.3825 F10.
N216 X1.725 F19.2
N217 X1.3125
N218 Y.0375
N219 Y.2875
N220 Z.1175 F60.
N221 G0 X1.825 Y.475
N222 G1 Z.01 F10.
N223 Z.51
N224 X1.725 F19.2
N225 X1.3125
N226 Y.0375
N227 Y.2875
N228 Z.49 F60.
( OPERATION: PROFILE CONTOURING.2 )
N229 G0 X0
N230 Z.3725
N231 M07
N232 G1 Z.1275 F10.
N233 Y.0375 F19.2
N234 Y.1625
N235 X.1
N236 X.125
N237 Z.3725 F60.
N238 G0 X0 Y.2875
N239 Z.245
N240 G1 Z.255 F10.
N241 Y.0375 F19.2
N242 Y.1625
N243 X.1
N244 X.125
N245 Z.245 F60.
N246 G0 X0 Y.2875
N247 Z.1175
N248 G1 Z.3825 F10.
N249 Y.0375 F19.2
N250 Y.1625
N251 X.1
N252 X.125
N253 Z.1175 F60.
N254 G0 X0 Y.2875
N255 G1 Z.01 F10.
N256 Z.51
N257 Y.0375 F19.2
N258 Y.1625
N259 X.1
N260 X.125
N261 Z.01 F60.
N262 G0 Z.3725
N263 X.0625 Y.2875
N264 G1 Z.1275 F10.
N265 Y.0375 F19.2
N266 Y.225
N267 X.1
N268 X.125
N269 Z.3725 F60.
N270 G0 X.0625 Y.2875
N271 Z.245
N272 G1 Z.255 F10.
N273 Y.0375 F19.2
N274 Y.225
N275 X.1
N276 X.125
N277 Z.245 F60.
N278 G0 X.0625 Y.2875
N279 Z.1175
N280 G1 Z.3825 F10.
N281 Y.0375 F19.2
N282 Y.225
N283 X.1
N284 X.125
N285 Z.1175 F60.
N286 G0 X.0625 Y.2875
N287 G1 Z.01 F10.
N288 Z.51
N289 Y.0375 F19.2
N290 Y.225
N291 X.1
N292 X.125
N293 Z.01 F60.
N294 G0 Z.3725
N295 X.125 Y.2875
N296 G1 Z.1275 F10.
N297 Y.0375 F19.2
N298 Y.2875
N299 X.1
N300 X.125
N301 Z.3725 F60.
N302 G0 X.125 Y.2875
N303 Z.245
N304 G1 Z.255 F10.
N305 Y.0375 F19.2
N306 Y.2875
N307 X.1
N308 X.125
N309 Z.245 F60.
N310 G0 X.125 Y.2875
N311 Z.1175
N312 G1 Z.3825 F10.
N313 Y.0375 F19.2
N314 Y.2875
N315 X.1
N316 X.125
N317 Z.1175 F60.
N318 G0 X.125 Y.2875
N319 G1 Z.01 F10.
N320 Z.51
N321 Y.0375 F19.2
N322 Y.2875
N323 X.1
N324 X.125
N325 Z.01 F60.
N326 G0 Z.3725
N327 X.1875 Y.2875
N328 G1 Z.1275 F10.
N329 Y.0375 F19.2
N330 Y.35
N331 X.1
N332 X.125
N333 Z.3725 F60.
N334 G0 X.1875 Y.2875
N335 Z.245
N336 G1 Z.255 F10.
N337 Y.0375 F19.2
N338 Y.35
N339 X.1
N340 X.125
N341 Z.245 F60.
N342 G0 X.1875 Y.2875
N343 Z.1175
N344 G1 Z.3825 F10.
N345 Y.0375 F19.2
N346 Y.35
N347 X.1
N348 X.125
N349 Z.1175 F60.
N350 G0 X.1875 Y.2875
N351 G1 Z.01 F10.
N352 Z.51
N353 Y.0375 F19.2
N354 Y.35
N355 X.1
N356 X.125
N357 Z.01 F60.
N358 G0 Z.3725
N359 X.25 Y.2875
N360 G1 Z.1275 F10.
N361 Y.0375 F19.2
N362 Y.4125
N363 X.1
N364 X.125
N365 Z.3725 F60.
N366 G0 X.25 Y.2875
N367 Z.245
N368 G1 Z.255 F10.
N369 Y.0375 F19.2
N370 Y.4125
N371 X.1
N372 X.125
N373 Z.245 F60.
N374 G0 X.25 Y.2875
N375 Z.1175
N376 G1 Z.3825 F10.
N377 Y.0375 F19.2
N378 Y.4125
N379 X.1
N380 X.125
N381 Z.1175 F60.
N382 G0 X.25 Y.2875
N383 G1 Z.01 F10.
N384 Z.51
N385 Y.0375 F19.2
N386 Y.4125
N387 X.1
N388 X.125
N389 Z.01 F60.
N390 G0 Z.3725
N391 X.3125 Y.2875
N392 G1 Z.1275 F10.
N393 Y.0375 F19.2
N394 Y.475
N395 X.1
N396 X.125
N397 Z.3725 F60.
N398 G0 X.3125 Y.2875
N399 Z.245
N400 G1 Z.255 F10.
N401 Y.0375 F19.2
N402 Y.475
N403 X.1
N404 X.125
N405 Z.245 F60.
N406 G0 X.3125 Y.2875
N407 Z.1175
N408 G1 Z.3825 F10.
N409 Y.0375 F19.2
N410 Y.475
N411 X.1
N412 X.125
N413 Z.1175 F60.
N414 G0 X.3125 Y.2875
N415 G1 Z.01 F10.
N416 Z.51
N417 Y.0375 F19.2
N418 Y.475
N419 X.1
N420 X.125
N421 Z.49 F60.
( OPERATION: PROFILE CONTOURING.3 )
N422 G0 X1.825 Y.465
N423 Z.3725
N424 M07
N425 G1 Z.1275 F10.
N426 X1.725 F19.2
N427 X1.3225
N428 Y.4375
N429 G2 X.3025 Y.4375 I.51 J0
N430 G1 Y.465
N431 X.1
N432 X.125
N433 Z.3725 F60.
N434 G0 X1.825
N435 Z.245
N436 G1 Z.255 F10.
N437 X1.725 F19.2
N438 X1.3225
N439 Y.4375
N440 G2 X.3025 Y.4375 I.51 J0
N441 G1 Y.465
N442 X.1
N443 X.125
N444 Z.245 F60.
N445 G0 X1.825
N446 Z.1175
N447 G1 Z.3825 F10.
N448 X1.725 F19.2
N449 X1.3225
N450 Y.4375
N451 G2 X.3025 Y.4375 I.51 J0
N452 G1 Y.465
N453 X.1
N454 X.125
N455 Z.1175 F60.
N456 G0 X1.825
N457 G1 Z.01 F10.
N458 Z.51
N459 X1.725 F19.2
N460 X1.3225
N461 Y.4375
N462 G2 X.3025 Y.4375 I.51 J0
N463 G1 Y.465
N464 X.1
N465 X.125
N466 Z.01 F60.
N467 G0 Z.3725
N468 X1.825 Y.4963
N469 G1 Z.1275 F10.
N470 X1.725 F19.2
N471 X1.2913
N472 Y.4375
N473 G2 X.3338 Y.4375 I.4788 J0
N474 G1 Y.4963
N475 X.1
N476 X.125
N477 Z.3725 F60.
N478 G0 X1.825
N479 Z.245
N480 G1 Z.255 F10.
N481 X1.725 F19.2
N482 X1.2913
N483 Y.4375
N484 G2 X.3338 Y.4375 I.4788 J0
N485 G1 Y.4963
N486 X.1
N487 X.125
N488 Z.245 F60.
N489 G0 X1.825
N490 Z.1175
N491 G1 Z.3825 F10.
N492 X1.725 F19.2
N493 X1.2913
N494 Y.4375
N495 G2 X.3338 Y.4375 I.4788 J0
N496 G1 Y.4963
N497 X.1
N498 X.125
N499 Z.1175 F60.
N500 G0 X1.825
N501 G1 Z.01 F10.
N502 Z.51
N503 X1.725 F19.2
N504 X1.2913
N505 Y.4375
N506 G2 X.3338 Y.4375 I.4788 J0
N507 G1 Y.4963
N508 X.1
N509 X.125
N510 Z.01 F60.
N511 G0 Z.3725
N512 X1.825 Y.5275
N513 G1 Z.1275 F10.
N514 X1.725 F19.2
N515 X1.275
N516 G3 X1.26 Y.5125 I0 J.015
N517 G1 Y.4375
N518 G2 X.365 Y.4375 I.4475 J0
N519 G1 Y.5125
N520 G3 X.35 Y.5275 I.015 J0
N521 G1 X.1
N522 X.125
N523 Z.3725 F60.
N524 G0 X1.825
N525 Z.245
N526 G1 Z.255 F10.
N527 X1.725 F19.2
N528 X1.275
N529 G3 X1.26 Y.5125 I0 J.015
N530 G1 Y.4375
N531 G2 X.365 Y.4375 I.4475 J0
N532 G1 Y.5125
N533 G3 X.35 Y.5275 I.015 J0
N534 G1 X.1
N535 X.125
N536 Z.245 F60.
N537 G0 X1.825
N538 Z.1175
N539 G1 Z.3825 F10.
N540 X1.725 F19.2
N541 X1.275
N542 G3 X1.26 Y.5125 I0 J.015
N543 G1 Y.4375
N544 G2 X.365 Y.4375 I.4475 J0
N545 G1 Y.5125
N546 G3 X.35 Y.5275 I.015 J0
N547 G1 X.1
N548 X.125
N549 Z.1175 F60.
N550 G0 X1.825
N551 G1 Z.01 F10.
N552 Z.51
N553 X1.725 F19.2
N554 X1.275
N555 G3 X1.26 Y.5125 I0 J.015
N556 G1 Y.4375
N557 G2 X.365 Y.4375 I.4475 J0
N558 G1 Y.5125
N559 G3 X.35 Y.5275 I.015 J0
N560 G1 X.1
N561 X.125
N562 Z.49 F60.
( OPERATION: PROFILE CONTOURING.4 )
N563 G0 X1.825 Y.4875
N564 Z.3725
N565 M07
N566 G1 Z.1275 F10.
N567 X1.725 F19.2
N568 X1.3
N569 Y.4375
N570 G2 X.325 Y.4375 I.4875 J0
N571 G1 Y.4875
N572 X.1
N573 X.125
N574 Z.4725 F60.
N575 G0 X1.825
N576 Z.345
N577 G1 Z.255 F10.
N578 X1.725 F19.2
N579 X1.3
N580 Y.4375
N581 G2 X.325 Y.4375 I.4875 J0
N582 G1 Y.4875
N583 X.1
N584 X.125
N585 Z.345 F60.
N586 G0 X1.825
N587 Z.2175
N588 G1 Z.3825 F10.
N589 X1.725 F19.2
N590 X1.3
N591 Y.4375
N592 G2 X.325 Y.4375 I.4875 J0
N593 G1 Y.4875
N594 X.1
N595 X.125
N596 Z.2175 F60.
N597 G0 X1.825
N598 Z.09
N599 G1 Z.51 F10.
N600 X1.725 F19.2
N601 X1.3
N602 Y.4375
N603 G2 X.325 Y.4375 I.4875 J0
N604 G1 Y.4875
N605 X.1
N606 X.125
N607 Z.15 F60.
N608 G0 X1.825 Y.5375
N609 G1 Z.51 F10.
N610 X1.725 F19.2
N611 X1.275
N612 G3 X1.25 Y.5125 I0 J.025
N613 G1 Y.4375
N614 G2 X.375 Y.4375 I.4375 J0
N615 G1 Y.5125
N616 G3 X.35 Y.5375 I.025 J0
N617 G1 X.1
N618 X.125
N619 Z.49 F60.
( OPERATION: PROFILE CONTOURING.5 )
N620 G0 X.1438 Y.4125
N621 Z.3725
N622 M07
N623 G1 Z.1275 F10.
N624 Y.6625 F19.2
N625 Y.8125
N626 G2 X.0625 Y1.0188 I.2063 J0
N627 G1 X1.5625
N628 G2 X1.7688 Y.8125 I0 J.2063
N629 G1 Y.6625
N630 Y.4125
N631 Z.4725 F60.
N632 G0 X.1438
N633 Z.345
N634 G1 Z.255 F10.
N635 Y.6625 F19.2
N636 Y.8125
N637 G2 X.0625 Y1.0188 I.2063 J0
N638 G1 X1.5625
N639 G2 X1.7688 Y.8125 I0 J.2063
N640 G1 Y.6625
N641 Y.4125
N642 Z.345 F60.
N643 G0 X.1438
N644 Z.2175
N645 G1 Z.3825 F10.
N646 Y.6625 F19.2
N647 Y.8125
N648 G2 X.0625 Y1.0188 I.2063 J0
N649 G1 X1.5625
N650 G2 X1.7688 Y.8125 I0 J.2063
N651 G1 Y.6625
N652 Y.4125
N653 Z.2175 F60.
N654 G0 X.1438
N655 Z.09
N656 G1 Z.51 F10.
N657 Y.6625 F19.2
N658 Y.8125
N659 G2 X.0625 Y1.0188 I.2063 J0
N660 G1 X1.5625
N661 G2 X1.7688 Y.8125 I0 J.2063
N662 G1 Y.6625
N663 Y.4125
N664 Z.15 F60.
N665 G0 Z.4725
N666 X.1125
N667 G1 Z.1275 F10.
N668 Y.6625 F19.2
N669 Y.8125
N670 G2 X.0625 Y.9875 I.175 J0
N671 G1 X1.5625
N672 G2 X1.7375 Y.8125 I0 J.175
N673 G1 Y.6625
N674 Y.4125
N675 Z.4725 F60.
N676 G0 X.1125
N677 Z.345
N678 G1 Z.255 F10.
N679 Y.6625 F19.2
N680 Y.8125
N681 G2 X.0625 Y.9875 I.175 J0
N682 G1 X1.5625
N683 G2 X1.7375 Y.8125 I0 J.175
N684 G1 Y.6625
N685 Y.4125
N686 Z.345 F60.
N687 G0 X.1125
N688 Z.2175
N689 G1 Z.3825 F10.
N690 Y.6625 F19.2
N691 Y.8125
N692 G2 X.0625 Y.9875 I.175 J0
N693 G1 X1.5625
N694 G2 X1.7375 Y.8125 I0 J.175
N695 G1 Y.6625
N696 Y.4125
N697 Z.2175 F60.
N698 G0 X.1125
N699 Z.09
N700 G1 Z.51 F10.
N701 Y.6625 F19.2
N702 Y.8125
N703 G2 X.0625 Y.9875 I.175 J0
N704 G1 X1.5625
N705 G2 X1.7375 Y.8125 I0 J.175
N706 G1 Y.6625
N707 Y.4125
N708 Z.15 F60.
N709 G0 X.0625
N710 G1 Z.51 F10.
N711 Y.6625 F19.2
N712 Y.8125
N713 G2 X.0625 Y.9375 I.125 J0
N714 G1 X1.5625
N715 G2 X1.6875 Y.8125 I0 J.125
N716 G1 Y.6625
N717 Y.4125
N718 Z3.0 F60.
N719 M09
N720 M30
%

Hi,
OK, I have some code to drive the two new DROs in work coordinates.
First you need to make two new instance registers iRegs0/workZMax and iRegs0/workZMin, attached
The two DRO's need their driving register set in the DRO properties, I've shown Z_Min, attached
And then this code needs to go in the PLC script:
*****************************************************************************
local zOffset=mc.mcCntlGetOffset(inst,mc.Z_AXIS,mc.MC_OFFSET_FIXTURE)
local workZMaxHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmax')
local workZMax=mc.mcRegGetValue(workZMaxHandle)zOffset
local workZMaxHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMax')
mc.mcRegSetValue(workZMaxHandle,workZMax)
local workZMinHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmin')
local workZMin=mc.mcRegGetValue(workZMinHandle)zOffset
local workZMinHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMin')
mc.mcRegSetValue(workZMinHandle,workZMin)
**********************************************************************************
Pretty quick and dirty code but it seems to work.
Craig

That's awesome Craig, you're pretty quick with that code. I barely understand that stuff. Going to take your work there and give it a go on my system. Been a a couple years since I messed with the code behind Mach, but I've been in it before for my console. I'm recalling the PLC script being different than the screen script so not intimidated too much by it.
I was actually looking at the properties of the two Z dro's in the screen editor earlier and think I know exactly where those are there.
Thanks
Bob

I corrected the Z20. for H2 in the program. Found my extreme +Z in the program is 3.0, extreme Z is .9127. Total of 3.9127 in my pea brain. Of course that changed the DRO readings and I did the math between the two readings for Z and got exactly 1.5" more than the 3.9127". So I guess I'm still not quite getting it right. I looked for a  or + value in the programmed don't find any other than those I mentioned. The Z3.0 moves are in prep for a tool change, all the g43's then set the new tool at Z2.0. I'll drop the program in this response along with another screen shot fo the dro's.
That might be something worth exploring, getting them to read in work coordinates. The  Z values that are displayed in machine coordinates are a bit confusing.
Hi Bob, just curious as to how you are referencing your Z axis, and what your G54 Z offset is for this part prgm. Your file does go to +Z3, mach coords,which is strange. Are you homing somewhere other thant Z all the way up ? Typically, no mach coord Z should be positive. In my limited experience :)

Hi,
because the PLC script runs every 50ms (default) the code needs to be pretty quick and slick otherwise
it will block the rest of Mach.
For this reason the code I posted is pretty lean but at the same time detailed enough to make it readable.
Note these lines:
local workZMaxHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmax')
local workZMax=mc.mcRegGetValue(workZMaxHandle)zOffset
local workZMaxHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMax')
Note that I have redefined the variable workZMaxHandle, first I used it to address the core register PathZmax
and then redefined it to address the instance register iRegs0/workZMax. I did this so the one variable is reused.
Note that I did it a second time with workZMinHandle. On the one hand it reduces the number of variables
that Lua has to keep a track of but on the other hand can be confusing for someone else to read.
If I were writing this code for myself I would streamline it even further, albeit at the expense of readability.
local zOffset=mc.mcCntlGetOffset(inst,mc.Z_AXIS,mc.MC_OFFSET_FIXTURE)
local regHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmax')
local MaxMin=mc.mcRegGetValue(regHandle)zOffset
regHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMax')
mc.mcRegSetValue(regHandle,MaxMin)
regHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmin')
MaxMin=mc.mcRegGetValue(regHandle)zOffset
regHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMin')
mc.mcRegSetValue(regHandle,MaxMin)
Here I reduced the number of variables to three, zOffset, regHandle, and MaxMin, with the last two being recycled at need.
Not as readable but will run a little faster.
Craig

I home off the limit switch at the top of my mill's column, then move down from there and set my G54 off the top of my part held in the vice in this case. I use tool height offsets, hence the G43's in the program. I use tool #1 for indicating all 3 axis for part zero. That's the only use for tool #1. I always hit the home/limit switches at startup, move to the middle of my mills travels and do a tool change to tool one. In my M06 macro i have a Z move that raises the mill head up 4" below the limit switch and change tools. For the first tool change of the day it's just a M06 to tool #1, no G43. Then I toggle tool height on in the offset panel and go to finding zero's for my part. After that it's M06 tool changes with G43's.
I can actually hit the home/limit switches and repeat within a couple tenths of my indicated zeros most times unless I get swarf on the triggers that bump the switches, mostly only a problem on Y. Z never has that problem and X rarely.
So after that, all upward Z moves are positive.
Regards
Bob

Hi Craig,
Been out trying to figure all this stuff out and get some working Z dro's for the work offset. And I got them working after I fumbled around trying to find the registers to create those two.
And they seem to work. I'll swap the code out yet tonight to your's below.
But I got one more question. In my pea brain, I'm thinking the Z max value should reflect the highest Z+ value unless the current tool has exceeded that position. Then whatever the tool is above the highest Z+ value in the program would be added to the highest Z+ value. Am I thinking wrong? The Z max value just continues to change even with the tool point inside the Z values in the program. That's not making sense to me as I never get a hard value for Z max but I do for Z min. Z min always reflects what the lowest Z value in the program is. So likewise I think if the tool exceeded the lowest Z value in the program, that value would then change to reflect that until it came back in the Z range the program reflects. Does this even make sense?
Regards
Bob

Hi,
the code I posted calculates the work coordinate maximum as the machine coordinate maximum minus the current
axis offset. The line of code that does the calculation is:
local MaxMin=mc.mcRegGetValue(regHandle)zOffset
And the variable zOffset is defined:
zOffset=mc.mcCntlGetOffset(inst,mc.Z_AXIS,mc.MC_OFFSET_FIXTURE)
But note that the zOffset variable does not include tool offset. I'm less sure about g92 and head offsets.
I guess the way is to experiment by substituting values into the Z axis machine diagnostics page and see what happens
to the output. My inclination is for the ZMax and ZMin be in work coordinates but WITHOUT any tool length offset.
That may or may not make sense to you. If it does not then by all means substract the current tool length from
MaxMin variable as you desire.
This is Machs great strength, you can modify it to suit your expectation.
Craig

Hi,
a little experimentation shows that variable MaxMin is not affected by g92, Head offset, Work Offset or Tool Offset.
If you wish those to be included then the calculation will need those additional terms.
Craig

Hi Craig
"My inclination is for the ZMax and ZMin be in work coordinates but WITHOUT any tool length offset."
That's how I think it should work. When I was messing with it earlier I wasn't seeing tool height values in the differences I was getting. But that did occur to me that I might find that.
I've given up for the evening, plan to mess around more with it tomorrow. It's one of those things I'd like to use in Mach that I just ignored not understanding what it was telling me. Probably come back and re read all this in the morning before heading to the shop. But experimenting with stuff is right down my alley.
Thanks for the help and the code, I enjoyed doing that in spite of not really knowing for sure what I was doing. Might have more question though.
Regards
Bob

I home off the limit switch at the top of my mill's column, then move down from there and set my G54 off the top of my part held in the vice in this case.
So after that, all upward Z moves are positive.
Regards
Bob
OK. that is "typical", I do the same here.
As you say, "all upward Z moves are positive" … in your WORK coordinates. But in Machine coordinates you cannot go above Z0.00.
The Z Max extents dro shows Z+3" … in MACHINE coordinates.
I don't see how that is possible. Why would that NOT throw a soft limit warning ?
Home the Z at the top.
Z neg to the material 2" and zero the G54 z offset.
Now run the part which has a 3" z+ and it will crash as it will go 1" zpos in machine cords. and shows this in the extents dro z max.
Now, come down 4" instead to set the z offset and the entire 3" of z travel is well within the z Machine cords and shows so in the Z extent dros as they are both NEG.
Guys, please help me get around this understanding, and I'll go back to lurking. :)
thanks

I don't use soft limits, and have about 20" of Z travel if the vise is removed. Maybe less, spindle end to table that is. Insert a tool and it's reduced of course. So at the Z home switch, from the tool tip to the part is maybe 12", just a guess here right now as I wasn't paying much attention to that today. Plenty of room to move around.
I've not worked all that out on the min/max travels dro's yet. That's my goal for tomorrow, come to a good understanding of that those dro's are telling me. And quit ignoring them as I know they can be helpful.
Regards
Bob

Thanks Bob.
Something definitely weird going on there.
I put your example file here at 4" Z work offset from home.
All looks normal here.
Hope you don't mind the interrupt, I'm just trying to keep up ;)
Cheers,
Russ

Don't mind at all, always trying to learn. Keep in mind the two shots I showed of that panel I set the coordinates as work coordinates, not machine coordinates. So the Z3.00 in the "current" dro's was 3" above my part in the vise. And I didn't have tool #2 in the spindle, I still had tool #1 loaded with it's tool height offset active. Think there's just under 1.5" difference between the two with tool #2 being shorter. Sorry I forgot to mention that prior.
Tomorrow I'm going through my startup and then will load tool #2 and see what I see on the min/max dro's. That way I won't have to do any math due to the different tools. But that shouldn't have any bearing on the Z totals if I'm at or below Z3.0 in my work offset. At least that's what I'm hoping.
Regards
Bob

Finally got out in the shop to play around again. Did my usual startup routine, changed to tool #1, found x0, y0 and z0. Changed to tool #2, first one in that program, and applied a g43 to it. Brought it down to Z3.0 and the difference was what I expected it to be, take off the tool height for that tool and there's the z+ travel of the program.
And why my brain wasn't working well with this last night was due to the fact tool #1 was in the spindle with it's tool height applied. Tool #1 isn't in the program. If I'd have taken the tool out and left the spindle with no tool, it would have worked moving the spindle end at least to Z3.0 or below in my G54 offset. That didn't dawn on me then.
That all didn't dawn on me till late last night. Once it did things got clearer. And today things worked like I thought they would. So I think the main reason the Z max has never made sense to me is I must have been thinking tool height was accounted for in that reading. Never once did I subtract the current tool height to see what the reading would be.
Once again, I want to thank Craig for taking time out of his life to help me with this and putting that code together. And thanks to the rest of you for the comments and things that got me to thinking on what I was struggling with. I might try at some point to see if I can get the tool height applied to the Z max value, let Mach do the math for me there. I'll have to study on doing that though. I got no clue right now how to put that code in the script.
Thanks to all again
Bob

Hi,
easy, I added a toggle button to the DRO block. With ToolLegthComp ON (green and blinking) tool length
is compensated, ie subtracted from zOffset. Note the button is connected to Output#63
Then in the PLC script tests the state of Output#63 and compensate or not as the case may be.
*****************************************************************************
local zOffset=mc.mcCntlGetOffset(inst,mc.Z_AXIS,mc.MC_OFFSET_FIXTURE)
local toolCompHandle=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT63)
local toolComp=mc.mcSignalGetState(toolCompHandle)
local toolNum=mc.mcToolGetCurrent(inst)
local toolLength=mc.mcToolGetData(inst,mc.MTOOL_MILL_HEIGHT,toolNum)
if (toolComp==0) then
zOffset=zOffsettoolLength
end
local workZMaxHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmax')
local workZMax=mc.mcRegGetValue(workZMaxHandle)zOffset
local workZMaxHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMax')
mc.mcRegSetValue(workZMaxHandle,workZMax)
local workZMinHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmin')
local workZMin=mc.mcRegGetValue(workZMinHandle)zOffset
local workZMinHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMin')
mc.mcRegSetValue(workZMinHandle,workZMin)
**********************************************************************************
Note that I don't use tool lengths so it may be that the compensation is applied wrongly, ie negatively whereas
your expectation is for positive compensation. Please test it before use.
Craig

Got that new code in the PLC and fought with my pc a while. Had to restore Mach to yesterdays config to get Mach to launch. Must have done something I wasn't aware of but it's going again.
Followed your lead and made the button and added the text. Dropped in the code and gave it a try. I had to change the minus to a plus as the math was adding the tool height instead of subtracting it. New math I guess. But then I found the tool height was getting added to the z min while subtracting form the z max. Kinda guessed that might happen with only one identifier for both readings.
So I knew I needed a different identifier for the z max value being fed to the dro. You can see what I ended up with in the attached code. Only one caveat remains and that is the tool needs to be at the highest programed Z value to read Z max correctly. Otherwise it changes with the tool position even if it's below the highest programmed Z. Hope that makes sense.
Thanks for the help once again Craig
Regards
Bob
local zOffset=mc.mcCntlGetOffset(inst,mc.Z_AXIS,mc.MC_OFFSET_FIXTURE)
local toolCompHandle=mc.mcSignalGetHandle(inst,mc.OSIG_OUTPUT63)
local toolComp=mc.mcSignalGetState(toolCompHandle)
local toolNum=mc.mcToolGetCurrent(inst)
local toolLength=mc.mcToolGetData(inst,mc.MTOOL_MILL_HEIGHT,toolNum)
local zMaxOffset=zOffset
if (toolComp==0) then
zMaxOffset=zOffset+toolLength
end
local workZMaxHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmax')
local workZMax=mc.mcRegGetValue(workZMaxHandle)zMaxOffset
local workZMaxHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMax')
mc.mcRegSetValue(workZMaxHandle,workZMax)
local workZMinHandle=mc.mcRegGetHandle(inst,'core/inst/PathZmin')
local workZMin=mc.mcRegGetValue(workZMinHandle)zOffset
local workZMinHandle=mc.mcRegGetHandle(inst,'iRegs0/workZMin')
mc.mcRegSetValue(workZMinHandle,workZMin)

Hi Bob,
kool.
By far and away the greatest strength of Mach4 is its ability to be customized. This is a fairly simple example of that strength.
I get a personal sense of satisfaction about programming some new behavior that suits my work flow and that satisfaction
is the best incentive to learn new stuff to extend the boundaries.
Craig