Hi,
I am creating a plugin and through which i have to open *.rtv file in Autodesk Revit Architecture 2011. That file I have to download on my local machine and then open it from that local disk. I was very easily able to do the same in AutoCAD 2011 through acedPostCommand("OpenDrawing commandline ");
but Not able to open in Revit.
I am using following code.
[Autodesk.Revit.Attributes.
Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.
Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
publicclassOpenMenuCommandHandler1 : IExternalCommand
{
publicResult Execute(ExternalCommandData commandData, refstring message, ElementSetelements)
{
try
{
Document doc = commandData.Application.Application.OpenDocumentFile(@"C:\New Folder\rac_basic_sample_project.rvt");
}
return Autodesk.Revit.UI.Result.Succeeded;
}
}
It has been suggested through this code file is opened in Background. It is also told that we can open file in foreground using Win32API.
I do not know how to do this through Win32API. It's urgent please provide me code for the same.
Thanks in Advance.
Ashok Tiwari
Dear Ashok,
You can indeed open the file in the background using the code you show.
In Revit 2012, you can also open a file in the foreground, i.e. visible in the user interface, using the new UIApplication.OpenAndActivateDocument method.
Best regards,
Jeremy