Loads one or more Navisworks supported files
Namespace: Autodesk.Navisworks.Api.Automation
Assembly: Autodesk.Navisworks.Automation (in Autodesk.Navisworks.Automation.dll)
Syntax
Visual Basic |
---|
Public Sub OpenFile ( _
fileName As String, _
ParamArray moreFiles As String() _
) |
C# |
---|
public void OpenFile(
string fileName,
params string[] moreFiles
) |
Visual C++ |
---|
public:
void OpenFile(
String^ fileName,
... array<String^>^ moreFiles
) |
Examples
CopyMerging Files into a Navisworks Document
Autodesk.Navisworks.Api.Automation.NavisworksApplication automationApplication = null;
try
{
string workingDir = System.IO.Directory.GetCurrentDirectory().TrimEnd('\\');
automationApplication =
new Autodesk.Navisworks.Api.Automation.NavisworksApplication();
automationApplication.DisableProgress();
automationApplication.OpenFile(workingDir + "\\hello.dwg", workingDir + "\\world.dwg");
automationApplication.SaveFile(workingDir + "\\hello_world.nwd");
automationApplication.EnableProgress();
}
catch (Autodesk.Navisworks.Api.Automation.AutomationException e)
{
System.Windows.Forms.MessageBox.Show("Error: " + e.Message);
}
catch (Autodesk.Navisworks.Api.Automation.AutomationDocumentFileException e)
{
System.Windows.Forms.MessageBox.Show("Error: " + e.Message);
}
finally
{
if (automationApplication != null)
{
automationApplication.Dispose();
automationApplication = null;
}
}
Exceptions
See Also