Hello Guest it is April 26, 2024, 08:15:41 AM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - joeaverage

Pages: « 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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 »
3041
Hi,
it was always, and still is true that Mach3's parallel port cannot run with ANY 64 bit OS.

So normal Windows 10 being 64 bit it out. I have seen no positive declaration by NFS but there has been discussion as to
whether Windows 10 32 bit will work.

This is one of the more recent posts on the subject:

https://www.machsupport.com/forum/index.php?topic=39211.msg263546#msg263546

ger21 is a very experienced operator and he is of the opinion that Windows 10 (32 bit or not) wont work.

This is another recent post and it looks like Tweakie actually tried it:

https://www.machsupport.com/forum/index.php?topic=39489.msg265120#msg265120

So if your PC has an X64 processor you are out of luck.

Can you post a screen shot of DriverTest.exe?
Does your breakout board have a charge pump input?

You may have noticed that probably half or more of all Mache users have stepped up to an external motion controller
like a UC300 or an Ethernet SmoothStepper, they work rather more reliably than a parallel port. Avoid Chinese made stuff,
it tends not to work properly and they wont help you.

Craig

3042
Mach4 General Discussion / Re: touch probeing
« on: February 24, 2019, 06:11:06 PM »
Hi,
what motion controller are you using?

When Mach executes a G31 probing move the motion controller detects the probe touch event and stops all motion.
Motion controllers are very fast so unless you are approaching at a ridiculous seed there should little or no
overrun.

For example I have an ESS motion controller and when probing at 100 mm/min (no fast but not really slow either) the
overrun is less than 1 um (0.78um).

It sounds to me like the probing code you are using is relying on Mach to detect the probe event. In that case the motion
controller will propagate a signal back to Mach, Mach will generate a stop signal and send it back to the motion controller
to execute. The 'around the loop delay' could easily be 1/20 sec whereas a good motion controller will detect and stop
motion within a few tens of micro seconds.

What code are you using to probe?

Craig

3043
Hi,
I have gone through m6 and regrouped, I hope it might help you.

The main thing I have done is break m6 into several files, the m6() proper, releaseTool(), getTool() and setToolDepth().

Note that I have deliberately reduced the leading letter of each function to lowercase per smurph's recommendation. In truth
the interpreter will reduce subsequent characters to lowercase also but I have retained capitalization of some letters to maintain
readability.

The second thing I have done is on every occasion where a mcCntlGcodeExecuteWait() is called I have tested the return code to ensure
that the function completed. Should it not do so you get a wxMessageBox notification including a number that will help you identify
any particular call which failed and a second number corresponding to the MERROR.

It maybe that once you have worked out how to get all this code to work that you can either delete or comment out
all (24 or so) diagnostic statement groups.....but for the moment they will highlight any errors.

I have bundled the module load statement in m6.

Note also that ALL four files need to be saved in the Macros folder of your current profile.

Save as m6.mcs
Code: [Select]
function  m6()
local ZGageBlockHeight = 3.3091
local inst = mc.mcGetInstance()
package.path = wx.wxGetCwd() .. "\\Profiles\\AXYZ\\Modules\\?.lua;"
if(package.loaded.ToolChangePositions == nil) then
tcp = require "ToolChangePositions"
end
    local SelectedTool = mc.mcToolGetSelected(inst)
    local CurrentTool = mc.mcToolGetCurrent(inst)
    local rc=mc.mcCntlGcodeExecuteWait(inst, "m5\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 1 MERROR="..tostring(rc))
do return end
end
local CurFeed = mc.mcCntlGetPoundVar(inst, 2134)
    local CurFeedMode = mc.mcCntlGetPoundVar(inst, 4001)
    local CurAbsMode = mc.mcCntlGetPoundVar(inst, 4003)
    local ToolData = tcp.GetToolData(CurrentTool)
    if (ToolData ~= nil) then
        Num1 = ToolData.Tool_Number
        XPos1 = ToolData.X_Position
        YPos1 = ToolData.Y_Position
        ZPos1 = ToolData.Z_Position
    else
        mc.mcCntlEStop(inst)
        mc.mcCntlSetLastError(inst, "ERROR: Tool number out of range!")
        do return end
    end
    local ToolData = tcp.GetToolData(SelectedTool)
    if (ToolData ~= nil) then
        Num2 = ToolData.Tool_Number
        XPos2 = ToolData.X_Position
        YPos2 = ToolData.Y_Position
        ZPos2 = ToolData.Z_Position
    else
