I was asked today at RTC if it would be possible to delete all views in a Revit file in preparation for publishing the model to other firms.
It was a little more complicated than I thought and is contrary to all those kumbaya ideas about sharing and collaboration, but if this is something you need to do, the API can save you a bunch of clicking in the Project Browser.
The 3D geometry in the model still exists after the command completes and you can use the UI to create new 3D and plan views.
There may be a problem with deleting all views in a project via the API. First of all, it should not at all be possible to do in an active project. Secondly, Revit would traditionally close a project when its last view is deleted, which may have some unpleasant side effects.
Hi Arnost – Before deleting all existing views in the project, I programatically created a new, empty drafting view which does not get deleted.