<?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 External data extraction in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7209938#M57327</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know if it is possible to access the revit api / .rvt files outside of opening revit? Here is some sample code of what I am trying to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                public void getRooms()
		{
			Document doc = this.ActiveUIDocument.Document;		
			showCount(doc);
			
			Autodesk.Revit.ApplicationServices.Application app = this.Application;
			UIApplication uiapp = new UIApplication(app);
			doc = uiapp.OpenAndActivateDocument("C:/myRevitProject.rvt").Document;
			showCount(doc);
		}
		
		public void showCount(Document doc)
		{
			FilteredElementCollector roomCollector = new FilteredElementCollector(doc);
			roomCollector = roomCollector.OfCategory(BuiltInCategory.OST_Rooms);
			
			int count = 0;
			foreach(Element room in roomCollector)
			{
				count ++;
			}
			
			TaskDialog.Show("count", count.ToString());
		}&lt;/PRE&gt;&lt;P&gt;This code simply shows how many rooms in the current active document, then also shows how many rooms are in a file of your choice. I wanted to expand this so that you could run the plugin from a file, and it would crawl through my company's file system and post data to either an excel sheet or a mysql database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I came across certain files where an error dialog or warning pops up, which would require a user to click out of it for the plugin to continue its work. This is where I thought it would be ideal to not even 'open and activate' each file, but rather get the data out without opening the revit file. However, this doesn't seem possible. Please tell me it is &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jul 2017 17:12:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-07-06T17:12:09Z</dc:date>
    <item>
      <title>External data extraction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7209938#M57327</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know if it is possible to access the revit api / .rvt files outside of opening revit? Here is some sample code of what I am trying to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                public void getRooms()
		{
			Document doc = this.ActiveUIDocument.Document;		
			showCount(doc);
			
			Autodesk.Revit.ApplicationServices.Application app = this.Application;
			UIApplication uiapp = new UIApplication(app);
			doc = uiapp.OpenAndActivateDocument("C:/myRevitProject.rvt").Document;
			showCount(doc);
		}
		
		public void showCount(Document doc)
		{
			FilteredElementCollector roomCollector = new FilteredElementCollector(doc);
			roomCollector = roomCollector.OfCategory(BuiltInCategory.OST_Rooms);
			
			int count = 0;
			foreach(Element room in roomCollector)
			{
				count ++;
			}
			
			TaskDialog.Show("count", count.ToString());
		}&lt;/PRE&gt;&lt;P&gt;This code simply shows how many rooms in the current active document, then also shows how many rooms are in a file of your choice. I wanted to expand this so that you could run the plugin from a file, and it would crawl through my company's file system and post data to either an excel sheet or a mysql database.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I came across certain files where an error dialog or warning pops up, which would require a user to click out of it for the plugin to continue its work. This is where I thought it would be ideal to not even 'open and activate' each file, but rather get the data out without opening the revit file. However, this doesn't seem possible. Please tell me it is &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 17:12:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7209938#M57327</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-06T17:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: External data extraction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7210495#M57328</link>
      <description>&lt;P&gt;No, it is not&amp;nbsp;&lt;SPAN&gt;possible to access the Revit API or&amp;nbsp;RVT file contents without&amp;nbsp;opening Revit, with one exception:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can make use of the Forge platform:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://autodesk-forge.github.io/" target="_blank"&gt;https://autodesk-forge.github.io/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It includes a translator for RVT files which make all the geometry and properties available via Forge.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is more information on both Forge and Revit I/O:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28b" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28b&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 21:33:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7210495#M57328</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2017-07-06T21:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: External data extraction</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7213274#M57329</link>
      <description>&lt;P&gt;Thanks Jeremy!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, for anyone interested I also found this function:&lt;/P&gt;&lt;P&gt;app.&lt;SPAN&gt;OpenDocumentFile&lt;/SPAN&gt;(file);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rather than using:&lt;/P&gt;&lt;P&gt;uiapp.OpenAndActivateDocument(file)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The forge platform may be ideal (as long as I can get data such as rooms, areas etc. However, using app.OpenDocumentFile seems like a quick and dirty fix for me at this time. When using OpenAndActivateDocument, I would sometimes get pop up windows / error messages which need clicked which defeats the point of automation, and I am pretty sure this problem is fixed.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 16:47:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/external-data-extraction/m-p/7213274#M57329</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-07T16:47:03Z</dc:date>
    </item>
  </channel>
</rss>