mc.mcCntlEStop(inst)
        mc.mcCntlSetLastError(inst, "ERROR: Tool number out of range!")
        do return end
    end
    local GCode = ""
    GCode = GCode .. "G00 G90 G53 Z0\n"
    GCode = GCode .. string.format("G00 G90 G53 X%.4f Y%.4f\n", XPos1, YPos1)
    local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 2 MERROR="..tostring(rc))
do return end
end
GCode = ""
    GCode = GCode .. string.format("G00 G90 G53 Z%.4f\n", ZPos1)
    local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 3 MERROR="..tostring(rc))
do return end
end
    ------ Release the current tool ------
    releaseTool(CurrentTool)
    ------ Move to next tool change position ------
    GCode = ""
    GCode = GCode .. string.format("G00 G90 G53 X%.4f Y%.4f\n", XPos2 + 2, YPos2)
    local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 4 MERROR="..tostring(rc))
do return end
end
    ------ Get the new tool ------
    getTool(SelectedTool)
    ------ Set Tool Depth ------
    setToolDepth()
    ------ Move Z to home position ------
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z0\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 5 MERROR="..tostring(rc))
do return end
end
    ------ Reset state ------
    mc.mcCntlSetPoundVar(inst, 2134, CurFeed)
    mc.mcCntlSetPoundVar(inst, 4001, CurFeedMode)
    mc.mcCntlSetPoundVar(inst, 4003, CurAbsMode)
    ------ Set new tool ------
    mc.mcToolSetCurrent(inst, SelectedTool)
    CurrentTool = mc.mcToolGetCurrent(inst)
    mc.mcCntlSetLastError(inst, string.format("Tool changed, now using tool: %.0f", CurrentTool))
end
if (mc.mcInEditor() == 1) then
m6()
end

Save as releaseTool.mcs
Code: [Select]
function releaseTool(CurrentTool)
local inst=mc.mcGetInstance()
    -- Set special casses
    if(CurrentTool == 7) then
        ------ Lower to drop off position ------
        local GCode = ""
        GCode = GCode .. "G00 G53 x36 Y2\n"
        GCode = GCode .. "G00 G53 x39.6 Y2\n"
        GCode = GCode .. "G00 G53 z-6.11\n"
        GCode = GCode .. "G01 G91 Y-2 F100\n"
        local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 6 MERROR="..tostring(rc))
do return end
end
    else
        ------ Lower to drop off position ------
        local rc=mc.mcCntlGcodeExecuteWait(inst, "G01 G91 X2 F100\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 7 MERROR="..tostring(rc))
do return end
end
    end
    ----- Open Drawbar ------
    local DrawbarOPEN = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
    mc.mcSignalSetState(DrawbarOPEN, 1)
    ------ Move to Clear position turn off drawbar------
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G91 Z.75\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 8 MERROR="..tostring(rc))
do return end
end
    mc.mcSignalSetState(DrawbarOPEN, 0)   
    ------ Close Drawbar ------
    local DrawbarCLOSE = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
    mc.mcSignalSetState(DrawbarCLOSE, 1)
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G04 P200\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 9 MERROR="..tostring(rc))
do return end
end
    mc.mcSignalSetState(DrawbarCLOSE, 0)
    ------ Move to clear tool position ------
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G90 G53 Z-3.0")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 10 MERROR="..tostring(rc))
do return end
end
end
if (mc.mcInEditor()==1)then
releaseTool()
end

Save as getTool.mcs
Code: [Select]
function getTool(SelectedTool)
local inst=mc.mcGetInstance()
    ------ Lower to blow off start position ------
    if(SelectedTool == 7) then -- Set special casses
        ------ Lower to drop off position ------
        local GCode = ""
        GCode = GCode .. "G00 G53 x39.6\n"
        GCode = GCode .. "G00 G91 Y-2.75\n"
        local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 11 MERROR="..tostring(rc))
