Hello Guest it is April 23, 2024, 06:24:26 PM

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 »
131
Hi,

Quote
A) how do I know which script I should be in when modifying these buttons like Screen Load Script or Screen Upload Script or PLC Script?

That is all part of the Mach4 learning curve. It was not really necessary to understand the inner workings of Mach3, all features, good and bad were exposed
and in many cases automatic. Mach4 is very different that that regard. It is a structured software with significant modularity. Understanding how control flows from
one section to another is both important and a challenge. Its a case of starting small and working your way up. You have now encountered two scripts, the
ScreenLoad and PLC scripts....that will keep you going for a while yet.

The ScreenLoad script is the most significant one, and it is where you'l place most of your function definitions. It is also the location of the SigLib{}, aka Signal Library Table.
That is where you'll be putting code for inputs and outputs.

The PLC script is also important if you need or want  a polled input. The downside with the PLC is that it runs every wee while....if you make a mistake in your coding its going
to fail again and again, often locking you out.You should thoroughly test any code 'in a sandbox' before you put it in the PLC script.

The Screen Unload script is what runs when Mach shuts down, things like storing data, and settings. It is largely automatic and seldom needs editing or additions.

Quote
In the Move to work zero script, If I want Z to move to a Safe Number First before X+Y moves, say it raises to Z=-500 below MACHINE ZERO then X+Y Move to zero then Z drops to work zero IS THIS POSSIBLE TO DO?

But isn't that exactly how Mach4 works now?

The <GotoWorkZero> function as shipped, moves the Z ie Z zero in machine coordinates ie to the very top of travel and out of harms way, THEN moves to the X,Y  zero. Thereafter, if you
have programmed it so the Z axis descends into the work zone. Isn't that exactly what you want, but rather than go to 'some safe height' it goes to the very top of the Z axis,
surely that is a safe as you can get?

My preference is as Mach ships where the X and Y axes got to zero, but the Z axis remains out of harm way right at the top, rather than drive down into the work zone
Then I jog the Z axis down manually. I can confirm that my Z zero is correctly set without risk. Having it drive down automatically risks any mistake being found but only AFTER a crash.

You can code it to go to some other height, say Z zero (work coordinates) plus some safety allowance, say 50mm. Note this is not standard code but would require you edit the
standard code to reflect your preference.

Fusion 360 allows a parameter 'Clearance Height' and is very convenient and is related to the part you are working on. When the tool path is simulated it
is the perfect opportunity to preview the Z zero and its suitability. When I do rotary four axis paths I specify a safe Z location, but that is done on a per part basis.

The thought of automatically driving to Z zero (work coordinates), especially without some safety allowance gives me the chills!

Craig


132
Hi smurph,
Ah, yes. I was forgetting the motion controller plugin. That resides and runs on the PC and is not in anyway disadvantaged or encumbered
by F64 whereas the motion board itself is likely to suffer if it has to recast F64 to integer or whatever. It seems that they mostly have a 32bit
microcontroller or an FPGA neither of which are great at F64...by in large.

Having said that I've used Texas Instruments C2000 microcontrollers for motor control and that does 32 bit floating point good-oh, single cycle
multiply-and-accumulate at all that sort of thing. Yep, they 'put a horn on a jellyfish those things'.

Craig

133
Hi,
does that mean that the number posted to the motion controller (per motor) is a 64bit double precision float or an integer?

Craig

134
Mach4 General Discussion / Re: Script da mach3 a mach4
« on: March 27, 2023, 03:58:17 PM »
Hi,
you may like to think about this API:

Code: [Select]
LUA Syntax:
rc = mc.mcFileHoldAquire(
number mInst,
string reason,
number JogAxisBits)

Description:
Used to hold G code processing.

When you are running a Gcode file you cannot jog. The trajectory planner can only have one master, and when the Gcode interpreter is consuming
a Gcode file the it is the master. If you want to jog say....you cannot, as that would require the GUI to be the master so as to allow the jogging.
Just pausing the Gcode will not do....you have to release the planner.

It is for this reason that the API exists. If you are sailing through a Gcode file file and you have a m6() macro or similar that you want to execute but requires
that the operator manually jog somewhere, you can put the Gcode file on hold and release the planner. Then operator can jog and/or do whatever needs be done.

Code: [Select]
LUA Syntax:
rc = mc.mcFileHoldRelease(
number mInst)

Description:
Used to exit a file hold state.

This is the API that releases the file hold and so the Gcode interpreter becomes the planner master again.

This technique uses the <CycleStart> button. This avoids the need to use a wxWidgets dialog.

Craig

135
Hi Steve,
thanks for that clarification.

I had always presumed that the trajectory data output by Mach to the motion controller was in the form of a 32bit integer cumulative Step count. Is this the case?
I would presume also that the trajectory planner if it takes a double precision Step/Unit value that the trajectory is calculated throughout the planner in double
precision format and only as the trajectory is pushed out to the motion controller that its re-cast as 32bit integer?

Craig

136
Hi,
This is the GoToZero function in the screen load script:

Code: [Select]
function GoToWorkZero()
    mc.mcCntlMdiExecute(inst, "G00 X0 Y0")--Without Z moves
    --mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z0")--With Z moves
end

See how one line works with the X and Y axes only, and the other line (commented out as standard issue) allows X, Y  AND Z moves. If you choose you can have
all three axes move, just comment out the first line and un-comment the second line.

The functionality you seek is already there.....choose which one you want. NFS chose to have a function WITHOUT Z moves being safest and would not catch users out,
however if you wish you can have the GoToZero function WITH Z moves....just choose it.

