Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Open an *.rtv through C#.

1 REPLY 1
Reply
Message 1 of 2
ashok.tiwari
1545 Views, 1 Reply

How to Open an *.rtv through C#.

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 

1 REPLY 1
Message 2 of 2

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

 

 

Jeremy Tammik, Developer Advocacy and Support, The Building Coder, Autodesk Developer Network, ADN Open

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report