do return end
end
    end
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G91 Z-1.75\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 12 MERROR="..tostring(rc))
do return end
end
   
    ------ Turn on Blow off  ------
    local BlowOff = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT0)
    mc.mcSignalSetState(BlowOff, 1)
    ------ Lower to pick up start position shut off blow off, turn on drawbar------
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G91 Z-1\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 13 MERROR="..tostring(rc))
do return end
end
    mc.mcSignalSetState(BlowOff, 0)
    local DrawbarOPEN = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT1)
    mc.mcSignalSetState(DrawbarOPEN, 1)
    ------ Move to pickup position position ------
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G91 Z-.5\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 14 MERROR="..tostring(rc))
do return end
end
    ------ Turn off  open drawbar ------
    mc.mcSignalSetState(DrawbarOPEN, 0)
    ------ Close Drawbar ------
    local DrawbarCLOSE = mc.mcSignalGetHandle(inst, mc.OSIG_OUTPUT2)
    mc.mcSignalSetState(DrawbarCLOSE, 1)
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G91 Z.2\n")
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 15 MERROR="..tostring(rc))
do return end
end
    ------ Stop Closing drawbar ------
    mc.mcSignalSetState(DrawbarCLOSE, 0)
    ------ Move to final tool change position ------
    local GCode = ""
        if(SelectedTool == 7) then
        GCode = GCode .. "G01 G91 Y2 F100\n" -- Clear fork
        GCode = GCode .. "G00 G90 G53 Z0\n" -- Go up
    else
        GCode = GCode .. "G01 G91 X-2 F100\n" -- clear fork
        GCode = GCode .. "G00 G90 G53 Z0\n" -- Go up
        GCode = GCode .. "G00 G53 X33 Y2.75\n" -- Go to clear position read to measure       
    end
    local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 16 MERROR="..tostring(rc))
do return end
end
end
if (mc.mcInEditor()==1)then
getTool()
end

Save as setToolDepth.mcs
Code: [Select]
function setToolDepth()
local inst=mc.mcGetInstance()
local ZGageBlockHeight = 3.3091
    ------ Auto Depth Setting ------ 
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G00 G53 X35.93 Y2.75\n") -- go to point over depth setter
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 17 MERROR="..tostring(rc))
do return end
end
    local rc=mc.mcCntlSetLastError(inst, 'Setting Tool Height')
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 18 MERROR="..tostring(rc))
do return end
end
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-4 F50") --probe the new tool
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 19 MERROR="..tostring(rc))
do return end
end
    local rc=mc.mcCntlGcodeExecuteWait(inst, "G91 G0 Z+0.1") --Retract from the probe
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 20 MERROR="..tostring(rc))
do return end
end
local rc=mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-0.15 F5") --Probes at slow speed
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 21 MERROR="..tostring(rc))
do return end
end
local measure_1 = mc.mcAxisGetPos(inst,2) --Saves probed Z position

local rc=mc.mcCntlGcodeExecuteWait(inst, "G91 G0 Z+0.1") --Retracts from the probe
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 22 MERROR="..tostring(rc))
do return end
end
local rc=mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-0.15 F5") --Probes at slow speed
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 23 MERROR="..tostring(rc))
do return end
end
local measure_2 = mc.mcAxisGetPos(inst,2) --Saves probed Z position
   
local measured_average = (measure_1 + measure_2)/2 --Averages two probed values
    local offSet = measure_2 - measured_average
local adjustedHeight = ZGageBlockHeight + offSet

    mc.mcAxisSetPos(inst,2,adjustedHeight) --Sets current Z postion to gage block height with measured offset

GCode = ""
    GCode = GCode .. "G00 G90 G53 Z0\n" --Retract
    GCode = GCode .. "G00 G53 X33 Y2.75\n" -- Move to clear spot
    local rc=mc.mcCntlGcodeExecuteWait(inst, GCode)
if rc~=0 then
wx.wxMessageBox("mcCntlGcodeExecuteWait() did not progress 24 MERROR="..tostring(rc))
do return end
end
end
if (mc.mcInEditor()==1)then
setToolDepth()
end

Scan the code and see what you think. Note that M1000() occurs nowhere. Should you want to call setToolDepth() from
from the main Gcode job, not m6, but the main program, THEN use m1000 and create a function m1000() in your Macros
folder that explicitly calls setToolDepth(). In this way setToolDepth() will exist as only one file but may be called by different
procedures.

Craig

 

3044
Hi,
I have no doubt m1000() works but m6 doesn't call it.

