<?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 View cannot be duplicated in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/view-cannot-be-duplicated/m-p/12129127#M10563</link>
    <description>&lt;P&gt;Hi folks, as shown in picture, I can not duplicate a floorplan view with the code posted below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MiguelGT17_0-1690408481938.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1245591i7BF94FBB805844EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MiguelGT17_0-1690408481938.png" alt="MiguelGT17_0-1690408481938.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            //get unitfloor plan
            ViewPlan unitFloorPlan = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan))
             .Cast&amp;lt;ViewPlan&amp;gt;().FirstOrDefault(x=&amp;gt;x.Name.ToLower().Contains("unit floor plan"));
            
            //1) duplicate the unitFloorPlan
            ElementId duplicateUnFP = unitFloorPlan.Duplicate(ViewDuplicateOption.AsDependent);

            ViewPlan dupFloorPlan = doc.GetElement(duplicateUnFP) as ViewPlan;

            //2) REMOVE THE TEMPLATE VIEW
            dupFloorPlan.ViewTemplateId = ElementId.InvalidElementId;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This block of code have been working 100% for all the projects but somehow this is the first time I'm facing this issue: (It doesnt work with all three options: asDependent, etc..)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MiguelGT17_1-1690408571008.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1245592i1DE73FFF7A025B0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MiguelGT17_1-1690408571008.png" alt="MiguelGT17_1-1690408571008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any Idea about the subject?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MiguelGT17_2-1690408630973.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1245594i7C9A7F6E20930756/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MiguelGT17_2-1690408630973.png" alt="MiguelGT17_2-1690408630973.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Miguel G.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jul 2023 21:57:25 GMT</pubDate>
    <dc:creator>MiguelGT17</dc:creator>
    <dc:date>2023-07-26T21:57:25Z</dc:date>
    <item>
      <title>View cannot be duplicated</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/view-cannot-be-duplicated/m-p/12129127#M10563</link>
      <description>&lt;P&gt;Hi folks, as shown in picture, I can not duplicate a floorplan view with the code posted below:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MiguelGT17_0-1690408481938.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1245591i7BF94FBB805844EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MiguelGT17_0-1690408481938.png" alt="MiguelGT17_0-1690408481938.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            //get unitfloor plan
            ViewPlan unitFloorPlan = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan))
             .Cast&amp;lt;ViewPlan&amp;gt;().FirstOrDefault(x=&amp;gt;x.Name.ToLower().Contains("unit floor plan"));
            
            //1) duplicate the unitFloorPlan
            ElementId duplicateUnFP = unitFloorPlan.Duplicate(ViewDuplicateOption.AsDependent);

            ViewPlan dupFloorPlan = doc.GetElement(duplicateUnFP) as ViewPlan;

            //2) REMOVE THE TEMPLATE VIEW
            dupFloorPlan.ViewTemplateId = ElementId.InvalidElementId;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This block of code have been working 100% for all the projects but somehow this is the first time I'm facing this issue: (It doesnt work with all three options: asDependent, etc..)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MiguelGT17_1-1690408571008.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1245592i1DE73FFF7A025B0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MiguelGT17_1-1690408571008.png" alt="MiguelGT17_1-1690408571008.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Any Idea about the subject?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MiguelGT17_2-1690408630973.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1245594i7C9A7F6E20930756/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MiguelGT17_2-1690408630973.png" alt="MiguelGT17_2-1690408630973.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Miguel G.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 21:57:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/view-cannot-be-duplicated/m-p/12129127#M10563</guid>
      <dc:creator>MiguelGT17</dc:creator>
      <dc:date>2023-07-26T21:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: View cannot be duplicated</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/view-cannot-be-duplicated/m-p/12129335#M10564</link>
      <description>&lt;P&gt;Nevermind, some weird thing was going on. I deleted this unitfloorplan listed in the project browser and the plugin still found a view to duplicate. In the end, there were 2 floorplans with same name but not visible at all in the project browser!! crazy, I just collected their Ids and deleted them. This way I managed to run the plugin without inconvenients.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 23:48:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/view-cannot-be-duplicated/m-p/12129335#M10564</guid>
      <dc:creator>MiguelGT17</dc:creator>
      <dc:date>2023-07-26T23:48:27Z</dc:date>
    </item>
  </channel>
</rss>

