Hi,
After checking the code you sent to me in private box, it is obvious you wrote the codes wrongly. Since the variable SaveToVersion is null, it cannot definetely work. Please refer to the code snippet below.
In addition, a kindly reminding: remember to share enough code demo thus other peers could diagnose what the problem is. Otherwise, it is hard to priovide a comment only with such short description.
// in the plugin
//Add two new namespaces
using Nw = Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
namespace myPlugin
{
[PluginAttribute("myPlugin",
"ADSK",
ToolTip = "",
DisplayName = "MyPlugin")]
public class ABatchSaveAs : AddInPlugin
{
public override int Execute(params string[] parameters)
{
try
{
Nw.ApplicationParts.ApplicationAutomation oApp = Nw.Application.Automation;
oApp.OpenFile("c:\\orignalfile.nwd");
Nw.Document oCurrentDoc = Nw.Application.ActiveDocument;
// Nw.DocumentFileVersion oCurrentFVer = Nw.DocumentFileVersion.Current;
oCurrentDoc.SaveFile("c:\\newfile.nwd", DocumentFileVersion.Navisworks2011);
}
catch (Exception es)
{
MessageBox.Show("an error occured when saving!");
}
return 0;
}
}
}