<?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 Check if Assembly Views Exist in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/check-if-assembly-views-exist/m-p/10713434#M22868</link>
    <description>&lt;P&gt;I am new to plugin development.&amp;nbsp; I am trying to create a tool to create new assembly views.&amp;nbsp; I can create the views just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am struggling with is to check if an assembly view already exists in the project and has views/sheets created already.&amp;nbsp; If so, I'd like to then skip them and create views for the assemblies that need them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried checking if any of the views had an AssociatedAssemblyInstanceId on it but its not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help on this.&amp;nbsp; Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FilteredElementCollector assemblyInstanceCollector = new FilteredElementCollector(doc)&lt;BR /&gt;.OfCategory(BuiltInCategory.OST_Assemblies);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;List&amp;lt;Element&amp;gt; assemblyInstanceList = assemblyInstanceCollector.OfClass(typeof(AssemblyInstance))&lt;BR /&gt;.ToElements().ToList();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FilteredElementCollector viewCollector = new FilteredElementCollector(doc)&lt;BR /&gt;.OfCategory(BuiltInCategory.OST_Views);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;List&amp;lt;Element&amp;gt; viewList = viewCollector.ToElements().ToList();&lt;BR /&gt;foreach (View v in viewList)&lt;BR /&gt;{&lt;BR /&gt;foreach (Element e1 in assemblyInstanceList)&lt;BR /&gt;{&lt;BR /&gt;if (e1.Id != v.AssociatedAssemblyInstanceId)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;var viewSheet = AssemblyViewUtils.CreateSheet(doc, e1.Id, (ElementId)assemblyTileBlock);&lt;BR /&gt;var detailSectionH = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.HorizontalDetail);&lt;BR /&gt;var elevationTop = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.ElevationTop);&lt;BR /&gt;var elevationFront = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.ElevationFront);&lt;BR /&gt;var detailSectionB = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.DetailSectionB);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, elevationTop.Id, new XYZ(.9, 2.2, 0));&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, detailSectionH.Id, new XYZ(.9, 1.5, 0));&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, elevationFront.Id, new XYZ(.9, .9, 0));&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, detailSectionB.Id, new XYZ(2.4, .9, 0));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;elevationTop.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;detailSectionH.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;elevationFront.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;detailSectionB.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;break;&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Tue, 26 Oct 2021 06:34:24 GMT</pubDate>
    <dc:creator>a.j_</dc:creator>
    <dc:date>2021-10-26T06:34:24Z</dc:date>
    <item>
      <title>Check if Assembly Views Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/check-if-assembly-views-exist/m-p/10713434#M22868</link>
      <description>&lt;P&gt;I am new to plugin development.&amp;nbsp; I am trying to create a tool to create new assembly views.&amp;nbsp; I can create the views just fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I am struggling with is to check if an assembly view already exists in the project and has views/sheets created already.&amp;nbsp; If so, I'd like to then skip them and create views for the assemblies that need them.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried checking if any of the views had an AssociatedAssemblyInstanceId on it but its not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any help on this.&amp;nbsp; Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FilteredElementCollector assemblyInstanceCollector = new FilteredElementCollector(doc)&lt;BR /&gt;.OfCategory(BuiltInCategory.OST_Assemblies);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;List&amp;lt;Element&amp;gt; assemblyInstanceList = assemblyInstanceCollector.OfClass(typeof(AssemblyInstance))&lt;BR /&gt;.ToElements().ToList();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;FilteredElementCollector viewCollector = new FilteredElementCollector(doc)&lt;BR /&gt;.OfCategory(BuiltInCategory.OST_Views);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;List&amp;lt;Element&amp;gt; viewList = viewCollector.ToElements().ToList();&lt;BR /&gt;foreach (View v in viewList)&lt;BR /&gt;{&lt;BR /&gt;foreach (Element e1 in assemblyInstanceList)&lt;BR /&gt;{&lt;BR /&gt;if (e1.Id != v.AssociatedAssemblyInstanceId)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;var viewSheet = AssemblyViewUtils.CreateSheet(doc, e1.Id, (ElementId)assemblyTileBlock);&lt;BR /&gt;var detailSectionH = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.HorizontalDetail);&lt;BR /&gt;var elevationTop = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.ElevationTop);&lt;BR /&gt;var elevationFront = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.ElevationFront);&lt;BR /&gt;var detailSectionB = AssemblyViewUtils.CreateDetailSection(doc, e1.Id, AssemblyDetailViewOrientation.DetailSectionB);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, elevationTop.Id, new XYZ(.9, 2.2, 0));&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, detailSectionH.Id, new XYZ(.9, 1.5, 0));&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, elevationFront.Id, new XYZ(.9, .9, 0));&lt;BR /&gt;Viewport.Create(doc, viewSheet.Id, detailSectionB.Id, new XYZ(2.4, .9, 0));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;elevationTop.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;detailSectionH.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;elevationFront.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;detailSectionB.ViewTemplateId = (ElementId)assemblyViewTemplate;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;break;&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 06:34:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/check-if-assembly-views-exist/m-p/10713434#M22868</guid>
      <dc:creator>a.j_</dc:creator>
      <dc:date>2021-10-26T06:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Check if Assembly Views Exist</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/check-if-assembly-views-exist/m-p/10713548#M22869</link>
      <description>&lt;P&gt;Welcome to the Revit API!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This sounds doable. First of all, you might want to explore what the Revit database looks like through the API via RevitLookup:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/RevitLookup" target="_blank"&gt;https://github.com/jeremytammik/RevitLookup&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next, read about how&amp;nbsp;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontology.html#3" target="_blank"&gt;to research to find a Revit API solution:&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontology.html#3" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2017/01/virtues-of-reproduction-research-mep-settings-ontology.html#3&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For instance, you can create a list of all Revit database elements before and after creating such an assembly view.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By observing those changes you can determine how to address your task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Oct 2021 07:19:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/check-if-assembly-views-exist/m-p/10713548#M22869</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2021-10-26T07:19:35Z</dc:date>
    </item>
  </channel>
</rss>

