@naveen.kumar.t
Thank you very much for your reply.
I only called it once in my code. Here is my code.
//Set to single document mode
Autodesk.Navisworks.Api.Controls.ApplicationControl.ApplicationType = ApplicationType.SingleDocument;
//Initialise the api
ApplicationControl.Initialize();
//Create a DocumentControl
DocumentControl documentControl = new DocumentControl();
//Set as main document, needs to be called as COM works on the application's MainDocument
documentControl.SetAsMainDocument();
dataLib.filePath = filePath;
//If the user has selected a valid location, then tell DocumentControl to open the file
if (documentControl.Document.TryOpenFile(filePath))
{
//Select the first root item using the API
roots = new ModelItemCollection();
roots.Add(documentControl.Document.Models.First.RootItem);
documentControl.Document.CurrentSelection.CopyFrom(roots);
document = documentControl.Document;
dataLib.fileDirectoryName = Path.GetDirectoryName(dataLib.filePath);
//RotateMarix4.GetInstance().UpVector = Application.ActiveDocument.UpVector;
UnitData.FT2MM = Utility.GetScale();
string pbcName = Path.GetFileName(dataLib.filePath);
dataLib.pbcSavePath = dataLib.fileDirectoryName + "\\" + pbcName.Substring(0, pbcName.LastIndexOf(".")) + ".mv";
InitLog();
if (roots.Count == 0)
{
}
DataHandel();
}
//Dispose of the DocumentControl
documentControl.Dispose();
//Finish use of the API.
ApplicationControl.Terminate();