View Full Version : How to creat new Keyboard shortcuts?


strider5623
06-05-2008, 12:31 PM
I have set up EMC2 with four axis and now need to set up the fourth axis with a couple of shortcuts on the key board. I would like to use "Insert and Delete" keys to jog the fourth axis. Does anybody know how to do this? I have tried adding to the tkemc.tlc file but keep coming up with errors. Here is what I have added, maybe I didnt add something properly,




proc priorDone {} {
jogStop 2
bind ManualBindings <KeyPress-Prior> priorDown
}

proc priorDown {} {
axisSelect 2
bind ManualBindings <KeyPress-Prior> {}
after cancel priorDone
jogPos 2
}

proc priorUp {} {
global debounceTime

after cancel priorDone
after $debounceTime priorDone
}

bind ManualBindings <KeyPress-Prior> priorDown
bind ManualBindings <KeyRelease-Prior> priorUp

proc nextDone {} {
jogStop 2
bind ManualBindings <KeyPress-Next> nextDown
}

proc nextDown {} {
axisSelect 2
bind ManualBindings <KeyPress-Next> {}
after cancel nextDone
jogNeg 2
}

proc nextUp {} {
global debounceTime

after cancel nextDone
after $debounceTime nextDone
}

bind ManualBindings <KeyPress-Next> nextDown
bind ManualBindings <KeyRelease-Next> nextUp

################################################################
# Added for fourth axis

proc insertDone {} {
jogStop 3
bind ManualBindings <KeyPress-Insert> insertDown
}

proc insertDown {} {
axisSelect 3
bind ManualBindings <KeyPress-Insert> {}
after cancel insertDone
jogPos 3
}

proc insertUp {} {
global debounceTime

after cancel insertDone
after $debounceTime insertDone
}

bind ManualBindings <KeyPress-Insert> insertDown
bind ManualBindings <KeyRelease-Insert> insertUp

proc insertDone {} {
jogStop 3
bind ManualBindings <KeyPress-Delete> deleteDown
}

proc deleteDown {} {
axisSelect 3
bind ManualBindings <KeyPress-Delete> {}
after cancel deleteDone
jogNeg 3
}

proc deleteUp {} {
global debounceTime

after cancel deleteDone
after $debounceTime deleteDone
}

bind ManualBindings <KeyPress-Delete> deleteDown
bind ManualBindings <KeyRelease-Delete> deleteUp

###################################################################

bind . <Escape> {tkemc_abort}

# force explicit updates, so calls to emc_estop, for example, don't
# always cause an NML read; they just return last latched status
emc_update none







Any help would be greatly appreciated. I do not understand the tcl langauge that well, so if any one out there could give me some advice as to what I am doing wrong, I would be very grateful. Thank you for your patience.:)

strider5623
06-05-2008, 01:05 PM
Ok, I figured it out. Here is the revision.

################################################

proc priorDone {} {
jogStop 2
bind ManualBindings <KeyPress-Prior> priorDown
}

proc priorDown {} {
axisSelect 2
bind ManualBindings <KeyPress-Prior> {}
after cancel priorDone
jogPos 2
}

proc priorUp {} {
global debounceTime

after cancel priorDone
after $debounceTime priorDone
}

bind ManualBindings <KeyPress-Prior> priorDown
bind ManualBindings <KeyRelease-Prior> priorUp

proc nextDone {} {
jogStop 2
bind ManualBindings <KeyPress-Next> nextDown
}

proc nextDown {} {
axisSelect 2
bind ManualBindings <KeyPress-Next> {}
after cancel nextDone
jogNeg 2
}

proc nextUp {} {
global debounceTime

after cancel nextDone
after $debounceTime nextDone
}

bind ManualBindings <KeyPress-Next> nextDown
bind ManualBindings <KeyRelease-Next> nextUp

######################################

proc insertDone {} {
jogStop 3
bind ManualBindings <KeyPress-Insert> insertDown
}

proc insertDown {} {
axisSelect 3
bind ManualBindings <KeyPress-Insert> {}
after cancel insertDone
jogPos 3
}

proc insertUp {} {
global debounceTime

after cancel insertDone
after $debounceTime insertDone
}

bind ManualBindings <KeyPress-Insert> insertDown
bind ManualBindings <KeyRelease-Insert> insertUp

proc deleteDone {} {
jogStop 3
bind ManualBindings <KeyPress-Delete> deleteDown
}

proc deleteDown {} {
axisSelect 3
bind ManualBindings <KeyPress-Delete> {}
after cancel deleteDone
jogNeg 3
}

proc deleteUp {} {
global debounceTime

after cancel deleteDone
after $debounceTime deleteDone
}

bind ManualBindings <KeyPress-Delete> deleteDown
bind ManualBindings <KeyRelease-Delete> deleteUp
###################################################
bind . <Escape> {tkemc_abort}


Note: I had to use a diffrent editor from the default. I ended up using Screem HTML/XML editor.