a blog of ideas and improvements
for tormach cnc mills
articles | for sale |
about |
contact
|
|
||
Here are some examples. Sets G20 | Sets G54 | Sets the Feed Slider to 20% | Goes to X0 |
FOR THE GEEKS |
||||||||||||||
MARCH 2024
UPDATE (FEED, RPM, VELOCITY SLIDERS) You will install xdotool and write bash scripts that command mousemoves, mouseclicks and key presses to tell your machine to do whatever you want. Then, bind those bash scripts to hotkeys via the built-in app Keyboard Shortcuts. This gives you, for instance, CTRL+SHIFT+X to probe a rectangular boss. Finally, and optionally, bind third party USB macro boards to those shortcuts. So CTRL+SHIFT+X becomes one individual button on those macro boards. This gives you one-button Cycle Start, Probing, any M command, any G command. Anything.
|
||||||||||||||
FOR THE REST OF US |
||||||||||||||
MARCH 2024
UPDATE (FEED, RPM, VELOCITY SLIDERS) Useless prelude: I am a sucker for efficiency. I'm always trying to squeeze that last microsecond out of some procedure. This isn't even restricted to the CNC machine. Or computers in general. If I can shave time off of something (often at the expense of cosmetics), I'm doing it. On Windows machines, I have dozens of autohotkey scripts written. On Linux, it's xdotool. With that, comes a general hatred for mice and touchscreens. Especially coolant-resistant touchscreens that are a pain in the butt to press. I'll go head to head against anyone. I'm faster on a well laid-out keyboard than anyone with a mouse, keyboard and touchscreen combo. CAD, CAM, programming, web development. The speed is in the keyboard. So it stands to reason that vanilla Pathpilot makes my head spin. Tormach has a few hotkeys built in, but not nearly enough. Their new operator console is a step in the right direction, but there should be a shortcut for everything. And you shouldn't have to spend $2000. Well, there is now.
CNC machines are the pinnacle of efficiency. So let's make the software just as fast. |
||||||||||||||
STEP 1 - INSTALL xdotool |
||||||||||||||
The star of the show is an app called
xdotool. The very first step is installing it. Do so by opening a terminal window. From Pathpilot, that's typically CTRL+ALT+X, though it may be different for you. Type mate-panel to get into the Linux GUI. This may be different for you (gnome-panel for instance). Then bring up a second terminal window by going to the Start button (Menu button in Linux) and typing terminal. Then, just type: sudo apt-get install xdotool xdotool is going to allow you to move the mouse, click the mouse and type keyboard letters from simple plaintext scripts that you can write. Here's my G20 script example. This sets your machine to G20 (Imperial units).
In this example, every line is commented for clarity. Real world scripts CANNOT have the first line commented. The top line MUST read: #!/bin/bash |
||||||||||||||
STEP 2 - SAVE THAT SCRIPT AND BIND IT TO A KEY COMBO |
||||||||||||||
You can literally copy that script, save it to a file and make it do its thing.
Save it into your /gcode folder. Do that via Dropbox, thumb drive, wifi, however you transfer your files. Note that Linux scripts don't like when they're edited on Windows machines. So you may be better off downloading them from my site, then editing them directly on your controller. Or, writing them from scratch on your controller in gedit. If you do want to edit them on Windows machines, install dos2unix on your Linux machine and from a terminal window type "dos2unix g20.sh" (no quotes). You may not HAVE to do this, but you probably will. Another option is to open the files in gedit on your controller, then going to File | Save As and in the bottom right, find Line Endings and selecting Unix / Linux Again, the top line can't be commented. The top line must read exactly like this: #!/bin/bash For organization, you should save them into something like /gcode/shortcuts/ with the filename g20.sh. If you haven't already, fire up your Windows-esque GUI by typing mate-panel back in your terminal window. This may be gnome-panel or something else depending on which version of Linux was shipped to you. You should get a Windows-style Start menu at the bottom. Click that and find Keyboard Shortcuts. Click Add near the bottom right and type in the following: Name: G20 Command: bash "gcode/shortcuts/g20.sh" (exactly like that, with quotes) Click Apply, then assign it whatever key combo you want. Try CTRL+ALT+G Now, you can more or less be done here, if you want. Pressing CTRL+ALT+G on your keyboard should set G20 for you. The next step is the real money, though: Binding it to ONE key. |
||||||||||||||
STEP 3a - THE MACRO BOARDS EXPLAINED |
||||||||||||||
Here's where it gets slightly annoying.
When I was fleshing out this idea, I learned that there are a few brands of macro keyboards available. Each with their strengths and weaknesses. If you go down this road, you should be aware of all of them. In my photos, you see two styles of macro boards. Two Penclic on the left, two Teenii on the right. And, for a short time I had a Koolertron model. ADVANTAGES
DISADVANTAGES
ADVANTAGES
DISADVANTAGES
ADVANTAGES
DISADVANTAGES
|
||||||||||||||
STEP 3b - TAKING THREE-KEY COMBOS AND DISTILLING THEM INTO ONE KEY. | ||||||||||||||
No matter which board(s) you buy, all you're doing is using their proprietary
software and assigning their keys to combinations (So, the "1" on whatever board
becomes CTRL+ALT+G, etc). The exception to this is that you can write your own script on a Penclic board, if you choose to. But, you can also just assign a Penclic key to a combination. Either way. After that, just plug them into your controller. They're automatically found, installed and ready to work. |
||||||||||||||
STEP 4 - WRITING THE xdotool SCRIPTS | ||||||||||||||
All this is for naught if you don't know how to write
xdotool scripts. Fortunately, it's pretty simple. Plus, I've uploaded all my scripts for inspection and dissection. xdotool is powerful, but we really only need around five commands to use it with Pathpilot.
From a terminal window, type xdotool getmouselocation BUT DON'T PRESS ENTER YET. Leaving it open, move and hover your mouse back to where you need it. You can ALT+TAB back into Pathpilot if necessary. When you have the mouse where you want it (MDI Line, Probe Button, whatever), switch back to the terminal window and press enter. xdotool will spit out the location, which you can then use in your script. You should also add this if statement to every script you create, which prevents them from running unless Pathpilot is the active window.
IF starts the if statement and FI ends it. So, your code goes between the IF and the FI. I have some advanced scripts that run some weird stuff, that would probably be pretty dangerous if run in Pathpilot (and some if ran outside of Pathpilot). |
||||||||||||||
|