After most of the operation, I have to press 'Enter' to finish, 'Enter' is not in a easy position to press.
Is that a way I can write a python script to perform a 'Enter' press? then binding it to 'SPACE', much more easy to press.
I have already write some shortcut in Python to make it easy to work.
For example, I just press a 'G' button then I can go back to home view. It's quite a easy command like below:
def command_execute(args: adsk.core.CommandEventArgs):
futil.log(f"{CMD_NAME} Command Execute Event")
## Go HOME!!!!
app.activeViewport.goHome()
Then set a shortcut 'g' in Fusion, then every time I press 'G', it go back to home view.
So how can I send a 'Enter' in python to Fusion interface? imitate a key press 'Enter' then send it to Fusion to finish an operation?
The only information I got now is the keycode of 'Enter'.
| EnterKeyCode | 16777221 | Enter |
Thanks in advanced if you can share some experience with me ![]()
Solved! Go to Solution.
Solved by acupen. Go to Solution.
Hi,
The pynput package can be used to simulate keystrokes.
Here is a snipped code for the ENTER key:
from pynput.keyboard import Key, Controller
keyboard = Controller()
keyboard.press(Key.enter)
keyboard.release(Key.enter)
I wonder how are you going to trigger its execution: from where? under which conditions?
Regards,
Jorge Jaramillo
Trigger a script you write in Fusion is easy.
1. Run it as Add-Ins,
2. inside your add-ins, you write several commands. Then 'Change Keyboard Shortcut...'
3. just assign a shortcut key for the command(underneath is a script) your write. Then it's done.
During fusion running, every time you press 'g', you trigger your script once ...
and Thanks for your reply.
I figure out a way to achieve what I want to do, beyond Fusion.
Just install a microsoft enhance tool: PowerToys.
https://github.com/microsoft/PowerToys/releases/tag/v0.86.0
then you can switch any keypress with other key in a system level.
I just switch the 'Space' key with 'Enter', everything is done now.
Thanks again for you help.
Can't find what you're looking for? Ask the community or share your knowledge.