Select specific view cube orientation in part file

Select specific view cube orientation in part file

C_Haines_ENG
Collaborator Collaborator
482 Views
8 Replies
Message 1 of 9

Select specific view cube orientation in part file

C_Haines_ENG
Collaborator
Collaborator

I would like to find an ilogic way to select this viewcube angle:

chainesL5H3G_0-1668016053839.png

Everwhere else I have looked only seem to rotate a part of possibly zoom out, but I would like to select this specific angle so the entire part is in view.

0 Likes
483 Views
8 Replies
Replies (8)
Message 2 of 9

WCrihfield
Mentor
Mentor

Hi @C_Haines_ENG.  Here are a few things you can try:

'ThisApplication.UserInterfaceManager.ShowViewCube = True
'oView = ThisApplication.ActiveView
'oView.Fit
'oView.GoHome
'ThisApplication.CommandManager.ControlDefinitions.Item ("AppViewCubeHomeCmd").Execute
ThisApplication.CommandManager.ControlDefinitions.Item("AppIsometricViewCmd").Execute

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 9

C_Haines_ENG
Collaborator
Collaborator

Is it possible to select specific corners of the viewcube?

0 Likes
Message 4 of 9

J-Camper
Advisor
Advisor

@C_Haines_ENG,

 

Use the Camera object, then you can set it to any ViewOrientationTypeEnum.  Here is your example:

 

Dim oCamera As Camera = ThisApplication.ActiveView.Camera 
oCamera.ViewOrientationType = ViewOrientationTypeEnum.kIsoTopRightViewOrientation
oCamera.Apply

 

0 Likes
Message 5 of 9

C_Haines_ENG
Collaborator
Collaborator

Sadly doesnt allow you to select the back two iso views does it?

 

My ultimate goal was to have the part rotate smoothly around as you enter a value. 

0 Likes
Message 6 of 9

WCrihfield
Mentor
Mentor

Hi @C_Haines_ENG.  Have you checked out the API sample available in the online help area that demonstrates rotating the camera.  The code is in VBA, instead of iLogic, but it sounds similar to what you might be interested in.  It basically loops through a cycle of changing camera settings and applying those changes, which causes the model to seemingly rotate before your eyes.  Below is the link to it.

https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=DriveCamera_Sample 

This link can also be found on the same page where the Camera API object is described.

https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Camera 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 7 of 9

C_Haines_ENG
Collaborator
Collaborator

Only seems to work in VBA, as the ATN variable just doesnt exist in ilogic.

0 Likes
Message 8 of 9

J-Camper
Advisor
Advisor

@C_Haines_ENG,

 

That is just the arctangent/inverse tangent. In VB.net it is Atan.  You can also use Math.PI:

 

Dim pi As Double
    pi = Atan(1) * 4
	Logger.Trace(pi)
	pi = Math.PI
	Logger.Trace(pi)

 

Message 9 of 9

WCrihfield
Mentor
Mentor

Here is the iLogic version of that sample, so you can test it out.  The 'ATN' in VBA is 'Math.Atan()' in iLogic.

Sub Main 'RotateCamera()
    ' Get the active camera.
    Dim cam As Camera = ThisApplication.ActiveView.Camera
    Dim tg As TransientGeometry = ThisApplication.TransientGeometry
    ' Define the number of steps in the animation.
    Dim steps As Integer = 360
    ' Define the distance between the eye and target.
    Dim eyeDistance As Double = 15
    ' Calculate pi.
    Dim pi As Double = Math.Atan(1) * 4
    ' Iterate the specified number of steps.
    Dim i As Integer
    For i = 1 To steps
        ' Calculate the x and y coordinates of the eye.
        Dim x As Double = eyeDistance * Cos(i / steps * (2 * pi))
        Dim y As Double = eyeDistance * Sin(i / steps * (2 * pi))
        ' Set the eye with a hard coded z value.
        cam.Eye = tg.CreatePoint(x, y, 3)
        ' Define the up vector as positive z.
        cam.UpVector = tg.CreateUnitVector(0, 0, 1)
        ' Apply the current camera definition to the view.
        cam.ApplyWithoutTransition
    Next
End Sub

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes