Uitleg
In AutoCAD wordt er een cirkel geplaatst met een voorgeprogrammeerde radius, op de plek waar de muis op dat moment staat.
Gebruikte functies
~ = Enter
{RIGHT} = Cursor naar rechts
{TAB} = Tab
Programma
Kopieer onderstaande tekst naar LuaMacros
-----------------------------------------------------
-- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');
-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
-----------------------------------------------------
if (button == 97) then -- Numpad 1
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('50') -- radius 50
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 98) then -- Numpad 2
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('100') -- radius 100
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 99) then -- Numpad 3
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('150') -- radius 150
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 100) then -- Numpad 4
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('200') -- radius 200
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 101) then -- Numpad 5
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('250') -- radius 250
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 102) then -- Numpad 6
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('300') -- radius 300
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 103) then -- Numpad 7
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('350') -- radius 350
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 104) then -- Numpad 8
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('400') -- radius 400
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
elseif (button == 105) then -- Numpad 9
lmc_send_keys ('CIRCLE') -- draw a circle
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("{TAB}") -- TAB
lmc_sleep(100)
lmc_send_keys ("{RIGHT}") -- cursor naar rechts
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
lmc_sleep(100)
lmc_send_keys ('450') -- radius 450
lmc_sleep(100)
lmc_send_keys ("~") -- Enter
-----------------------------------------------------
else print('Not yet assigned: ' .. button)
end
end)
-----------------------------------------------------