Hi - I would like to get the current AutoCAD View name in .NET.
Thank you for your help.
However I need the name of the CURRENT active view. How is this obtained pls? Iterating through the ViewTable does not seem to provide this, and there is no link between the ViewTable and dwg.Editor.GetCurrentView();
Looks like the Current View name stored anywhere.
Current view name changes to *Current* after switching to any view.
Maybe that could be the reason why its showing the blank name.
Also I am trying this code to get the CurrentItem Name.
This line seems interesting
Add reference to WindowsBase.dll
The current view (ViewTableRecord object obtained from Editor.GetCurrentView()) does not have name.
ViewTableRecord is just a object that hold some geometric/dimension information on a view displayed by the editor. It can be saved into ViewTable. However, ViewTableRecord is not a view itself (View class represents a physical view in AutoCAD API), it is just a set of geometric/dimesion data that describes a instant moment of a view. With saved ViewTableRecord, AutoCAD can create a View based on it.
View in AutoCAD is constantly changeing while AutoCAD is used. The ViewTableRecord returned by Editor.GetCurrentView() is just an non-database residing object that describe the current view, it does not have an ObjectId/Handle/name assigned. ViewTableRecord only needs name when it is to be added to ViewTable.
When you set a view to a saved view (a ViewTableRecord from ViewTable), AutoCAD simply set the cuurent view/display according to the view information holding by the ViewTableRecord.
So, if you need to know if current view returned by GetCurrentView() is the same as any of the saved ViewTableRecord in dimension, you might have to compare them by their geometry/dimesion, not by name, beause current view doe not have name (AutoCAD always give it a name "Current" to user when display it in AutoCAD UI.
Thank you for the replies.
Comparing the GetCurrentView view to the ViewTableRecord is unfortunately not a viable solution. Once the user has panned the camera, there is no way to match the GetCurrentView view to the Model View returned from the ViewTable iterator (via Target, or ViewDirection), because the GetCurrentView has been updated by the Pan, and the ViewTable record has not.
Access a broad range of knowledge to help get the most out of your products and services.