Community
Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
I need to know how to cast a InwOpAnonView as a InwOpView so that I can Add a View to SavedViews and use ApplyView.
using nw = NavisworksIntegratedAPI9; ... nw.InwOpState4 _state = axnwControlMDI1.APIState as nw.InwOpState4; //copy current view var view= _state.CurrentView.Copy() as nw.InwOpAnonView; //how then do I add to SavedViews? //_state.SavedViews().Add(view as nw.InwOpView); //InwOpView cannot be cast from a InwOpAnonView //How do I apply the View? //_state.ApplyView(view as nw.InwOpView); //InwOpView cannot be cast from a InwOpAnonView
Hi:
Does the following code help?
InwSavedViewsColl savviews = oState.SavedViews();
InwOpView sv = (InwOpView)oState.ObjectFactory(nwEObjectType.eObjectType_nwOpView, null, null);
sv.name = "MySavedView";
sv.anonview = (InwOpAnonView)oState.CurrentView;
savviews.Add(sv);
cheers
Saikat
Can't find what you're looking for? Ask the community or share your knowledge.