Zoom and change camera instantly (without transition animation)

Zoom and change camera instantly (without transition animation)

DRoam
Mentor Mentor
892 Views
1 Reply
Message 1 of 2

Zoom and change camera instantly (without transition animation)

DRoam
Mentor
Mentor

I have an iLogic rule in a Part template file that sets the camera to the home position and the zoom to "fit all" when a new Part is created with the template. It works fine, but one annoying trait is the Part starts zoomed in on the rear (for some reason), and camera transitions are done as animations, which takes time and is unnecessary.

 

Is there any way to disable the camera transition animations, so the camera will instantly go to the right settings when the part is created?

 

I've attached a sample part with my code in it. To test, place the part in your Templates folder and create a new part using the template.

 

Using Inventor 2017.4.7

0 Likes
Accepted solutions (1)
893 Views
1 Reply
Reply (1)
Message 2 of 2

DRoam
Mentor
Mentor
Accepted solution

Well, that was silly. For some reason I didn't think to check the API manual. A quick check and the code as modified below does the trick:

 

If ThisApplication.ActiveDocument Is ThisDoc.Document Then
	'Go to Home view
	oCamera=ThisApplication.ActiveView.Camera
	oCamera.ViewOrientationType = 10759
	oCamera.Fit
	
	oCamera.ApplyWithoutTransition
End If