The View object in Inventor is basically just a wrapper for the window and
doesn't control what's being viewed within the window. This control is
exposed through the Camera object, which you get from the View object. You
can't explicitly define the camera using a matrix, but you could derive the
information from a matrix to set the various properties of the Camera. The
camera is defined by an eye and target point and up vector. For a
perspective camera you can also supply a perspective angle or for a parallel
camera you can define the extents of the viewable volume.
Here's an example that will fly around the curent part or assembly.
Public Sub FlyAround()
Dim oCamera As Camera
Set oCamera = ThisApplication.ActiveView.Camera
' Create a circle that will reprsent the path of the camera
' where the target point and up vector will remain the same
' but the eye will sweep around.
Dim oCircle As Inventor.Circle
Set oCircle = ThisApplication.TransientGeometry.CreateCircle( _
oCamera.Target, oCamera.UpVector,
oCamera.Target.DistanceTo(oCamera.Eye))
Dim iStepCount As Integer
iStepCount = Val(InputBox("Enter number of steps", "Camera Sample",
"360"))
' Get the evaluator from the circle to get points along the circle.
Dim oCurveEval As CurveEvaluator
Set oCurveEval = oCircle.Evaluator
' Define Pi
Dim dPi As Double
dPi = Atn(1) * 4
' Calculate the angle to step with each increment.
Dim dIncrement As Double
dIncrement = (dPi * 2) / iStepCount
' Determine the position along the circle where the eye currently is.
Dim dCurrent As Double
Dim adEye(2) As Double
adEye(0) = oCamera.Eye.X
adEye(1) = oCamera.Eye.Y
adEye(2) = oCamera.Eye.Z
Dim adGuessparams() As Double
Dim adMaxDeviations() As Double
Dim adParams(0) As Double
Dim aenSolTypes() As SolutionNatureEnum
Call oCurveEval.GetParamAtPoint(adEye, adGuessparams, _
adMaxDeviations, adParams, aenSolTypes)
' Initialize the position using the current eye position.
dCurrent = adParams(0)
' Step around the circle.
Dim i As Integer
For i = 1 To iStepCount
' Calculate a point on the circle using the current parameter.
adParams(0) = dCurrent
Dim adPoint(2) As Double
Call oCurveEval.GetPointAtParam(adParams, adPoint)
' Create a point that defines the eye position.
Dim oNewEye As Point
Set oNewEye = ThisApplication.TransientGeometry.CreatePoint( _
adPoint(0), adPoint(1), adPoint(2))
' Set the eye and apply the camera.
oCamera.Eye = oNewEye
oCamera.ApplyWithoutTransition
' Increment the parameter value.
dCurrent = dCurrent + dIncrement
Next
End Sub
--
Brian Ekins
Autodesk Inventor API
wrote in message news:5944061@discussion.autodesk.com...
Josh, thanks for your reply.
I was hoping to manipulate the Application.ActiveView with a matrix, but
perhaps I can get the same effect by transforming every object in the view
instead, by using ComponentOccurrence.
If I transform all objects in my active view with the inverse transform
matrix meant for the camera, the effect would be the same.. correct?