|
![]() |
A sheet is equivalent to the complete contents of an Navisworks 2011 file. With sheets you can combine what were formerly multiple files into one file. Instead of opening each file in turn, you open the combined file and switch between sheets.
Through the .NET API it is possible to interact with Sheets, which are represented as instances of SheetInfo; here we examine some of the ways to do this.
Classes involved
Class name | Description |
---|---|
DocumentInfo |
Information about a Document that can be accessed without loading the entire Document. Also provides acces to the Sheets in a Document. |
SheetInfo | Sheet information. Often used to represent a sheet in a multi-sheet file. |
SheetType | Enumeration which identifies the Sheet type (for example 2D or 3D). This type is used by the property Document..::..ActiveSheetType to identify the Document's current sheet type and by SheetInfo..::..SheetType to identify the type of a given SheetInfo. |
Using Sheets
To iterate the sheets in a Document developers can use the DocumentInfo property and from there access the Value property:

//Iterate the SheetInfo entries available in this document foreach (SheetInfo sheetInfo in Autodesk.Navisworks.Api.Application.ActiveDocument.DocumentInfo.Value.Children) { //Do something with the sheet here //... //... }
![]() |
---|
The currently active sheet is accessible from the Document property ActiveSheet. |
Appending sheets is quite simple also. It can be noticed though that there is not an AppendSheet method on Document which takes a filename. This is because it is not known which sheet from the file to append.
![]() |
---|
When working with Multi-sheet files, Document..::..AppendFile will append the Default Sheet of a document to the current Document whereas AppendSheet can be used to append a specific sheet. |
Therefor the appending of sheets through the API is achieved by first examining the DocumentInfo of the source Document through Application..::..TryLoadDocumentInfo. Then appending the relative SheetInfo to the current Document using either TryAppendSheet or AppendSheet
For example, to add the first sheet of another file to the current Document:

//Browse for file OpenFileDialog newFile = new OpenFileDialog(); newFile.Title = "Appending a File to the current sheet - Browse For File"; //Ask user if resolve information is ok? if (newFile.ShowDialog() == DialogResult.OK) { //Get the DocumentInfo for the file DocumentInfo documentInfo = Autodesk.Navisworks.Api.Application.TryLoadDocumentInfo(newFile.FileName); //check the DocumentInfo is valid if (documentInfo != null) { //iterate the children of the DocumentInfo foreach (SavedItem item in documentInfo.Children) { SheetInfo sheetInfo = item as SheetInfo; //Find the first valid SheetInfo instance if (sheetInfo != null) { //Try and append the SheetInfo if (Autodesk.Navisworks.Api.Application.ActiveDocument.TryAppendSheet(sheetInfo)) { //Tell the user we've successfully appende the sheet MessageBox.Show(string.Format("Appended the '{0}' Sheet", item.DisplayName)); //break out of the loop, we've found a valid sheet break; } } } } }
Users may wish to add the sheet as a new sheet. To do this users should instead add the SheetInfo to the collection using AddCopy.
For example:

//Browse for file OpenFileDialog newFile = new OpenFileDialog(); newFile.Title = "Appending a SheetInfo as a new SheetInfo - Browse For File"; //Ask user if resolve information is ok? if (newFile.ShowDialog() == DialogResult.OK) { //Get the DocumentInfo for the file DocumentInfo documentInfo = Autodesk.Navisworks.Api.Application.TryLoadDocumentInfo(newFile.FileName); //check the DocumentInfo is valid if (documentInfo != null) { //iterate the children of the DocumentInfo foreach (SavedItem item in documentInfo.Children) { SheetInfo sheetInfo = item as SheetInfo; //Find the first valid SheetInfo instance if (sheetInfo != null) { DocumentInfo mainDocumentInfo = Autodesk.Navisworks.Api.Application.MainDocument.DocumentInfo.Value; //Avoid adding sheet with duplicated sheet id to DocumentInfo if (mainDocumentInfo.FindSheet(sheetInfo.Id) != null) sheetInfo = sheetInfo.CreateUniqueCopy(); //Try and append the SheetInfo to the collection Autodesk.Navisworks.Api.Application.ActiveDocument.DocumentInfo.AddCopy(sheetInfo); //Tell the user we've successfully appende the sheet MessageBox.Show(string.Format("Appended the '{0}' SheetInfo as a new SheetInfo", item.DisplayName)); //break out of the loop, we've found a valid sheet break; } } } }