IvanShubin Posted June 22, 2016 Share Posted June 22, 2016 I create my app on the C# with using Autodesk.AutoCAD.Interop to interact with AutoCad. I try to receive camera direction: var _app = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application"); var viewport = _app.ActiveDocument.ActiveViewport; var dir = viewport.Direction; but after rotaion of the model, I always receive same values of direction. If I use following code: var _app = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application"); var viewport = _app.ActiveDocument.ActiveViewport; var dir = viewport.Direction; and activate viewport on the layout - after rotation of the model I receive difference correct direction. How to receive correct camera direction on the model viewport? Quote Link to comment Share on other sites More sharing options...
SEANT Posted June 23, 2016 Share Posted June 23, 2016 . . . . but after rotaion of the model, I always receive same values of direction. . . . . I found this in the AutoCAD ActiveX (the API in use via Interop) documentation: No editing or view changes can be performed unless the viewport is active. To make a viewport active, use the ActiveViewport property on the Document object. Once changes have been completed, the viewport must be reset as the active viewport for the changes to appear. To reset the active viewport, simply call the ActiveViewport property again with the updated Viewport object. Quote Link to comment Share on other sites More sharing options...
IvanShubin Posted June 29, 2016 Author Share Posted June 29, 2016 Thank you SEANT, But I do not want to update of the ViewPort, I want receive actual value of the Direction. Every time, I create new instance of the ViewPort. But after namual change of the ViewPort Direction in the AutoCad, I alway receive same value of the Direction. If I restart the AutoCad - I receive the updated value of the Direction. Any more ideas? Can somebody check the following code: var _app = (AcadApplication)Marshal.GetActiveObject("AutoCAD.Application"); var viewport = _app.ActiveDocument.ActiveViewport; var dir = viewport.Direction; Maybe I have problems with my AutoCAD. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.