I don't really want to put buggy code into my setup....I may try later today.

Run m6 (lowercase) and see if m1000() is called?.
Is SetDepth() then called?.....whether you use wxMessabe Box or some other method matter less than if you call
m6 then eventually SetDepth() should be called. You need to test the machine state at the time of
the mc.CntlGcodeExecuteWait() call.

Craig

3045
Mach4 General Discussion / Re: Mach4 MPG axis stop after inc steps overflow
« on: February 23, 2019, 09:01:29 PM »
Hi,
just had the thought if you used the mcMotionClearPlanner() it may be that the DRO would no longer be accurate.

The DRO advances 1mm at each click (assuming the current jog increment is 1mm) and if an extra 20 clicks were in the
buffer when the mcMotionClearPlanner() instruction came along the axis would cease to move but I suspect the DRO would
still show where it was supposed to be....not ideal.

Craig

3046
Mach4 General Discussion / Re: Mach4 MPG axis stop after inc steps overflow
« on: February 23, 2019, 08:56:50 PM »
Hi,
there are two jogging modes, Step and Continuous.

What you have described is the behavior of Mach when jogging in Step mode.

Each click of the MPG causes a move instruction to be appended to the motion buffer. Each click will move the current
axis one 'jog increment' whatever the current jog increment is at the current time. If the succession of move instructions
exceeds the jog rate the instructions stack up in the buffer. Even when the MPG is stopped movement will continue until
the buffer is empty. This is normal behavior.

The only way you can stop the motion controller from completing its task is to EStop.

There may be another alternative, I haven't tried it, this API is really meant for probing routines but may none the less offer
you away to 'cheat' Mach4:

Quote
LUA Syntax:
rc = mc.mcMotionClearPlanner(
      number mInst)

Description:
Clears the motion planner of all previously planned moves.

What I am suggesting is that if you had some timer arrangement that detected that the MPG had ceased producing pulses
for say half a second then you could issue a mc.mcMotionClearPlanner instruction.

That may offer a way to prevent overrun in Step jog mode but perhaps you should experiment more with Continuous jog
mode.

This is from "Mill Operations Guide" in your Docs folder, page 23:

Quote
There are 2 basic jog modes which are selectable by pressing the “Jog Mode” button. The current selection will be indicated by an LED. Figure 3-5 shows the continuous mode selected. In continuous mode the machine will move at the specified jog rate as long as a jog button is held down. The jog rate can be changed by moving the slider at the bottom of the jogging tab or by directly typing the desired rate into the DRO in the bottom right corner. The number shown in the DRO is a percentage of the max velocity, or rapid rate, of the machine. Continuous mode is useful for moving the machine relatively large distances and rough positioning. When finding the edge of a work piece, locating a hole, or other precision position is required, step jog is much more accurate. In step jog, the machine moves only by the specified increment amount, regardless of how long the jog button is held down. The jog increment can be changed by pressing the “Cycle Jog Inc” button. This button will change the DRO to the right of it to show the current increment amount. The increment values can be changed on the General tab in the Mach configuration.

Thus in Continuous mode if you release the jog button the axis stops immediately. What happens when supplied by an MPG signal
however? My pendant (VistaCNC P1A) when in Velocity mode (same as Continuous mode) if you turn the MPG wheel fast enough
the axis moves at the current jog rate. If you slow down or stop the axis also stops. I recall when I set it up there was a setting
somewhere that allowed me to program how fast that threshold was.....can't remember where just at the moment.

I believe the same thing happens with an ordinary MPG attached to your motion controller.

Try it out.

Craig

3047
Hi,
the fact that none of the wxMessageBox notifications have showed up mean that program control has NEVER progressed that far.
Thus your m6 program is never calling m1000.

Where did you get that m6 code from. It seems way wordy....and confusing. Lua code tend to be short, sharp and sweet.

Craig

3048
Hi,
another question:

Code: [Select]
function  m1000()
------ Auto Depth Setting ------  local inst = mc.mcGetInstance()
local ZGageBlockHeight = 3.3091

SetDepth()
   
end

function SetDepth()
    ------ Auto Depth Setting ------ 
    mc.mcCntlGcodeExecuteWait(inst, "G00 G53 X35.93 Y2.75\n") -- go to

