Changing Camera View from Perspective to Orthographic Using API?

Changing Camera View from Perspective to Orthographic Using API?

knightsAHN63
Participant Participant
674 Views
2 Replies
Message 1 of 3

Changing Camera View from Perspective to Orthographic Using API?

knightsAHN63
Participant
Participant

Hello all! Has anyone written any scripts or add-ins that change the camera view type? We are developing an add-in and hoping to automatically change our user's view to ensure that it is only 'Orthographic' instead of defaulting to perspective. Any advice is greatly appreciated! Attached is quick screenshot of what we are hoping to do with API.

0 Likes
Accepted solutions (1)
675 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

Hi @knightsAHN63 .

 

You can switch between them using the Camera.cameraType property.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-c1d597b4-69c2-4b91-ab39-659f23f7f61d 

 

The camera is retrieved from the Viewport.camera property, but be aware that you need to reassign it to get a copy.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-2005e69c-36cd-45a2-bb3d-8cf5b968ab9a 

 

The zoom position is quite different from when the cameraType is switched in the GUI.
I've used it here. I couldn't figure out the formula.

https://github.com/kantoku-code/Fusion360_PerspectiveAngleController 

 

Message 3 of 3

knightsAHN63
Participant
Participant

Thank you so much, got it working! Appreciate your help.