Hi,
I am trying to move the camera to a specific drawing view. But for some reason the camera gives a perspective image..
What am I doing wrong? It's my first time working the camera.. 😄
Dim oCamera As Camera = m_inventorApplication.ActiveView.Camera oCamera.ViewOrientationType = ViewOrientationTypeEnum.kFrontViewOrientation oCamera.Eye = oTG.CreatePoint(oView.Position.X, oView.Position.Y, 0) oCamera.Target = oTG.CreatePoint(oView.Position.X, oView.Position.Y, 0) oCamera.ApplyWithoutTransition()
Solved! Go to Solution.
Solved by MechMachineMan. Go to Solution.
"Views" are anything within the graphical window in inventor.
Your code is simply accessing THAT view.
What you want is to dive into a specific DrawingView and tweak the camera object associated with that DrawingView.
Yes @MechMachineMan And how can I do that? As you see I am failing to do so.
I can move my camera object, but it does not stay parallel to my drawing sheet.
I misunderstood what you are trying to do.
However, the issue is that you are setting your eye and target to be the same point, which doesn't logically make sense. It means that the 2 points are exactly the same and the vector between them is undefined/arbitrary.
You need to supply a Z value to the eye, as I did below:
Dim oView As DrawingView oView = ThisApplication.ActiveDocument.ActiveSheet.DrawingViews(1) Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry Dim oCamera As Camera = ThisApplication.ActiveView.Camera oCamera.ViewOrientationType = ViewOrientationTypeEnum.kFrontViewOrientation oCamera.Eye = oTG.CreatePoint(oView.Position.X, oView.Position.Y, oCamera.Eye.Z) oCamera.Target = oTG.CreatePoint(oView.Position.X, oView.Position.Y, 0) oCamera.ApplyWithoutTransition()
@MechMachineMan Cheers!
Now one more thing, how can I set the zoom distance? What I want is to zoom that the view rangebox occupies most of the camera. If you get what I mean 🙂
Greetings.
Just like this....
Kinda like in this previous post I found asking to do the same thing....
https://forums.autodesk.com/t5/inventor-customization/zoom-to-view-in-drawing/td-p/2655306
SyntaxEditor Code Snippet
Dim oView As DrawingView oView = ThisApplication.ActiveDocument.ActiveSheet.DrawingViews(1) Dim oTG As TransientGeometry oTG = ThisApplication.TransientGeometry Dim oCamera As Camera = ThisApplication.ActiveView.Camera oOversizePct = 2 With oCamera .ViewOrientationType = ViewOrientationTypeEnum.kFrontViewOrientation .Eye = oTG.CreatePoint(oView.Position.X, oView.Position.Y, .Eye.Z) .Target = oTG.CreatePoint(oView.Position.X, oView.Position.Y, 0) .SetExtents(oOversizePct * oView.Width, oOversizePct * oView.Height ) .ApplyWithoutTransition() End With
Can't find what you're looking for? Ask the community or share your knowledge.