<?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: A strange problem intesting the revit link file in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/a-strange-problem-intesting-the-revit-link-file/m-p/5608179#M73877</link>
    <description>&lt;P&gt;Hi Davix,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can repro your claim about the null return when using Code Region 1. It is indeed&amp;nbsp;puzzling.&amp;nbsp;But after staring the line for a while, I *think* here is what is happening; you are trying to search a category in Manage &amp;gt;&amp;gt; Settings, where the link is not a part in the category list.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this explains. Sounds like you have everything under contrll. But if you have any implication from&amp;nbsp;this and stumbling for further development effort or something, please&amp;nbsp;make a new post explaining&amp;nbsp;the specific issue you would like to resolve.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the post. This is indeed interesting and will make a good Revit API test&amp;nbsp;question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Apr 2015 18:43:26 GMT</pubDate>
    <dc:creator>mikako_harada</dc:creator>
    <dc:date>2015-04-25T18:43:26Z</dc:date>
    <item>
      <title>A strange problem intesting the revit link file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-strange-problem-intesting-the-revit-link-file/m-p/5508484#M73876</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I link a revit file to another and do some test, but the the Code Region1&amp;nbsp;can not find the revit link file, while the other 3 parts can work:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&lt;SPAN&gt;-------------- Code Region1&amp;nbsp;---- can not work&amp;nbsp;-------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TaskDialog.Show("Simple test", "4.1 " );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Category linkCat = doc.Settings.Categories.get_Item(BuiltInCategory.OST_RvtLinks);&lt;BR /&gt;if (linkCat != null)&lt;BR /&gt;{&lt;BR /&gt;TaskDialog.Show("Simple test", "4.2 " + linkCat.ToString());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;TaskDialog.Show("Simple test", "4.3 " );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;only prompt ["Simple test", "4.1 " ] and ["Simple test", "4.3 " ], so it can not find the revit link file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//&amp;nbsp;&lt;SPAN&gt;-------------- end of Code Region1 -------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// -------------- Code Region2 &amp;nbsp;--- can work -------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FilteredElementCollector collector = new FilteredElementCollector(doc);&lt;BR /&gt;IList&amp;lt;Element&amp;gt; walls = collector.WherePasses(filter).WhereElementIsNotElementType().ToElements();&lt;BR /&gt;String prompt = "The walls in the current document are:\n";&lt;BR /&gt;foreach (Element e in walls)&lt;BR /&gt;{&lt;BR /&gt;prompt += e.Name + "\n";&lt;BR /&gt;}&lt;BR /&gt;TaskDialog.Show("filter", prompt);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;it can find all the walls&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// -------------- end of&amp;nbsp;&lt;SPAN&gt;Code Region2 &amp;nbsp;-------------------------------&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// -------------- &lt;/SPAN&gt;&lt;SPAN&gt;Code Region3 &amp;nbsp;--- can work -------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ElementCategoryFilter linkFilter = new ElementCategoryFilter(BuiltInCategory.OST_RvtLinks);&lt;BR /&gt;FilteredElementCollector linkCollector = new FilteredElementCollector(doc);&lt;BR /&gt;IList&amp;lt;Element&amp;gt; linkDocs = linkCollector.WherePasses(linkFilter).WhereElementIsElementType().ToElements();&lt;BR /&gt;int count = linkDocs.Count();&lt;BR /&gt;prompt = "";&lt;BR /&gt;if (count &amp;gt; 0)&lt;BR /&gt;{&lt;BR /&gt;foreach (Element e in linkDocs)&lt;BR /&gt;{&lt;BR /&gt;prompt += e.Name + "\n";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;TaskDialog.Show("filter", prompt);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it can show the link revit file name, so it can work&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// --------------end of&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Code Region3 &amp;nbsp;----------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// -------------- &lt;/SPAN&gt;&lt;SPAN&gt;Code Region4 &amp;nbsp;--- can work -------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Category roomcat = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Rooms);&lt;BR /&gt;if (roomcat != null)&lt;BR /&gt;{&lt;BR /&gt;TaskDialog.Show("Simple test", "3 " + roomcat.ToString());&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;// --------------end of&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Code Region4 &amp;nbsp;---------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;As can be seen above, the Code Region2 and -Code Region3 are similar and both can work.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;Code Region1 and -&lt;SPAN&gt;Code Region4 are similar, but the&amp;nbsp;Code Region4 can work while the&amp;nbsp;Code Region1 cannot work.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;And the&amp;nbsp;Code Region3 can show the revit link file.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;What's the problem? Can anyone tell me ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thx !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Davix&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Feb 2015 14:09:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-strange-problem-intesting-the-revit-link-file/m-p/5508484#M73876</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-02-16T14:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: A strange problem intesting the revit link file</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/a-strange-problem-intesting-the-revit-link-file/m-p/5608179#M73877</link>
      <description>&lt;P&gt;Hi Davix,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can repro your claim about the null return when using Code Region 1. It is indeed&amp;nbsp;puzzling.&amp;nbsp;But after staring the line for a while, I *think* here is what is happening; you are trying to search a category in Manage &amp;gt;&amp;gt; Settings, where the link is not a part in the category list.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this explains. Sounds like you have everything under contrll. But if you have any implication from&amp;nbsp;this and stumbling for further development effort or something, please&amp;nbsp;make a new post explaining&amp;nbsp;the specific issue you would like to resolve.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the post. This is indeed interesting and will make a good Revit API test&amp;nbsp;question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Apr 2015 18:43:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/a-strange-problem-intesting-the-revit-link-file/m-p/5608179#M73877</guid>
      <dc:creator>mikako_harada</dc:creator>
      <dc:date>2015-04-25T18:43:26Z</dc:date>
    </item>
  </channel>
</rss>

