Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use KeyDownEvent

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
tomo1230
326 Views, 2 Replies

How to use KeyDownEvent

I want to set home view angles by keydown event .

I was able to control the camera .
How to use KeyDownEvent it can not be good .

For example,executed in the F1 key .
Please tell me !

 

(Since English is not good,can understand the meaning ?)

 

 

#Author-
#Description-

import adsk.core, adsk.fusion, traceback

def move_camera(app, view):
    try:
        camera = view.camera
        target = adsk.core.Point3D.create(0,-1,0)
        eye = adsk.core.Point3D.create(1,0,1)
        camera.target = target
        camera.eye = eye
        camera.isFitView = True
        camera.isSmoothTransition = True
        view.camera = camera
        adsk.doEvents()
        view.refresh()
                
    except:
        ui = app.userInterface
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def main():
    ui = None
  
    try:
        app = adsk.core.Application.get()
        move_camera(app, app.activeViewport)
    
    except:
        ui = app.userInterface
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

main()

 

神原Θ友徳(かんばらΘとものり)Tomonori Kanbara -JAPAN-
この投稿が参考になりましたら、「いいね」を押してください。
この投稿で問題を解決できましたら、「解決策として承認」ボタンを押してください。

EESignature


    
Autodesk Fusion 360 Certified User 資格認定
3Dモデリングによる3Dデータの活用法とデジタル・ファブリケーションの実践!
The method of utilizing 3D data by 3D modeling & Practice of digital fabrication!

http://blog.goo.ne.jp/t2com1230/

   




2 REPLIES 2
Message 2 of 3
marshaltu
in reply to: tomo1230

Hello,

 

Unfortunately our Fusion 360 APIs only support key event for API command(e.g. adsk.core.Command.keyDown, keyUp). You may have to pursue a solution from general language(Python)'s perspective. I saw some related questions were raised in stackoverflow as well.

 

http://stackoverflow.com/questions/694296/detect-in-python-which-keys-are-pressed  

 

Thanks,

Marshal



Marshal Tu
Fusion 360 Developer
Autodesk, Inc.

Message 3 of 3
tomo1230
in reply to: marshaltu

Thank you for your answer.
I understand.

 

神原Θ友徳(かんばらΘとものり)Tomonori Kanbara -JAPAN-
この投稿が参考になりましたら、「いいね」を押してください。
この投稿で問題を解決できましたら、「解決策として承認」ボタンを押してください。

EESignature


    
Autodesk Fusion 360 Certified User 資格認定
3Dモデリングによる3Dデータの活用法とデジタル・ファブリケーションの実践!
The method of utilizing 3D data by 3D modeling & Practice of digital fabrication!

http://blog.goo.ne.jp/t2com1230/

   




Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report