A word of caution...the function with Z moves drives to Z0 in work coordinates. If that is the surface of the material the machine will drive hard towards it and hopefully
stop with the tool just touching....if you make the slightest mistake you risk driving the tool into the material. Do you want that?

If not then add a little to the Z move like this:

Code: [Select]
mc.mcCntlMdiExecute(inst, "G00 G53 Z0\nG00 X0 Y0 A0\nG00 Z50")--With Z moves
This will mean that the Z axis stops 50mm above the surface of the material....which is for my money somewhat safer....but its your machine, your call.

Craig

137
Hi,

Quote
Having keyboard functions on when Mach has booted up seems like it should be a basic function but it appears its not. A script has to be written by a programmer to make it work.

Its there already, all you have to do it TURN IT ON!!!! Have you bothered to read the post in the Mach3 board, there I have explained it in great detail. You don't have to write anything, just
comment out one line.

Quote
Moving the Z axis to a safe position while going to work zero to me would be a basic function but its not. A script has to be inserted in order for it to do this.

There is already a <GoToWorkZero> button that operates on the X and Y axes....if you really want your machine to dive in on the Z axis to machine zero or any other number go for your
life......one line is all it takes. Don't be surprised when it crashes....remember you asked for it to operate this way.

You seem to imagine that NFS are clueless, and that they have half done things or not done other things because they don't know what they are doing. As it turns out their
collective machining experience well and truly exceeds yours and mine combined, and what they have done in fact is do are things that are logical, repeatable and as safe as they
can make it AND provide the tools for users to adjust it to their liking. If you cannot or will not take the effort to adjust to your liking then stick with Mach3.

Craig




138
Hi,

Quote
they should have transferred some of the basics from 3 to 4.

They have. If you spent some time you'd find that ALL the basic stuff is there, you just have to turn it on or off to suit your purpose.

Craig

139
Mach4 General Discussion / Re: Modification help
« on: March 26, 2023, 03:39:27 PM »
Hi,
I have just posted in another thread how to turn the Keyboard on automatically, as it turns out you don't have to code anything....just comment out
one line of code.

https://www.machsupport.com/forum/index.php?topic=47199.new#new

Craig

140
Hi,
Jeez, its even simpler than that......you don't need to add a line to the PLC but rather just comment one line out!

The first thing you need to understand is that the onscreen button that you press to enable the keyboard is just a trigger for a function.
What function you ask....check out the pic. It shows the screen editor open and showing the event of the <KeyboarEnable> button.
Note that te function is called KeyboardEnableToggle().

Given that its a toggle, if you press the button it changes from Off to On or from On to Off, simple enough.

In order to enable the keyboard automatically you want the function to run, just once somewhere near the beginning of the program.

When Mach starts up the first part to run is the ScreenLoad script. As the name suggests it loads all the screen elements. It might be possible to run a function here
but what happens if that function relies on another piece of code that has not loaded yet?. The smart way to do it is to wait until ALL the code has loaded and THEN run
the function. As it turns out there is a good way to do this.

The PLC script is equivalent to the macro pump in Mach3. It runs every 10 milliseconds or so. So the process is that the ScreenLoad script runs and once it completes and everything
is loaded then the PLC script runs for the first time. What we don't want however is for the function to run and then a little while later run again...and again...and again...etc.
The PLC has a counter called 'testcount' and is set to 1 at start up and increments every time the PLC runs. There is a small section of code within the PLC script that runs ONLY when testcount=1,
ie it runs only once, at first startup and thereafter given that testcount is no longer equal to 1 not again.

This is that section of code:
Code: [Select]
-------------------------------------------------------
--  PLC First Run
-------------------------------------------------------
if (testcount == 1) then --Set Keyboard input startup state
    local iReg = mc.mcIoGetHandle (inst, "Keyboard/Enable")
    mc.mcIoSetState(iReg, 1) --Set register to 1 to ensure KeyboardInputsToggle function will do a disable.
    KeyboardInputsToggle()
   
---------------------------------------------------------------
-- Set Persistent DROs.
---------------------------------------------------------------

    DROTable = {
[1034] = "droEdgeFinder",
    [1035] = "droGageBlock",
    [1036] = "droGageBlockT"
    }

This is found by opening the screen editor and looking at the events tab of your screenset, the very topmost element of the file tree.

And look at that, there is the code to turn the Keyboard on, and then for safety its toggled Off by the exact function we want to run. If you comment it out
it will not run and therefore the Keyboard will remain on. Is that what you want? So just add two '-' marks in front of the function call KeyboardInputsToggle()
and you're done. It should look like this:
Code: [Select]
-------------------------------------------------------
--  PLC First Run
-------------------------------------------------------
if (testcount == 1) then --Set Keyboard input startup state
    local iReg = mc.mcIoGetHandle (inst, "Keyboard/Enable")
    mc.mcIoSetState(iReg, 1) --Set register to 1 to ensure KeyboardInputsToggle function will do a disable.
    --KeyboardInputsToggle()
   
---------------------------------------------------------------
-- Set Persistent DROs.
---------------------------------------------------------------

    DROTable = {
[1034] = "droEdgeFinder",
    [1035] = "droGageBlock",
    [1036] = "droGageBlockT"
    }

Couldn't be much simpler than that. The functionality that you want is already right there, all you have to do is decide whether you want it ON or Off. NFS chose Off for safeties
sake, and can't really fault them for that, but you may choose otherwise, and by adding a couple of comment marks its done.

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 »