how can I rotate/move the view using external software (=send yaw/pitch/roll or pan x,y,z via an API)?

how can I rotate/move the view using external software (=send yaw/pitch/roll or pan x,y,z via an API)?

Anonymous
Not applicable
808 Views
5 Replies
Message 1 of 6

how can I rotate/move the view using external software (=send yaw/pitch/roll or pan x,y,z via an API)?

Anonymous
Not applicable

Hi, I'd like to rotate the view through yaw/pitch/roll or panning x,y,z via an API, how could I do that? (from any programming language).  Basically, the same thing a 3DConnexion spacemouse does out of the box.

 

Could you give me an example in any language, or point me to where I can find one? 

 

What API can I use to do that?

0 Likes
Accepted solutions (1)
809 Views
5 Replies
Replies (5)
Message 2 of 6

garrygoldberg1
Contributor
Contributor

Thanks for this situation! I also have the same!

0 Likes
Message 3 of 6

tykapl.breuil
Advocate
Advocate
Accepted solution

For this you can use the Viewport and camera objects of the api. (Documentation can be found on the site, here for example)

Here's a sample code to activate the back view for example :

import adsk.core, adsk.fusion, adsk.cam, traceback

def run(context):
    global ui
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        viewport = app.activeViewport
        camera = viewport.camera
        camera.viewOrientation = adsk.core.ViewOrientations.BackViewOrientation
        viewport.camera = camera

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 Just be careful about one detail, the camera method of a viewport only returns a copy of the camera, to change the viewport's camera, you need to reassign the modified camera.

Message 4 of 6

Anonymous
Not applicable

Thank you! I appreciate it. I actually tried to look through the API myself but didn't find this (I just missed it), so I really owe you one.  I think this is enough for what I'm doing, I'll post again if I get stuck!  I like that you included a code sample and what to watch out for while using it, this makes me feel supported and welcome even as a newbie. It might feel like a small thing to you, but I already tried looking through it myself and didn't find it, this is literally in my project management software:

 

https://ibb.co/2ht2HtB

 

image.png

 

and I already wrote it off as "not possible", because I missed it myself, and I had to move on to some alternative way of trying to do what I'm trying to do.  this was a blocker to getting my work done, so this unlocks a path forward and removes a hurdle. it feels good.

 

thanks four your support and I hope to get more if I get badly stuck again.  I hope when I am a more advanced user I'll be able to repay the favor!

Message 5 of 6

BrianEkins
Mentor
Mentor

There's a code sample in this post that shows manipulating the camera and updating the view to create an animation.

 

https://forums.autodesk.com/t5/fusion-360-api-and-scripts/trying-to-create-a-python-script-to-animat...

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 6 of 6

garrygoldberg1
Contributor
Contributor

Once you've developed the skeleton of your app, you need to submit it for approval through the Google Play Developer Console. You'll have to pay $25 to register for an account. Once you've registered for an account, you can start developing your application. You can use the Android SDK to create and manage applications of all types. And if you're using Java, it's a good idea to learn Java. View this review https://mlsdev.com/blog/54-benefits-of-outsourcing-mobile-app-development 

0 Likes