<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: open a rvt file in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6879610#M60225</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/561542"&gt;@Joris.vd.Meulen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm glad that's what you needed!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We&amp;nbsp;use OpenDocumentFile() for importing schedules and for batch processing. &amp;nbsp;We have a file with many pre-configured schedules and a tool that allows a user to import desired schedules into their current project. &amp;nbsp;And for batch processing it's faster&amp;nbsp;to open the documents without opening them in the editor.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2017 14:29:43 GMT</pubDate>
    <dc:creator>BobbyC.Jones</dc:creator>
    <dc:date>2017-02-15T14:29:43Z</dc:date>
    <item>
      <title>open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6876825#M60221</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm fiddling with API to create a button which opens a certain file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've got the whole ribbon, button working however. opening a file though ....&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing / does open command need a return Result.succesful ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.UI.Selection;

namespace OpenLib
{
public Document OpenDocumentFile(
	string openlib = "T:\Revit 2016\My Lib.rvt";
    )
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried without result&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private static Document OpenDocumentFile(ModelPath modelPath)
    {
        ModelPath modelPath = "T:\Revit 2016\My Lib.rvt";

        Document openedDoc = application.OpenDocumentFile(modelPath);

        return openedDoc;
    }   &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2017 15:00:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6876825#M60221</guid>
      <dc:creator>Joris.vd.Meulen</dc:creator>
      <dc:date>2017-02-14T15:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6877227#M60222</link>
      <description>&lt;P&gt;It's hard to give you exact advise, as what you've shared will not compile. &amp;nbsp;So as a better starting point, here's some example code that will compile. &amp;nbsp;I've also included a method that will open the document in the Revit editor, in case that's what you were looking for. &amp;nbsp;Let us know if that doesn't get you started down the correct path...pun may or may not be intended.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    public class OpenMyLib : IExternalCommand
    {
        private const string Path = @"T:\Revit 2016\My Lib.rvt";

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            //opens a document
            commandData.Application.Application.OpenDocumentFile(Path);

            //opens a document in the editor
            //commandData.Application.OpenAndActivateDocument(Path);

            return Result.Succeeded;
        }
    }&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 16:41:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6877227#M60222</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2017-02-14T16:41:01Z</dc:date>
    </item>
    <item>
      <title>Re: open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6877284#M60223</link>
      <description>&lt;P&gt;It's kind of hard to tell without all the code. Here is some code that works fine that maybe you can use?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;namespace Revit.ribbon
{
    [TransactionAttribute(TransactionMode.Manual), RegenerationAttribute(RegenerationOption.Manual)]
    public class Open : IExternalCommand
    {

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {

            UIApplication App = commandData.Application;
            Document doc = App.ActiveUIDocument.Document;
            UIDocument uidoc = new UIDocument(doc);

            String modelPath = @"C:\Revit Projects\Project1.rvt";
            App.OpenAndActivateDocument(modelPath);
                       
            return Result.Succeeded;
        }
    }
    
}&lt;/PRE&gt;&lt;P&gt;and then I call it with a ribbon button:&lt;/P&gt;&lt;PRE&gt;PushButtonData itemData22 = new PushButtonData("itemName22", "Testing Addin", AddInPath, "Revit.ribbon.Open");
            PushButton item22 = group1.AddPushButton(itemData22) as PushButton;
            item18.ToolTip = "Testing a new addin";&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Feb 2017 16:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6877284#M60223</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-14T16:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6878883#M60224</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/53074"&gt;@BobbyC.Jones&lt;/a&gt;&amp;nbsp;yes! open and activate is the one I need.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the purpose of opendocumentfile (without activate)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 08:40:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6878883#M60224</guid>
      <dc:creator>Joris.vd.Meulen</dc:creator>
      <dc:date>2017-02-15T08:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6879610#M60225</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/561542"&gt;@Joris.vd.Meulen&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm glad that's what you needed!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We&amp;nbsp;use OpenDocumentFile() for importing schedules and for batch processing. &amp;nbsp;We have a file with many pre-configured schedules and a tool that allows a user to import desired schedules into their current project. &amp;nbsp;And for batch processing it's faster&amp;nbsp;to open the documents without opening them in the editor.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 14:29:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/6879610#M60225</guid>
      <dc:creator>BobbyC.Jones</dc:creator>
      <dc:date>2017-02-15T14:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/8131494#M60226</link>
      <description>&lt;P&gt;Thank you for your useful guide. But I have 1 more question:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;After opening a new file and active the view of that file. How can I get control of that file ? Or how I can get that file save as and close then return to the first file.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thank you so much&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 01:36:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/8131494#M60226</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-07-16T01:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: open a rvt file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/10948748#M60227</link>
      <description>&lt;P&gt;I have the same problem&lt;/P&gt;</description>
      <pubDate>Mon, 14 Feb 2022 10:09:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/open-a-rvt-file/m-p/10948748#M60227</guid>
      <dc:creator>MERLET_J</dc:creator>
      <dc:date>2022-02-14T10:09:58Z</dc:date>
    </item>
  </channel>
</rss>

