How to set the assembly view to isometric?

Issue

I’m trying to achieve the same through the API as clicking “Isometric View F6” in the view’s context menu. I’m using this code. It usually works but in case of some drawings it’s not the same result. What is causing this difference?

  Set oView = MainAssembly.Views(1)  Set oCamera = oView.Camera  oCamera.ViewOrientationType = kIsoTopRightViewOrientation  oCamera.Apply

Solution

In different assembly documents (and templates) the Isometric View can be set differently, and can also be overridden by the user via the “Redefine ISO View” command. This setting however has no effect on the built in view orientations in the API. E.g. kIsoTopRightViewOrientation always means that Red(X) axis is pointing bottom right, Green(Y) axis is pointing upwards, and Blue(Z) axis of the coordinate system is pointing bottom left on the screen.

Therefore if you want to get the same result as by the “Isometric View F6” command, then just run it from the API:

In VB.NET

 Dim oCtrlDef As ControlDefinitionoCtrlDef = m_inventorApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd")oCtrlDef.Execute()

VBA Code Snippet:

ThisApplication.CommandManager.ControlDefinitions("AppIsometricViewCmd").Execute

Comments

One response to “How to set the assembly view to isometric?”

  1. Why execution of oCtrlDef setting isometric view does not want to work when the userform is opened?
    Is there any way to resolve it?

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading