axis.txt
1 [[cha:axis-gui]] 2 3 = AXIS GUI 4 5 == Introduction 6 7 AXIS is a graphical front-end for LinuxCNC which features a live 8 preview and backplot. It is written in Python and uses 9 Tk and OpenGL to display its user interface. 10 11 .AXIS Window 12 13 image::images/axis.png[align="center", alt="AXIS Window"] 14 15 == Getting Started 16 17 If your configuration is not currently set up to use AXIS, 18 you can change it by editing the .ini file. In the 19 section '[DISPLAY]' change the 'DISPLAY' line to read 20 'DISPLAY = axis'. 21 22 The sample configuration 23 'sim/axis.ini' is already configured to use AXIS as its front-end. 24 25 === A Typical Session 26 27 . Start LinuxCNC. 28 . Reset E-STOP (F1) and turn the Machine Power (F2) on. 29 . Home all axes. 30 . Load the g-code file. 31 . Use the preview plot to verify that the program is correct. 32 . Load the material. 33 . Set the proper offset for each axis by jogging and using the Touch 34 Off button as needed. 35 . Run the program. 36 37 [NOTE] 38 To run the same program again depends on your setup and requirements. 39 You might need to load more material and set offsets or move over and 40 set an offset then run the program again. If your material is fixtured 41 then you might need to only run the program again. See the 42 <<sub:axis-machine-menu,Machine Menu>> for more information on the run 43 command. 44 45 == AXIS Display 46 47 The AXIS window contains the following elements: 48 49 * A display area that shows one of the following: 50 ** a preview of the loaded file (in this case, 51 'axis.ngc'), as well as the current location of the CNC 52 machine's 'controlled point'. Later, this area will display the path 53 the CNC machine has moved through, called the 'backplot' 54 ** a large readout showing the current position and all offsets. 55 * A menu bar and toolbar that allow you to perform various actions 56 * 'Manual Control Tab' - which allows you to make the 57 machine move, turn the spindle on or off, and turn the coolant on or 58 off if included in the ini file. 59 * 'MDI Tab' - where G-code programs can be entered manually, 60 one line at a time. This also shows the 'Active G Codes' which shows 61 which modal G Codes are in effect. 62 * 'Feed Override' - which allows you to scale 63 the speed of programmed motions. The default maximum is 120% 64 and can be set to a different 65 value in the ini file. See the <<sec:display-section,Display Section>> of the 66 INI file for more information. 67 * 'Spindle Override' - which allows you to 68 scale the spindle speed up or down. 69 * 'Jog Speed' - which allows you to set the jog speed 70 within the limits set in the ini file. See the 71 <<sec:display-section,Display Section>> of the INI file for more information. 72 * 'Max Velocity' - which allows you to restrict the maximum velocity of all 73 programmed motions (except spindle synchronized motion). 74 * A text display area that shows the loaded G-Code. 75 * A status bar which shows the state of the machine. In this screen 76 shot, the machine is turned on, does not have a tool inserted, and the 77 displayed position is 'Relative' (showing all offsets), and 'Actual' 78 (showing feedback position). 79 80 === Menu Items 81 82 Some menu items might be grayed out depending on how you have your 83 .ini file configured. For more information on configuration see the 84 <<cha:ini-configuration,INI Chapter>>. 85 86 .File Menu 87 88 * 'Open...' - Opens a standard dialog box to open a g code file to load in AXIS. If 89 you have configured LinuxCNC to use a filter program you can also open it 90 up. See the <<sec:filter-section,FILTER Section>> of the INI configuration 91 for more information. 92 93 * 'Recent Files' - Displays a list of recently opened files. 94 95 * 'Edit...' - Open the current G code file for editing if you have an editor 96 configured in your ini file. See the <<sec:display-section,DISPLAY Section>> 97 for more information on specifying an editor to use. 98 99 * 'Reload' - Reload the current g code file. If you edited it you must reload it 100 for the changes to take affect. If you stop a file and want to start 101 from the beginning then reload the file. The toolbar reload is the same 102 as the menu. 103 104 * 'Save gcode as...' - Save the current file with a new name. 105 106 * 'Properties' - The sum of the rapid and feed moves. Does not factor in 107 acceleration, blending or path mode so time reported will never 108 be less than the actual run time. 109 110 * 'Edit tool table...' - Same as Edit if you have defined an editor 111 you can open the tool table and edit it. 112 113 * 'Reload tool table' - After editing the tool table you must reload it. 114 115 * 'Ladder editor' - If you have loaded Classic Ladder you can edit it from 116 here. See the <<cha:classicladder,Classicladder Chapter>> 117 for more information. 118 119 * 'Quit' - 120 Terminates the current LinuxCNC session. 121 122 [[sub:axis-machine-menu]] 123 124 .Machine Menu 125 126 * 'Toggle Emergency Stop F1' - Change the state of the Emergency Stop. 127 128 * 'Toggle Machine Power F2' - Change the state of the Machine Power if 129 the Emergency Stop is not on. 130 131 * 'Run Program' - Run the currently loaded program from the beginning. 132 133 * 'Run From Selected Line' - Select the line you want to start from first. 134 Use with caution as this will move the tool to the expected position before 135 the line first then it will execute the rest of the code. 136 137 [WARNING] 138 Do not use 'Run From Selected Line' if your g code program contains subroutines. 139 140 * 'Step' - Single step through a program. 141 142 * 'Pause' - Pause a program. 143 144 * 'Resume' - Resume running from a pause. 145 146 * 'Stop' - Stop a running program. When run is selected after a stop the program 147 will start from the beginning. 148 149 * 'Stop at M1' - If an M1 is reached, and this is checked, program execution 150 will stop on the M1 line. Press Resume to continue. 151 152 * 'Skip lines with "/"' - If a line begins with '/' and this is checked, 153 the line will be skipped. 154 155 * 'Clear MDI history' - Clears the MDI history window. 156 157 * 'Copy from MDI history' - Copies the MDI history to the clipboard 158 159 * 'Paste to MDI history' - Paste from the clipboard to the MDI history window 160 161 * 'Calibration' - Starts the Calibration assistant (emccalib.tcl). 162 Calibration reads the HAL file and for every 'setp' that uses a variable 163 from the ini file that is in an [AXIS_L],[JOINT_N],[SPINDLE_S], or [TUNE] 164 section it creates an entry that can be edited and tested. 165 166 * 'Show HAL Configuration' - Opens the HAL Configuration window where you can 167 monitor HAL Components, Pins, Parameters, Signals, Functions, and Threads. 168 169 * 'HAL Meter' - Opens a window where you can monitor a single HAL Pin, Signal, or 170 Parameter. 171 172 * 'HAL Scope' - Opens a virtual oscilloscope that allows plotting HAL values vs. time. 173 174 * 'Show LinuxCNC Status' - Opens a window showing LinuxCNC's status. 175 176 * 'Set Debug Level' - Opens a window where debug levels can be viewed and some can be set. 177 178 * 'Homing' - Home one or all axes. 179 180 * 'Unhoming' - Unhome one or all axes. 181 182 * 'Zero Coordinate System' - Set all offsets to zero in the coordinate 183 system chosen. 184 185 [[axis:tool-touch-off]] (((Axis, Tool Touch Off))) 186 187 * 'Tool touch off to workpiece' - When performing Touch Off, the value 188 entered is relative to the current workpiece ('G5x') coordinate system, 189 as modified by the axis offset ('G92'). When the Touch Off is complete, 190 the Relative coordinate for the chosen axis will become the value entered. 191 See <<gcode:g10-l10,G10 L10>> in the G code chapter. 192 193 * 'Tool touch off to fixture' - When performing Touch Off, the value entered 194 is relative to the ninth ('G59.3') coordinate system, with the axis offset 195 ('G92') ignored. This is useful when there is a tool touch-off fixture at a 196 fixed location on the machine, with the ninth ('G59.3') coordinate system set 197 such that the tip of a zero-length tool is at the fixture's origin when the 198 Relative coordinates are 0. See <<gcode:g10-l11,G10 L11>> in the G code chapter. 199 200 .View Menu 201 202 * 'Top View' - The Top View (or Z view) displays the G code looking along the 203 Z axis from positive to negative. This view is best for looking at X & Y. 204 205 * 'Rotated Top View' - The Rotated Top View (or rotated Z view) also displays 206 the G code looking along the Z axis from positive to negative. But sometimes 207 it's convenient to display the X & Y axes rotated 90 degrees to fit the 208 display better. This view is also best for looking at X & Y. 209 210 * 'Side View' - The Side View (or X view) displays the G code looking along 211 the X axis from positive to negative. This view is best for looking at Y & Z. 212 213 * 'Front View' - The Front View (or Y view) displays the G code looking along 214 the Y axis from negative to positive. This view is best for looking at X & Z. 215 216 * 'Perspective View' - The Perspective View (or P view) displays the G code 217 looking at the part from an adjustable point of view, defaulting to X+, Y-, 218 Z+. The position is adjustable using the mouse and the drag/rotate selector. 219 This view is a compromise view, and while it does do a good job of trying to 220 show three (to nine!) axes on a two-dimensional display, there will often be 221 some feature that is hard to see, requiring a change in viewpoint. This view 222 is best when you would like to see all three (to nine) axes at once. 223 224 .Point of View 225 **** 226 The AXIS display pick menu 'View' refers to 'Top', 'Front', and 'Side' views. 227 These terms are correct if the CNC machine has its Z axis vertical, with 228 positive Z up. This is true for vertical mills, which is probably the most 229 popular application, and also true for almost all EDM machines, and even 230 vertical turret lathes, where the part is turning below the tool. 231 232 The terms 'Top', 'Front', and 'Side' might be confusing however, in other 233 CNC machines, such as a standard lathe, where the Z axis is horizontal, or 234 a horizontal mill, again where the Z axis is horizontal, or even an inverted 235 vertical turret lathe, where the part is turning above the tool, and the Z axis 236 positive direction is down! 237 238 Just remember that positive Z axis is (almost) always away from the part. 239 So be familiar with your machine's design and interpret the display as needed. 240 **** 241 242 243 * 'Display Inches' - Set the AXIS display scaling for inches. 244 245 * 'Display MM' - Set the AXIS display scaling for millimeters. 246 247 * 'Show Program' - The preview display of the loaded G code program can be entirely 248 disabled if desired. 249 250 * 'Show Program Rapids' - The preview display of the loaded G code program will always show the 251 feedrate moves (G1,G2,G3) in white. But the display of rapid moves (G0) 252 in cyan can be disabled if desired. 253 254 * 'Alpha-blend Program' - This option makes the preview of complex programs easier to see, but 255 may cause the preview to display more slowly. 256 257 * 'Show Live Plot' - The highlighting of the feedrate paths (G1,G2,G3) as the tool moves 258 can be disabled if desired. 259 260 * 'Show Tool' - The display of the tool cone/cylinder can be disabled if desired. 261 262 * 'Show Extents' - The display of the extents (maximum travel in each axis direction) 263 of the loaded G code program can be disabled if desired. 264 265 * 'Show Offsets' - The selected fixture offset (G54-G59.3) origin location can be shown 266 as a set of three orthogonal lines, one each of red, blue, and green. 267 This offset origin (or fixture zero) display can be disabled if desired. 268 269 * 'Show Machine Limits' - The machine's maximum travel limits for each axis, as set in the ini 270 file, are shown as a rectangular box drawn in red dashed lines. This 271 is useful when loading a new G code program, or when checking for how 272 much fixture offset would be needed to bring the G code program within 273 the travel limits of your machine. It can be shut off if not needed. 274 275 * 'Show Velocity' - A display of velocity is sometimes useful to see how close your 276 machine is running to its design velocities. It can be disabled 277 if desired. 278 279 * 'Show Distance to Go' - Distance to go is a very handy item to know when running an unknown 280 G code program for the first time. In combination with the rapid 281 override and feedrate override controls, unwanted tool 282 and machine damage can be avoided. Once the G code program has 283 been debugged and is running smoothly, the Distance to Go display 284 can be disabled if desired. 285 286 * 'Clear Live Plot' - As the tool travels in the Axis display, the G code path is highlighted. 287 To repeat the program, or to better see an area of interest, the 288 previously highlighted paths can be cleared. 289 290 * 'Show Commanded Position' - This is the position that LinuxCNC will try to go to. Once motion 291 has stopped, this is the position LinuxCNC will try to hold. 292 293 * 'Show Actual Position' - Actual Position is the measured position as read back from the 294 system's encoders or simulated by step generators. This may differ 295 slightly from the Commanded Position for many reasons including PID 296 tuning, physical constraints, or position quantization. 297 298 * 'Show Machine Position' - This is the position in unoffset coordinates, as established by Homing. 299 300 * 'Show Relative Position' - This is the Machine Position modified by 'G5x', 'G92', and 'G43' offsets. 301 302 .Help Menu 303 304 * 'About Axis' - We all know what this is. 305 306 307 * 'Quick Reference' - Shows the keyboard shortcut keys. 308 309 === Toolbar buttons 310 311 From left to right in the Axis display, the toolbar buttons (keyboard shortcuts shown [in brackets]) are: 312 313 * image:images/tool_estop.gif[alt="Toggle Emergency Stop"] Toggle Emergency Stop [F1] (also called E-Stop) 314 315 * image:images/tool_power.gif[alt="Toggle Machine Power"] Toggle Machine Power [F2] 316 317 * image:images/tool_open.gif[alt="Open G Code file"] Open G Code file [O] 318 319 * image:images/tool_reload.gif[alt="Reload current file"] Reload current file [Ctrl-R] 320 321 * image:images/tool_run.gif[alt="Begin executing the current file"] Begin executing the current file [R] 322 323 * image:images/tool_step.gif[alt="Execute next line"] Execute next line [T] 324 325 * image:images/tool_pause.gif[alt="Pause Execution - Resume Execution"] Pause Execution [P] Resume Execution [S] 326 327 * image:images/tool_stop.gif[alt="Stop Program Execution"] Stop Program Execution [ESC] 328 329 * image:images/tool_blockdelete.gif[alt="Toggle Skip lines"] Toggle Skip lines with "/" [Alt-M-/] 330 331 * image:images/tool_optpause.gif[alt="Toggle Optional Pause"] Toggle Optional Pause [Alt-M-1] 332 333 * image:images/tool_zoomin.gif[alt="Zoom In"] Zoom In 334 335 * image:images/tool_zoomout.gif[alt="Zoom Out"] Zoom Out 336 337 * image:images/tool_axis_z.gif[alt="Top view"] Top view 338 339 * image:images/tool_axis_z2.gif[alt="Rotated Top view"] Rotated Top view 340 341 * image:images/tool_axis_x.gif[alt="Side view"] Side view 342 343 * image:images/tool_axis_y.gif[alt="Front view"] Front view 344 345 * image:images/tool_axis_p.gif[alt="Perspective view"] Perspective view 346 347 * image:images/tool_rotate.gif[alt="Toggle between Drag and Rotate Mode"] Toggle between Drag and Rotate Mode [D] 348 349 * image:images/tool_clear.gif[alt="Clear live backplot"] Clear live backplot [Ctrl-K] 350 351 352 === Graphical Display Area 353 354 .Coordinate Display 355 356 In the upper-left corner of the program display is the coordinate position 357 display for each axis. To the right of the number an origin symbol 358 image:images/axis-homed.png[alt="origin symbol is shown if the axis has been homed"] is shown if the axis has been homed. 359 360 A limit symbol image:images/axis-limit.png[alt="limit symbol"] is shown on the right side of the 361 coordinate position number if the axis is on one of its limit switches. 362 363 To properly interpret the coordinate position numbers, refer to the 'Position:' 364 indicator in the status bar. If the position is 'Machine Actual', then the 365 displayed number is in the machine coordinate system. If it is 366 'Relative Actual', then the displayed number is in the offset coordinate 367 system. When the coordinates displayed are relative and an offset has been set, 368 the display will include a cyan <<sec.machine-corrdinate-system,'machine origin'>> 369 image:images/axis-machineorigin.png[alt="cyan machine origin"] marker. 370 371 If the position is 'Commanded', then the exact coordinate given in a G code 372 command is displayed. If it is 'Actual', then it is the position the machine 373 has actually moved to. These values can be different from commanded postition 374 due to following error, dead band, encoder resolution, or step size. For 375 instance, if you command a movement to X 0.0033 on your mill, but one step of 376 your stepper motor or one encoder count is 0.00125, then the 'Commanded' 377 position might be 0.0033, but the 'Actual' position will be 0.0025 (2 steps) 378 or 0.00375 (3 steps). 379 380 .Preview Plot 381 382 When a file is loaded, 383 a preview of it is shown in the display area. 384 Fast moves (such as those produced by the 'G0' command) are shown as 385 cyan lines. Moves at a feed rate 386 (such as those produced by the 'G1' command) are 387 shown as solid white lines. Dwells 388 (such as those produced by the 'G4' command) 389 are shown as small pink 'X' marks. 390 391 G0 (Rapid) moves prior to a feed move 392 will not show on the preview plot. 393 Rapid moves after a T<n> (Tool Change) will not show on the 394 preview until after the first feed move. 395 To turn either of these features off 396 program a G1 without any moves prior to the G0 moves. 397 398 .Program Extents 399 400 The 'extents' of the program in each axis are shown. 401 At the ends, the least and greatest coordinate values are indicated. 402 In the middle, the difference between the coordinates is shown. 403 404 When some coordinates exceed the 'soft limits' in the .ini file, 405 the relevant dimension is shown in a different color and enclosed by a box. 406 In figure below the maximum soft limit is exceeded on 407 the X axis as indicated by the box surrounding the coordinate value. 408 The minimum X travel of the program is -1.95, 409 the maximum X travel is 1.88, 410 and the program requires 3.83 inches of X travel. 411 To move the program so it's within the machine's travel in this case, 412 jog to the left and Touch Off X again. 413 414 image::images/axis-outofrange.png[align="center",alt="The extents of the program in x axis are shown"] 415 416 .Tool Cone 417 When no tool is loaded, the location of the tip of the tool is 418 indicated by the 'tool cone'. 419 The 'tool cone' does not provide guidance on the form, 420 length, or radius of the tool. 421 422 When a tool is loaded (for instance, with the MDI command 'T1 M6' ), 423 the cone changes to a cylinder which shows the diameter of the tool 424 given in the tool table file. 425 426 .Backplot 427 428 When the machine moves, it leaves a trail called the backplot. 429 The color of the line indicates the type of motion: 430 Yellow for jogs, faint green for rapid movements, 431 red for straight moves at a feed rate, 432 and magenta for circular moves at a feed rate. 433 434 .Grid 435 436 Axis can optionally display a grid when in orthogonal views. Enable 437 or disable the grid using the 'Grid' menu under 'View'. When 438 enabled, the grid is shown in the top and rotated top views; when 439 coordinate system is not rotated, the grid is shown in the front and 440 side views as well. The presets in the 'Grid' menu are controlled 441 by the inifile item `[DISPLAY]GRIDS`; if unspecified, the default is 442 `10mm 20mm 50mm 100mm 1in 2in 5in 10in`. 443 444 Specifying a very small grid may decrease performance. 445 446 .Interacting 447 448 By left-clicking on a portion of the preview plot, 449 the line will be highlighted 450 in both the graphical and text displays. 451 By left-clicking on an empty area, the highlighting will be removed. 452 453 By dragging with the left mouse button pressed, 454 the preview plot will be shifted (panned). 455 456 By dragging with shift and the left mouse button pressed, 457 or by dragging with the mouse wheel pressed, 458 the preview plot will be rotated. 459 When a line is highlighted, 460 the center of rotation is the center of the line. 461 Otherwise, the center of rotation is 462 the center of the entire program. 463 464 By rotating the mouse wheel, 465 or by dragging with the right mouse button pressed, 466 or by dragging with control and the left mouse button pressed, 467 the preview plot will be zoomed in or out. 468 469 By clicking one of the 'Preset View' icons, 470 or by pressing 'V', several preset views may be selected. 471 472 === Text Display Area 473 474 By left-clicking a line of the program, the line will be highlighted 475 in both the graphical and text displays. 476 477 When the program is running, the line currently being executed is 478 highlighted in red. If no line has been selected by the user, 479 the text display will automatically scroll to show the current line. 480 481 .Current and Selected Lines 482 483 image::images/axis-currentandselected.png[align="center", alt="Current and Selected Lines"] 484 485 === Manual Control 486 487 While the machine is turned on but not running a program, 488 the items in the 'Manual Control' tab can be used to 489 move the machine or control its spindle and coolant. 490 491 When the machine is not turned on, or when a program is running, the 492 manual controls are unavailable. 493 494 Many of the items described below are not useful on all machines. 495 When AXIS detects that a particular pin is not connected in HAL, 496 the corresponding item in the Manual Control tab is removed. 497 For instance, if the HAL pin 'spindle.0.brake' is not connected, 498 then the 'Brake' button will not appear on the screen. 499 If the environment variable 'AXIS_NO_AUTOCONFIGURE' is set, 500 this behavior is disabled and all the items will appear. 501 502 .The Axis group 503 504 'Axis' allows you to manually move the machine. 505 This action is known as 'jogging'. 506 First, select the axis to be moved by clicking it. 507 Then, click and hold the '+' or '-' button 508 depending on the desired direction of motion. 509 The first four axes can also be moved by 510 the arrow keys (X and Y), 511 PAGE UP and PAGE DOWN keys (Z), 512 and the [ and ] keys (A). 513 514 If 'Continuous' is selected, the motion will continue 515 as long as the button or key is pressed. 516 If another value is selected, 517 the machine will move exactly the displayed distance 518 each time the button is clicked or the key is pressed. 519 By default, the available values are '0.1000, 0.0100, 0.0010, 0.0001' 520 521 See the <<sec:display-section,DISPLAY Section>> for more information on setting 522 the increments. 523 524 .Homing (Identity Kinematics) 525 526 The inifile setting [KINS]JOINTS defines the total number of 527 joints for the system. A joint may be configured with 528 a home switch or for 'immediate' homing. Joints may specify 529 a home sequence that organizes the order for homing groups 530 of joints. 531 532 If *all* joints are configured for homing and have valid 533 home sequences, the homing button will show 'Home All'. Pressing 534 the 'Home All' button (or the Ctrl-HOME key) will initiate homing 535 for all joints using their defined home sequences. Pressing the 536 HOME key will home the joint corresponding to the currently 537 selected axis even if no homing sequence is defined. 538 539 If not all axes have valid home sequences, the homing button will 540 show 'Home Axis' and will home the joint for the currently 541 selected axis only. Each axis must be selected and homed 542 separately. 543 544 The dropdown menu Machine/Homing provides an alternate method to 545 home axes. The dropdown menu Machine/Unhoming provides means to 546 unhome axes. 547 548 See the <<cha:homing-configuration,Homing Configuration Chapter>> for more 549 information. 550 551 .Homing (Non-Identity Kinematics) 552 553 Operation is similar to that for Identity Kinematics but, prior to 554 homing, the selection radiobuttons select joints by number. The 555 homing button will show 'Home All' if all joints are configured 556 for homing and have valid home sequences. Otherwise, the homing 557 button will show 'Home Joint'. 558 559 See the <<cha:homing-configuration,Homing Configuration Chapter>> for more 560 information. 561 562 .Touch Off 563 564 By pressing 'Touch Off' or the END key, the 'G5x offset' for the 565 current axis is changed so that the current axis value will be the 566 specified value. Expressions may be entered using the rules for 567 rs274ngc programs, except that variables may not be referred to. The 568 resulting value is shown as a number. 569 570 .Touch Off 571 572 image::images/touchoff.png[align="center", alt="Touch Off"] 573 574 See also the 'Tool touch off to workpiece' and 'Tool touch off to fixture' 575 options in the Machine menu. 576 577 .Override Limits 578 579 By pressing Override Limits, the machine will temporarily be allowed 580 to jog off of a physical limit switch. This check box is only available 581 when a limit switch is tripped. The override is reset after one jog. If 582 the axis is configured with separate positive and negative limit switches, 583 LinuxCNC will allow the jog only in the correct direction. _Override Limits will 584 not allow a jog past a soft limit. The only way to disable a soft limit 585 on an axis is to Unhome it._ 586 587 .The Spindle group 588 589 The buttons on the first row select the direction for the spindle to 590 rotate: Counterclockwise, Stopped, Clockwise. Counterclockwise will 591 only show up if the pin 'spindle.0.reverse' is in the HAL file (it 592 can be 'net trick-axis spindle.0.reverse' ). The buttons on the 593 next row increase or decrease the rotation 594 speed. The checkbox on the third row allows the spindle brake to be 595 engaged or released. Depending on your machine configuration, not all 596 the items in this group may appear. Pressing the spindle start button 597 sets the 'S' speed to 1. 598 599 .The Coolant group 600 601 The two buttons allow the 'Mist' and 'Flood' coolants to be turned on 602 and off. Depending on your machine configuration, not all the items in 603 this group may appear. 604 605 === MDI 606 607 MDI allows G-code commands to be entered manually. 608 When the machine is not turned on, or when a program is 609 running, the MDI controls are unavailable. 610 611 .The MDI tab 612 613 image::images/axis-mdi.png[align="center", alt="MDI tab"] 614 615 * 'History' - This shows MDI commands that have been typed earlier in this session. 616 617 * 'MDI Command' - This allows you to enter a g-code command to be executed. Execute the 618 command by pressing Enter or by clicking 'Go'. 619 620 * 'Active G-Codes' - This shows the 'modal codes' that are active in the interpreter. For 621 instance, 'G54' indicates that the 'G54 offset' is applied to all 622 coordinates that are entered. When in Auto the Active G-Codes represent 623 the codes after any read ahead by the interpreter. 624 625 === Feed Override 626 627 By moving this slider, the programmed feed rate can be modified. For 628 instance, if a program requests 'F60' and the slider is set to 120%, 629 then the resulting feed rate will be 72. 630 631 === Spindle Speed Override 632 633 By moving this slider, the programmed spindle speed can be 634 modified. For instance, if a program requests S8000 and the slider is 635 set to 80%, then the resulting spindle speed will be 6400. This item 636 only appears when the HAL pin 'spindle.0.speed-out' is connected. 637 638 === Jog Speed 639 640 By moving this slider, the speed of jogs can be modified. For 641 instance, if the slider is set to 1 in/min, then a .01 inch jog will 642 complete in about .6 seconds, or 1/100 of a minute. Near the left side 643 (slow jogs) the values are spaced closely together, while near the 644 right side (fast jogs) they are spaced much further apart, allowing a 645 wide range of jog speeds with fine control when it is most important. 646 647 On machines with a rotary axis, a second jog speed slider is shown. 648 This slider sets the jog rate for the rotary axes (A, B and C). 649 650 === Max Velocity 651 652 By moving this slider, the maximum velocity can be set. This caps the 653 maximum velocity for all programmed moves except spindle-synchronized 654 moves. 655 656 == Keyboard Controls 657 658 Almost all actions in AXIS can be accomplished with the keyboard. A 659 full list of keyboard shortcuts can be found in the AXIS Quick 660 Reference, which can be displayed by choosing Help > Quick Reference. 661 Many of the shortcuts are unavailable when in MDI mode. 662 663 .Feed Override Keys 664 665 The Feed Override keys behave differently when in Manual Mode. The 666 keys '12345678 will select an axis if it is programed. If you have 3 667 axis then ' will select axis 0, 1 will select axis 1, and 2 will select 668 axis 2. The remainder of the number keys will still set the Feed 669 Override. When running a program '1234567890 will set the Feed Override 670 to 0% - 100%. 671 672 The most frequently used keyboard shortcuts are shown in the following Table 673 674 .Most Common Keyboard Shortcuts 675 676 [width="80%", options="header", cols="^,<,^"] 677 |==================================================================== 678 |Keystroke | Action Taken | Mode 679 |F1 | Toggle Emergency Stop | Any 680 |F2 | Turn machine on/off | Any 681 |`, 1 .. 9, 0 | Set feed override from 0% to 100% | Varies 682 |X, ` | Activate first axis | Manual 683 |Y, 1 | Activate second axis | Manual 684 |Z, 2 | Activate third axis | Manual 685 |A, 3 | Activate fourth axis | Manual 686 |I | Select jog increment | Manual 687 |C | Continuous jog | Manual 688 |Control-Home | Perform homing sequence | Manual 689 |End | Touch off: Set G5x offset for active axis | Manual 690 |Left, Right | Jog first axis | Manual 691 |Up, Down | Jog second axis | Manual 692 |Pg Up, Pg Dn | Jog third axis | Manual 693 |[, ] | Jog fourth axis | Manual 694 |O | Open File | Manual 695 |Control-R | Reload File | Manual 696 |R | Run file | Manual 697 |P | Pause execution | Auto 698 |S | Resume Execution | Auto 699 |ESC | Stop execution | Auto 700 |Control-K | Clear backplot | Auto/Manual 701 |V | Cycle among preset views | Auto/Manual 702 |Shift-Left,Right | Rapid X Axis | Manual 703 |Shift-Up,Down | Rapid Y Axis | Manual 704 |Shift-PgUp, PgDn | Rapid Z Axis | Manual 705 |@ | toggle Actual/Commanded | Any 706 |# | toggle Relative/Machine | Any 707 |==================================================================== 708 709 == Show LinuxCNC Status (linuxcnctop) 710 711 AXIS includes a program called 'linuxcnctop' which shows some of the 712 details of LinuxCNC's state. You can run this program by invoking Machine > 713 Show LinuxCNC Status 714 715 .LinuxCNC Status Window 716 717 image::images/axis-emc-status.png[align="center", alt="LinuxCNC Status Window"] 718 719 The name of each item is shown in the left column. The current value 720 is shown in the right column. If the value has recently changed, it is 721 shown on a red background. 722 723 == MDI interface 724 725 AXIS includes a program called `mdi` which allows text-mode entry of 726 MDI commands to a running LinuxCNC session. You can run this program by 727 opening a terminal and typing 728 729 mdi 730 731 Once it is running, it displays the prompt 'MDI>'. When a blank line 732 is entered, the machine's current position is shown. 733 When a command is entered, it is sent to LinuxCNC to be executed. 734 735 This is a sample session of mdi. 736 737 ---- 738 $ mdi 739 MDI> 740 (0.0, 0.0, 0.0, 0.0, 0.0, 0.0) 741 MDI> G1 F5 X1 742 MDI> 743 (0.5928500000000374, 0.0, 0.0, 0.0, 0.0, 0.0) 744 MDI> 745 (1.0000000000000639, 0.0, 0.0, 0.0, 0.0, 0.0) 746 ---- 747 748 == axis-remote 749 750 AXIS includes a program called 'axis-remote' which can send certain 751 commands to a running AXIS. The available commands are shown by running 752 'axis-remote --help' and include checking whether AXIS is running 753 ('--ping'), loading a file by name, reloading the currently loaded 754 file ('--reload'), and making AXIS exit ('--quit'). 755 756 [[sec:manual-tool-change]](((Axis, Manual Tool Change))) 757 758 == Manual Tool Change 759 760 LinuxCNC includes a userspace HAL component called 'hal_manualtoolchange', 761 which shows a window prompt telling you what tool is expected when a 762 'M6' command is issued. After the OK button is pressed, execution of 763 the program will continue. 764 765 The hal_manualtoolchange component includes a hal pin for a button that 766 can be connected to a physical button to complete the tool change and 767 remove the window prompt (hal_manualtoolchange.change_button). 768 769 The HAL configuration file 'lib/hallib/axis_manualtoolchange.hal' 770 shows the HAL commands necessary to use this component. 771 772 hal_manualtoolchange can be used even when AXIS is not used as the GUI. 773 This component is most useful if you have presettable tools and 774 you use the tool table. 775 776 [NOTE] 777 Important Note: Rapids will not show on the preview after 778 a T<n> is issued until the next feed move after the M6. 779 This can be very confusing to most users. 780 To turn this feature off for the current tool change 781 program a G1 with no move after the T<n>. 782 783 .The Manual Toolchange Window 784 785 image::images/manual-tool-change.png[align="center", alt="The Manual Toolchange Window"] 786 787 == Python modules 788 789 AXIS includes several Python modules which may be useful to others. For more 790 information on one of these modules, use 'pydoc <module name>' or read the 791 source code. These modules include: 792 793 - 'emc' provides access to the LinuxCNC command, status, and error channels 794 - 'gcode' provides access to the rs274ngc interpreter 795 - 'rs274' provides additional tools for working with rs274ngc files 796 - 'hal' allows the creation of userspace HAL components written in Python 797 - '_togl' provides an OpenGL widget that can be used in Tkinter applications 798 - 'minigl' provides access to the subset of OpenGL used by AXIS 799 800 To use these modules in your own scripts, you must ensure that the 801 directory where they reside is on Python's module path. When running an 802 installed version of LinuxCNC, this should happen automatically. When 803 running 'in-place', this can be done by using 804 'scripts/rip-environment'. 805 806 == Using AXIS in Lathe Mode 807 808 By including the line 'LATHE = 1' 809 in the [DISPLAY] section of the ini file, AXIS selects lathe mode. The 810 'Y' axis is not shown in coordinate readouts, the view is changed to 811 show the Z axis extending to the right and the X axis extending towards 812 the bottom of the screen, and several controls (such as those for 813 preset views) are removed. The coordinate readouts for X are replaced 814 with diameter and radius. 815 816 Pressing 'V' zooms out to show the entire file, if one is loaded. 817 818 When in lathe mode, the shape of the loaded tool (if any) is shown. 819 820 .Lathe Tool Shape 821 822 image::images/axis-lathe-tool.png[align="center", alt="Lathe Tool Shape"] 823 824 == Using AXIS in Foam Cutting mode 825 826 By including the line 'FOAM = 1' 827 in the [DISPLAY] section of the ini file, AXIS selects foam-cutting mode. 828 In the program preview, XY motions are displayed in one plane, and UV motions 829 in another. In the live plot, lines are drawn between corresponding points on 830 the XY plane and the UV plane. The special comments (XY_Z_POS) and (UV_Z_POS) 831 set the Z coordinates of these planes, which default to 0 and 1.5 machine units. 832 833 .Foam cutting mode 834 835 image::images/axis-foam.png[align="center", alt="Foam cutting mode"] 836 837 838 == Advanced Configuration 839 840 When AXIS is started it creates the HAL pins for the GUI then it executes 841 the HAL file named in '[HAL]POSTGUI_HALFILE' in the ini file. Only one post 842 GUI file may be used. Place all HAL commands that connect to the GUI HAL pins 843 in the post gui HAL file. 844 845 For more information on ini file settings that can change how AXIS 846 works see the <<sec:display-section,Display Section>> of the INI 847 Configuration Chapter. 848 849 === Program Filters 850 851 AXIS has the ability to send loaded files through a 'filter program'. 852 This filter can do any desired task: Something as simple as making sure 853 the file ends with 'M2', or something as complicated as generating 854 G-Code from an image. 855 856 The '[FILTER]' section of the ini file controls how filters work. 857 First, for each type of file, write a 'PROGRAM_EXTENSION' line. 858 Then, specify the program to execute for each type of file. 859 This program is given the name of the input file as its first argument, 860 and must write rs274ngc code to standard output. This output is what 861 will be displayed in the text area, previewed in the display area, and 862 executed by LinuxCNC when 'Run'. The following lines add support for the 863 'image-to-gcode' converter included with LinuxCNC: 864 865 ---- 866 [FILTER] 867 PROGRAM_EXTENSION = .png,.gif Greyscale Depth Image 868 png = image-to-gcode 869 gif = image-to-gcode 870 ---- 871 872 It is also possible to specify an interpreter: 873 874 ---- 875 PROGRAM_EXTENSION = .py Python Script 876 py = python 877 ---- 878 879 In this way, any Python script can be opened, and its output is 880 treated as g-code. One such example script is available at 881 'nc_files/holecircle.py'. This script creates g-code for drilling a 882 series of holes along the circumference of a circle. 883 884 .Circular Holes 885 886 image::images/holes.png[align="center", alt="Circular Holes"] 887 888 If the environment variable AXIS_PROGRESS_BAR is set, then lines 889 written to stderr of the form 890 891 ---- 892 FILTER_PROGRESS=%d 893 ---- 894 895 will set the AXIS progress bar to the given percentage. This feature 896 should be used by any filter that runs for a long time. 897 898 === The X Resource Database 899 900 The colors of most elements of the AXIS user interface can be 901 customized through the X Resource Database. The sample file 902 'axis_light_background' changes the colors of the backplot window to a 903 'dark lines on white 904 background' scheme, and also serves as a reference for the configurable 905 items in the display area. The sample file 'axis_big_dro' changes the 906 position readout to a larger size font. To use these files: 907 908 ---- 909 xrdb -merge /usr/share/doc/emc2/axis_light_background 910 911 xrdb -merge /usr/share/doc/emc2/axis_big_dro 912 ---- 913 For information about the other items which can be configured in Tk 914 applications, see the Tk man pages. 915 916 Because modern desktop environments automatically make some settings 917 in the X Resource Database that adversely affect AXIS, by default these 918 settings are ignored. To make the X Resource Database items override 919 AXIS defaults, include the following line in your X Resources: 920 921 // These asterisks are not for bold, 922 ---- 923 *Axis*optionLevel: widgetDefault 924 ---- 925 // in this case, we want the asterisks to actually appear. 926 927 this causes the built-in options to be created at the option level 928 'widgetDefault', so that X Resources (which are level 'userDefault') 929 can override them. 930 931 === ~/.axisrc 932 933 If it exists, the contents of `~/.axisrc` are executed as Python 934 source code just before the AXIS GUI is 935 displayed. The details of what may be written in the `~/.axisrc` are subject 936 to change during the development cycle. 937 938 The following adds Control-Q as a keyboard shortcut for Quit. 939 940 ---- 941 root_window.bind("<Control-q>", "destroy .") 942 help2.append(("Control-Q", "Quit")) 943 ---- 944 945 The following stops the "Do you really want to quit" dialog. 946 947 ---- 948 root_window.tk.call("wm","protocol",".","WM_DELETE_WINDOW","destroy .") 949 ---- 950 951 === USER_COMMAND_FILE 952 953 A configuration-specific python file may be specified with an ini file 954 setting '[DISLAY]USER_COMMAND_FILE=filename.py'. Like a `~/.axisrc` file, 955 this file is sourced just before the AXIS GUI is displayed. This file 956 is specific to an ini file configuration not the user's home directory. 957 When this file is specified, an existing `~/.axisrc` file is ignored. 958 959 === user_live_update() 960 961 The axis gui includes a no-op (placeholder) function named 962 'user_live_update()' that is executed at the conclusion of the update() 963 function of its LivePlotter class. This function may be implemented 964 within a `~/.axisrc` python script or a '[DISPLAY]USER_COMMAND_FILE' 965 python script to make custom, periodic actions. The details of what may 966 be accomplished in this function are dependent on the axis gui 967 implementation and subject to change during the development cycle. 968 969 === user_hal_pins() 970 971 The axis gui includes a no-op (placeholder) function named 972 'user_hal_pins()'. + 973 It is executed just after the .axisrc file is called and 974 just before any gladevcp panels / embedded tabs are initialized. + 975 This function may be implemented 976 within a `~/.axisrc` python script or a '[DISPLAY]USER_COMMAND_FILE' 977 python script to make custom HAL pins that use the 'axisui.' prefix. + 978 Use 'comp' as the HAL component instance reference. + 979 HAL comp.ready() is called just after this function returns. 980 981 === External Editor 982 983 The menu options File > Edit... and File > Edit Tool Table... become 984 available after defining the editor in the ini section [DISPLAY]. 985 Useful values include EDITOR=gedit and EDITOR=gnome-terminal -e vim. 986 For more information, see the <<sec:display-section,Display Section>> 987 of the INI Configuration Chapter. 988 989 === Virtual Control Panel 990 991 AXIS can display a custom virtual control panel in the right-hand 992 pane. You can program buttons, indicators, data displays and more. For 993 more information, see the <<cha:pyvcp,PyVCP Chapter>> and the 994 <<cha:glade-vcp,GladeVCP Chapter>>. 995 996 [[axis:preview-control]] 997 998 === Preview Control 999 1000 Special comments can be inserted into the G Code file to control how 1001 the preview of AXIS behaves. In the case where you want to limit the 1002 drawing of the preview use these special comments. Anything between the 1003 (AXIS,hide) and (AXIS,show) will not be drawn during the preview. The 1004 (AXIS,hide) and (AXIS,show) must be used in pairs with the (AXIS,hide) 1005 being first. Anything after a (AXIS,stop) will not be drawn during the 1006 preview. 1007 1008 These comments are useful to unclutter the preview display (for 1009 instance while debugging a larger g-code file, one can disable the 1010 preview on certain parts that are already working OK). 1011 1012 - (AXIS,hide) Stops the preview (must be first) 1013 - (AXIS,show) Resumes the preview (must follow a hide) 1014 - (AXIS,stop) Stops the preview from here to the end of the file. 1015 - (AXIS,notify,the_text) Displays the_text as an info display 1016 This display can be useful in the Axis preview when (debug,message) 1017 comments are not displayed. 1018 1019 === Axisui Pins 1020 1021 To improve the interaction of AXIS with physical jog wheels, the axis 1022 currently selected in the GUI is also reported on a pin with a name 1023 like 'axisui.jog.x'. One of these pins is 'TRUE' at one time, and the rest are 1024 'FALSE'. These are meant to control motion's jog-enable pins. 1025 1026 .Axisui Pins 1027 1028 Axis has Hal pins to indicate which jog radio button is selected in the 1029 'Manual Control' tab. 1030 1031 ---- 1032 Type Dir Name 1033 bit OUT axisui.jog.x 1034 bit OUT axisui.jog.y 1035 bit OUT axisui.jog.z 1036 bit OUT axisui.jog.a 1037 bit OUT axisui.jog.b 1038 bit OUT axisui.jog.c 1039 bit OUT axisui.jog.u 1040 bit OUT axisui.jog.v 1041 bit OUT axisui.jog.w 1042 ---- 1043 1044 Axis has a Hal pin to indicate the jog increment selected on the 'Manual Tab'. 1045 ---- 1046 Type Dir Name 1047 float OUT axisui.jog.increment 1048 ---- 1049 1050 Axis has Hal input pins to clear the pop up notifications for errors and 1051 information. 1052 1053 ---- 1054 Type Dir Name 1055 bit IN axisui.notifications-clear 1056 bit IN axisui.notifications-clear-error 1057 bit IN axisui.notifications-clear-info 1058 ---- 1059 1060 Axis has a Hal input pin that disables/enables the 'Pause/Resume' funtion. 1061 ---- 1062 Type Dir Name 1063 bit IN axisui.resume-inhibit 1064 ---- 1065 1066 == Axis Customization Hints 1067 1068 Axis is a fairly large and difficult-to-penetrate code base, this is helpful 1069 To keep the code stable but makes it difficult to customize. + 1070 Here we will show code snippets to modify behaviours or visuals of the screen. 1071 Keep in mind the internal code of AXIS can change from time to time. + 1072 these snippets are not guaranteed to continue to work - they may need adjustment. 1073 1074 === The update function 1075 1076 There is a function in Axis named user_live_update that is called 1077 every time Axis updates itself. You can use this to update your own functions. 1078 [source,python] 1079 ---- 1080 1081 # continuous update function 1082 def user_live_update(): 1083 print 'i am printed every update...' 1084 ---- 1085 1086 === Disable the Close Dialog 1087 1088 [source,python] 1089 ---- 1090 # disable the do you want to close dialog 1091 root_window.tk.call("wm","protocol",".","WM_DELETE_WINDOW","destroy .") 1092 ---- 1093 === Change the Text Font 1094 1095 [source,python] 1096 ---- 1097 # change the font 1098 1099 font = 'sans 11' 1100 fname,fsize = font.split() 1101 root_window.tk.call('font','configure','TkDefaultFont','-family',fname,'-size',fsize) 1102 1103 # redo the text in tabs so they resize for the new default font 1104 1105 root_window.tk.call('.pane.top.tabs','itemconfigure','manual','-text',' Manual - F3 ') 1106 root_window.tk.call('.pane.top.tabs','itemconfigure','mdi','-text',' MDI - F5 ') 1107 root_window.tk.call('.pane.top.right','itemconfigure','preview','-text',' Preview ') 1108 root_window.tk.call('.pane.top.right','itemconfigure','numbers','-text',' DRO ') 1109 1110 1111 # gcode font is independent 1112 1113 root_window.tk.call('.pane.bottom.t.text','configure','-foreground','blue') 1114 #root_window.tk.call('.pane.bottom.t.text','configure','-foreground','blue','-font',font) 1115 #root_window.tk.call('.pane.bottom.t.text','configure','-foreground','blue','-font',font,'-height','12') 1116 ---- 1117 1118 === Modify Rapid Rate with Keyboard Shortcuts 1119 1120 [source,python] 1121 ---- 1122 # use control + ` or 1-0 as keyboard shortcuts for rapidrate and keep ` or 1-0 for feedrate 1123 # also adds text to quick reference in help 1124 1125 help1.insert(10,("Control+ `,1..9,0", _("Set Rapid Override from 0% to 100%")),) 1126 1127 root_window.bind('<Control-Key-quoteleft>',lambda event: set_rapidrate(0)) 1128 root_window.bind('<Control-Key-1>',lambda event: set_rapidrate(10)) 1129 root_window.bind('<Control-Key-2>',lambda event: set_rapidrate(20)) 1130 root_window.bind('<Control-Key-3>',lambda event: set_rapidrate(30)) 1131 root_window.bind('<Control-Key-4>',lambda event: set_rapidrate(40)) 1132 root_window.bind('<Control-Key-5>',lambda event: set_rapidrate(50)) 1133 root_window.bind('<Control-Key-6>',lambda event: set_rapidrate(60)) 1134 root_window.bind('<Control-Key-7>',lambda event: set_rapidrate(70)) 1135 root_window.bind('<Control-Key-8>',lambda event: set_rapidrate(80)) 1136 root_window.bind('<Control-Key-9>',lambda event: set_rapidrate(90)) 1137 root_window.bind('<Control-Key-0>',lambda event: set_rapidrate(100)) 1138 root_window.bind('<Key-quoteleft>',lambda event: set_feedrate(0)) 1139 root_window.bind('<Key-1>',lambda event: set_feedrate(10)) 1140 root_window.bind('<Key-2>',lambda event: set_feedrate(20)) 1141 root_window.bind('<Key-3>',lambda event: set_feedrate(30)) 1142 root_window.bind('<Key-4>',lambda event: set_feedrate(40)) 1143 root_window.bind('<Key-5>',lambda event: set_feedrate(50)) 1144 root_window.bind('<Key-6>',lambda event: set_feedrate(60)) 1145 root_window.bind('<Key-7>',lambda event: set_feedrate(70) 1146 root_window.bind('<Key-8>',lambda event: set_feedrate(80)) 1147 root_window.bind('<Key-9>',lambda event: set_feedrate(90)) 1148 root_window.bind('<Key-0>',lambda event: set_feedrate(100)) 1149 ---- 1150 1151 === Read the INI file 1152 1153 [source,python] 1154 ---- 1155 # read an ini file item 1156 1157 machine = inifile.find('EMC','MACHINE') 1158 print 'machine name =',machine 1159 ---- 1160 1161 1162 === Read linuxcnc Status 1163 1164 [source,python] 1165 ---- 1166 # linuxcnc status can be read from s. 1167 1168 print s.actual_position 1169 print s.paused 1170 ---- 1171 === Change the current view 1172 1173 [source,python] 1174 ---- 1175 # set the view of the preview 1176 # valid views are view_x view_y view_y2 view_z view_z2 view_p 1177 1178 commands.set_view_z() 1179 ---- 1180 1181 === Creating new AXISUI HAL Pins 1182 1183 [source,python] 1184 ---- 1185 def user_hal_pins(): 1186 comp.newpin('my-new-in-pin', hal.HAL_BIT, hal.HAL_IN) 1187 comp.ready() 1188 ---- 1189 1190 === Creating new HAL Component and Pins 1191 1192 [source,python] 1193 ---- 1194 # create a component 1195 1196 mycomp = hal.component('my_component') 1197 mycomp.newpin('idle-led',hal.HAL_BIT,hal.HAL_IN) 1198 mycomp.newpin('pause-led',hal.HAL_BIT,hal.HAL_IN) 1199 mycomp.ready() 1200 1201 # connect pins 1202 1203 hal.new_sig('idle-led',hal.HAL_BIT) 1204 hal.connect('halui.program.is-idle','idle-led') 1205 hal.connect('my_component.idle-led','idle-led') 1206 1207 # set a pin 1208 1209 hal.set_p('my_component.pause-led','1') 1210 1211 # get a pin 2,8+ branch 1212 1213 value = hal.get_value('halui.program.is-idle') 1214 print 'value is a',type(value),'value of',value 1215 ---- 1216 1217 === Switch Tabs with HAL Pins 1218 1219 [source,python] 1220 ---- 1221 # hal pins from a GladeVCP panel will not be ready when user_live_update is run 1222 # to read them you need to put them in a try/except block 1223 1224 # the following example assumes 5 HAL buttons in a GladeVCP panel used to switch 1225 # the tabs in the Axis screen. 1226 # button names are 'manual-tab', 'mdi-tab', 'preview-tab', 'dro-tab', 'user0-tab' 1227 # the user_0 tab if it exists would be the first GladeVCP embedded tab 1228 1229 # for linuxCNC 2.8+ branch 1230 1231 def user_live_update(): 1232 try: 1233 if hal.get_value('gladevcp.manual-tab'): 1234 root_window.tk.call('.pane.top.tabs','raise','manual') 1235 elif hal.get_value('gladevcp.mdi-tab'): 1236 root_window.tk.call('.pane.top.tabs','raise','mdi') 1237 elif hal.get_value('gladevcp.preview-tab'): 1238 root_window.tk.call('.pane.top.right','raise','preview') 1239 elif hal.get_value('gladevcp.numbers-tab'): 1240 root_window.tk.call('.pane.top.right','raise','numbers') 1241 elif hal.get_value('gladevcp.user0-tab'): 1242 root_window.tk.call('.pane.top.right','raise','user_0') 1243 except: 1244 pass 1245 ---- 1246 1247 === Add Buttons 1248 1249 ==== Add a GOTO Home button 1250 1251 [source,python] 1252 ---- 1253 def goto_home(axis): 1254 if s.interp_state == linuxcnc.INTERP_IDLE: 1255 home = inifile.find('JOINT_' + str(inifile.find('TRAJ', 'COORDINATES').upper().index(axis)), 'HOME') 1256 mode = s.task_mode 1257 if s.task_mode != linuxcnc.MODE_MDI: 1258 c.mode(linuxcnc.MODE_MDI) 1259 c.mdi('G53 G0 ' + axis + home) 1260 1261 # make a button to home y axis 1262 root_window.tk.call('button','.pane.top.tabs.fmanual.homey','-text','Home Y','-command','goto_home Y','-height','2') 1263 1264 # place the button 1265 root_window.tk.call('grid','.pane.top.tabs.fmanual.homey','-column','1','-row','7','-columnspan','2','-padx','4','-sticky','w') 1266 1267 # any function called from tcl needs to be added to TclCommands 1268 TclCommands.goto_home = goto_home 1269 commands = TclCommands(root_window) 1270 ---- 1271 1272 ==== Add Button to manual frame 1273 1274 [source,python] 1275 ---- 1276 # make a new button and put it in the manual frame 1277 1278 root_window.tk.call('button','.pane.top.tabs.fmanual.mybutton','-text','My Button','-command','mybutton_clicked','-height','2') 1279 root_window.tk.call('grid','.pane.top.tabs.fmanual.mybutton','-column','1','-row','6','-columnspan','2','-padx','4','-sticky','w') 1280 1281 # the above send the "mybutton_clicked" command when clicked 1282 # other options are to bind a press or release (or both) commands to the button 1283 # these can be in addition to or instead of the clicked command 1284 # if instead of then delete '-command','mybutton_clicked', from the first line 1285 1286 # Button-1 = left mouse button, 2 = right or 3 = middle 1287 1288 root_window.tk.call('bind','.pane.top.tabs.fmanual.mybutton','<Button-1>','mybutton_pressed') 1289 root_window.tk.call('bind','.pane.top.tabs.fmanual.mybutton','<ButtonRelease-1>','mybutton_released') 1290 1291 # functions called from the buttons 1292 1293 def mybutton_clicked(): 1294 print 'mybutton was clicked' 1295 def mybutton_pressed(): 1296 print 'mybutton was pressed' 1297 def mybutton_released(): 1298 print 'mybutton was released' 1299 1300 # any function called from tcl needs to be added to TclCommands 1301 1302 TclCommands.mybutton_clicked = mybutton_clicked 1303 TclCommands.mybutton_pressed = mybutton_pressed 1304 TclCommands.mybutton_released = mybutton_released 1305 commands = TclCommands(root_window) 1306 ---- 1307 1308 === Reading Internal Variables 1309 1310 [source,python] 1311 ---- 1312 # the following variables may be read from the vars instance 1313 1314 print vars.machine.get() 1315 print vars.emcini.get() 1316 1317 ---- 1318 1319 active_codes = StringVar 1320 block_delete = BooleanVar 1321 brake = BooleanVar 1322 coord_type = IntVar 1323 display_type = IntVar 1324 dro_large_font = IntVar 1325 emcini = StringVar 1326 exec_state = IntVar 1327 feedrate = IntVar 1328 flood = BooleanVar 1329 grid_size = DoubleVar 1330 has_editor = IntVar 1331 has_ladder = IntVar 1332 highlight_line = IntVar 1333 interp_pause = IntVar 1334 interp_state = IntVar 1335 ja_rbutton = StringVar 1336 jog_aspeed = DoubleVar 1337 jog_speed = DoubleVar 1338 kinematics_type = IntVar 1339 linuxcnctop_command = StringVar 1340 machine = StringVar 1341 max_aspeed = DoubleVar 1342 max_maxvel = DoubleVar 1343 max_queued_mdi_commands = IntVar 1344 max_speed = DoubleVar 1345 maxvel_speed = DoubleVar 1346 mdi_command = StringVar 1347 metric = IntVar 1348 mist = BooleanVar 1349 motion_mode = IntVar 1350 on_any_limit = BooleanVar 1351 optional_stop = BooleanVar 1352 override_limits = BooleanVar 1353 program_alpha = IntVar 1354 queued_mdi_commands = IntVar 1355 rapidrate = IntVar 1356 rotate_mode = BooleanVar 1357 running_line = IntVar 1358 show_distance_to_go = IntVar 1359 show_extents = IntVar 1360 show_live_plot = IntVar 1361 show_machine_limits = IntVar 1362 show_machine_speed = IntVar 1363 show_program = IntVar 1364 show_pyvcppanel = IntVar 1365 show_rapids = IntVar 1366 show_tool = IntVar 1367 show_offsets = IntVar 1368 spindledir = IntVar 1369 spindlerate = IntVar 1370 task_mode = IntVar 1371 task_paused = IntVar 1372 task_state = IntVar 1373 taskfile = StringVar 1374 teleop_mode = IntVar 1375 tool = StringVar 1376 touch_off_system = StringVar 1377 trajcoordinates = StringVar 1378 tto_g11 = BooleanVar 1379 view_type = IntVar 1380 1381 === Hide Widgets 1382 1383 [source,python] 1384 ---- 1385 # hide a widget 1386 # use 'grid' or 'pack' depending on how it was originally placed 1387 1388 root_window.tk.call('grid','forget','.pane.top.tabs.fmanual.jogf.zerohome.tooltouch') 1389 ---- 1390 1391 === Change a label 1392 1393 [source,python] 1394 ---- 1395 # change label of a widget 1396 root_window.tk.call('setup_widget_accel','.pane.top.tabs.fmanual.mist','Downdraft') 1397 1398 # make sure it appears (only needed in this case if the mist button was hidden) 1399 root_window.tk.call('grid','.pane.top.tabs.fmanual.mist','-column','1','-row','5','-columnspan','2','-padx','4','-sticky','w') 1400 ---- 1401 1402 === Redirect an existing command 1403 1404 [source,python] 1405 ---- 1406 # hijack an existing command 1407 # originally the mist button calls the mist function 1408 1409 root_window.tk.call('.pane.top.tabs.fmanual.mist','configure','-command','hijacked_command') 1410 1411 # The new function 1412 1413 def hijacked_command(): 1414 print 'hijacked mist command' 1415 1416 # add the function to TclCommands 1417 1418 TclCommands.hijacked_command = hijacked_command 1419 commands = TclCommands(root_window) 1420 ---- 1421 1422 === Change the DRO color 1423 1424 [source,python] 1425 ---- 1426 # change dro screen 1427 1428 root_window.tk.call('.pane.top.right.fnumbers.text','configure','-foreground','green','-background','black') 1429 ---- 1430 1431 === Change the Toolbar Buttons 1432 1433 [source,python] 1434 ---- 1435 # change the toolbar buttons 1436 1437 buW = '3' 1438 buH = '2' 1439 boW = '3' 1440 1441 root_window.tk.call('.toolbar.machine_estop','configure','-image','','-text','ESTOP','-width',buW,'-height',buH,'-borderwidth',boW) 1442 root_window.tk.call('.toolbar.machine_power','configure','-image','','-text','POWER','-width',buW,'-height',buH,'-borderwidth',boW) 1443 root_window.tk.call('.toolbar.file_open','configure','-image','','-text','OPEN','-width',buW,'-height',buH,'-borderwidth',boW) 1444 root_window.tk.call('.toolbar.reload','configure','-image','','-text','RELOAD','-width',buW,'-height',buH,'-borderwidth',boW) 1445 root_window.tk.call('.toolbar.program_run','configure','-image','','-text','RUN','-width',buW,'-height',buH,'-borderwidth',boW) 1446 root_window.tk.call('.toolbar.program_step','configure','-image','','-text','STEP','-width',buW,'-height',buH,'-borderwidth',boW) 1447 root_window.tk.call('.toolbar.program_pause','configure','-image','','-text','PAUSE','-width',buW,'-height',buH,'-borderwidth',boW) 1448 root_window.tk.call('.toolbar.program_stop','configure','-image','','-text','STOP','-width',buW,'-height',buH,'-borderwidth',boW) 1449 root_window.tk.call('.toolbar.program_blockdelete','configure','-image','','-text','Skip /','-width',buW,'-height',buH,'-borderwidth',boW) 1450 root_window.tk.call('.toolbar.program_optpause','configure','-image','','-text','M1','-width',buW,'-height',buH,'-borderwidth',boW) 1451 root_window.tk.call('.toolbar.view_zoomin','configure','-image','','-text','Zoom+','-width',buW,'-height',buH,'-borderwidth',boW) 1452 root_window.tk.call('.toolbar.view_zoomout','configure','-image','','-text','Zoom-','-width',buW,'-height',buH,'-borderwidth',boW) 1453 root_window.tk.call('.toolbar.view_z','configure','-image','','-text','Top X','-width',buW,'-height',buH,'-borderwidth',boW) 1454 root_window.tk.call('.toolbar.view_z2','configure','-image','','-text','Top Y','-width',buW,'-height',buH,'-borderwidth',boW) 1455 root_window.tk.call('.toolbar.view_x','configure','-image','','-text','Right','-width',buW,'-height',buH,'-borderwidth',boW) 1456 root_window.tk.call('.toolbar.view_y','configure','-image','','-text','Front','-width',buW,'-height',buH,'-borderwidth',boW) 1457 root_window.tk.call('.toolbar.view_p','configure','-image','','-text','3D','-width',buW,'-height',buH,'-borderwidth',boW) 1458 root_window.tk.call('.toolbar.rotate','configure','-image','','-text','Rotate','-width',buW,'-height',buH,'-borderwidth',boW) 1459 root_window.tk.call('.toolbar.clear_plot','configure','-image','','-text','Clear','-width',buW,'-height',buH,'-borderwidth',boW) 1460 ----