<?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: Determine linked elements present in a section in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12490296#M7759</link>
    <description>&lt;P&gt;The biggest challenge is probably the transformation. One possible approach would be to read and understand in depth all the transformations involved. Another possible approach, in case your tendency is stronger to hack and do rather than study and ponder, might be: create a very simple linked file with just an element or two, e.g., model lines. Host it. Analyse the resulting geometry in the host file. Reproduce the model lines in the host file until their appearance matches the original ones in the linked file. Basically, you just need to determine where a given bounding box in the linked file will end up on the host, don't you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you mention that you can successfully and automatically create tags for the linked elements, another idea comes to mind: before creating the tags, subscribe to the DocumentChanged method to be notified of the added elements. Then, you can query the tags for their locations. That will presumably approximate the host project locations of the linked elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jan 2024 08:49:59 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2024-01-11T08:49:59Z</dc:date>
    <item>
      <title>Determine linked elements present in a section</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12488150#M7758</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;I have a section with some project elements, and a linked file loaded with some elements in the view, as shown in the attached photo. I need to check which elements of the linked file are present in this section, but I'm having difficulties.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Captura de tela 2024-01-10 084739.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1312501iEB2EA7AB60BBC0B0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Captura de tela 2024-01-10 084739.png" alt="Captura de tela 2024-01-10 084739.png" /&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;I tried to check if the elements are inside the view's BoundingBox, but without success:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;foreach (RevitLinkInstance docsVinculados in vinculosCarregados)
{
Document doc_vinculo = docsVinculados.GetLinkDocument();

RevitLinkType type = Doc.Document.GetElement(docsVinculados.GetTypeId()) as RevitLinkType;

if (RevitLinkType.IsLoaded(Doc.Document, type.Id))
{

Transform posicao_vinculo = docsVinculados.GetTransform();

ICollection&amp;lt;Element&amp;gt; conexoes_vinculo =
new FilteredElementCollector(doc_vinculo).OfCategory(BuiltInCategory.OST_PipeFitting).ToElements().Where(x =&amp;gt; x is FamilyInstance).ToList();

foreach (FamilyInstance itemconex in conexoes_vinculo)
{

var posicaoTagConex = itemconex.get_BoundingBox(Doc.Document.ActiveView).Max.Add(posicao_vinculo.Origin);
var posicaominimaConex = itemconex.get_BoundingBox(Doc.Document.ActiveView).Min.Add(posicao_vinculo.Origin);

var DifPosX = (posicaoTagConex.X - posicaominimaConex.X);
var DifPosY = (posicaoTagConex.Y - posicaominimaConex.Y);
var DifPosZ = (posicaoTagConex.Z - posicaominimaConex.Z);

XYZ PosicaoFinal = new XYZ(posicaoTagConex.X - (DifPosX / 2), posicaoTagConex.Y - (DifPosY / 2), posicaoTagConex.Z - (DifPosZ / 2));

BoundingBoxXYZ boundingBox_view = Config.doc.ActiveView.get_BoundingBox(Config.doc.ActiveView);

Then I tried to apply the solution present here:

https://forums.autodesk.com/t5/revit-api-forum/check-to-see-if-a-point-is-inside-bounding-box/td-p/4354446

if (BoundingBoxXyzContains(boundingBox_view, PosicaoFinal))
{

}

}
}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like the position returned in BoundingBox is outside of view. I&amp;nbsp;use this solution to apply tags to linked elements without any problems (I left the code below just for example, as it is not part of the question):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Reference refe = new
Reference(itemconex)
.CreateLinkReference(docsVinculados);

IndependentTag tagConexao = IndependentTag.Create(
Doc.Document, TagConexSelecionada.Id, Doc.ActiveView.Id, refe,
true, TagOrientation.Horizontal, PosicaoFinal);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 12:07:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12488150#M7758</guid>
      <dc:creator>wl_santanna</dc:creator>
      <dc:date>2024-01-10T12:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Determine linked elements present in a section</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12490296#M7759</link>
      <description>&lt;P&gt;The biggest challenge is probably the transformation. One possible approach would be to read and understand in depth all the transformations involved. Another possible approach, in case your tendency is stronger to hack and do rather than study and ponder, might be: create a very simple linked file with just an element or two, e.g., model lines. Host it. Analyse the resulting geometry in the host file. Reproduce the model lines in the host file until their appearance matches the original ones in the linked file. Basically, you just need to determine where a given bounding box in the linked file will end up on the host, don't you?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you mention that you can successfully and automatically create tags for the linked elements, another idea comes to mind: before creating the tags, subscribe to the DocumentChanged method to be notified of the added elements. Then, you can query the tags for their locations. That will presumably approximate the host project locations of the linked elements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 08:49:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12490296#M7759</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2024-01-11T08:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Determine linked elements present in a section</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12491751#M7760</link>
      <description>&lt;P&gt;Hi Jeremy, thank you for your reply, you just&amp;nbsp;opened my mind to a possible solution! I just add a new IndependentTag then check if it's BoundingBox is valid:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;IndependentTag tagConexao = IndependentTag.Create(
Config.doc, Config.doc.ActiveView.Id, refe,
true, TagMode.TM_ADDBY_CATEGORY, TagOrientation.Horizontal, PosicaoFinal);

if (null != tagConexao.get_BoundingBox(Config.doc.ActiveView))
{
// The element is in the view
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then i collect the id's i need and RollBack the transaction in the final, it's working. Btw i'll study how transformations works when i have linked elements in some view. Thank you&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 19:55:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/12491751#M7760</guid>
      <dc:creator>wl_santanna</dc:creator>
      <dc:date>2024-01-11T19:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Determine linked elements present in a section</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/13272201#M7761</link>
      <description>&lt;P&gt;A new overload for the FilteredElementCollector class was added in revit 2024. It allows the user to input a linked document and retrieve the visible linked elements in a host document view.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://apidocs.co/apps/revit/2024/968b52a0-de55-2f96-de40-968812bc41c7.htm" target="_blank"&gt;ApiDocs.co · Revit · FilteredElementCollector Constructor (Document, ElementId, ElementId)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Constructs a new FilteredElementCollector that will search and filter the visible elements from a Revit link in a host document view.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 19:54:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/determine-linked-elements-present-in-a-section/m-p/13272201#M7761</guid>
      <dc:creator>rcrdzmmrmnn</dc:creator>
      <dc:date>2025-01-20T19:54:53Z</dc:date>
    </item>
  </channel>
</rss>

