This lesson covers, in two parts, the five main interfaces related to drawing automation: IDrawingDoc, ISheet, IView, IAnnotation, and ITableAnnotation. The creation of a fairly complex drawing is automated using these five interfaces.
In order to determine the type of view (e.g., drawing sheet, standard view, section view, etc.) use IView::Type. This is particularly useful with methods like IDrawingDoc::GetViews, which treat the sheet itself as a drawing view.
If you need to traverse all components in a view, use IView::RootDrawingComponent to get the IDrawingComponent interface and then use IDrawingComponent::GetChildren. More simply, if you only need to traverse visible components then use IView::GetVisibleComponents.
The current drawing sheet (whether the top-level or the sheet format level) always has an active sketch. If you need to get the top-level sheet sketch then use ISketchManager::ActiveSketch and for the sheet format ISheet::GetTemplateSketch. Both return an ISketch object.