Why the hell have you put:

local inst = mc.mcGetInstance()
local ZGageBlockHeight = 3.3091

outside of the two functions. They are declared as local variables and if they are to be used in a function they must be declared
WITHIN that function.

The only other alternative is NOT to declare them as local variables which would make them global variables
available throughout the chunk.

Second question is why you declared M1000() at all? All is does is call yet another function SetDepth().
The function M1000() is redundant.

While it may look really nice to have extensive comments throughout a macro and is certainly helpful to anyone inspecting
the macro for the first time.....it sure ups the word count and probably the confusion factor. Simple lean code it usually
the most robust code........comments are help that not confuse it.

3049
Hi,
I was just looking through the m6 file that you posted.....I can't find anywhere in the file M1000().....what
gives? Does m6 call M1000() or does it not?

Craig

3050
Hi,
I think you are still doing the same thing:

Code: [Select]
function SetDepth()
    ------ Auto Depth Setting ------ 
   function SetDepth()
    ------ Auto Depth Setting ------ 
    mc.mcCntlGcodeExecuteWait(inst, "G00 G53 X35.93 Y2.75\n") -- go to point over depth setter
    mc.mcCntlSetLastError(inst, 'Setting Tool Height')
    mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-4 F50") --probe the new tool
    mc.mcCntlGcodeExecuteWait(inst, "G91 G0 Z+0.1") --Retract from the probe
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-0.15 F5") --Probes at slow speed
local measure_1 = mc.mcAxisGetPos(inst,2) --Saves probed Z position

    mc.mcCntlSetLastError(inst, 'Setting Tool Height')
    mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-4 F50") --probe the new tool
    mc.mcCntlGcodeExecuteWait(inst, "G91 G0 Z+0.1") --Retract from the probe
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-0.15 F5") --Probes at slow speed
local measure_1 = mc.mcAxisGetPos(inst,2) --Saves probed Z position

OK, m6 calls M1000(), so m6 is caller. M1000 calls SetDepth(), so M1000 is caller. Now SetDepth attempts to execute:
mc.mcCntlGcodeExecuteWait(inst, "G00 G53 X35.93 Y2.75\n") -- go to point over depth setter, the first
mc.CntlGcodeExecuteWait() instruction and fails because the GCode interpreter is busy.....still.

May I suggest you try some diagnostic code. First put a few wxMessageBox statements so that you can confirm that
program control reached that juncture. The second is that you are going to have to test the return code of the
mc.CntlGcodeExecuteWait() instruction. The third is to report the machine state.

Modify your code like this:

Code: [Select]
local inst = mc.mcGetInstance()
local ZGageBlockHeight = 3.3091

function  m1000()
------ Auto Depth Setting ------ 
wx.wxMessageBox("M1000() called")
SetDepth()
   
end

function SetDepth()
    ------ Auto Depth Setting ------ 
wx.wxMessageBox("SetDepth() called")
local rc= mc.mcCntlGcodeExecuteWait(inst, "G00 G53 X35.93 Y2.75\n") -- go to point over depth setter
local mcState=mc.mcCntlGetState(inst)
wx.wxMessageBox(tostring(rc)..'      '..tostring(mcState))
    mc.mcCntlSetLastError(inst, 'Setting Tool Height')
    mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-4 F50") --probe the new tool
    mc.mcCntlGcodeExecuteWait(inst, "G91 G0 Z+0.1") --Retract from the probe
mc.mcCntlGcodeExecuteWait(inst, "G91 G31 Z-0.15 F5") --Probes at slow speed
local measure_1 = mc.mcAxisGetPos(inst,2) --Saves probed Z position

When you run your code I expect to to get three message box notifications.
The first will be "M1000() called", ie that m6 has successfully called M1000.
The second will be "SetDepth() called", ie that M100 has successfully transferred control to SetDepth().
The last is the truly critical notification. If the mc.CntlGcodeExecuteWait() instruction completed normally
then the return code will be "0". If it does not complete correctly I suspect the return code will be "-18".
That corresponds to the error MERROR_NOT_NOW which is just another way to say the Gcode interpreter is busy.
The same message notification will provide a numeric value for the machine state. My guess is it will be either 108 or 207.
Either way it will tell us more.

Try the code and report how you get on.

Craig

Pages: « 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 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 »