<?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 Hide Level Heads and Elevation Markers in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11128915#M19432</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on a Revit Addin and, so far, the end result is in the image bellow:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="imagem_2022-04-26_100345838.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1059440i24D8E33515B81C6E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imagem_2022-04-26_100345838.png" alt="imagem_2022-04-26_100345838.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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I want the Level Heads visible in the viewports to the left, the elevation markers and the axis arrows in the right-most viewport to not be visible. Bellow is parts of the code I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CreateView.cs (Creates views visible in the left-most viewports):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    class CreateViewCommand : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData1,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData1.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Get available Views - Filtered Element Collector
            FilteredElementCollector colViewFamilies = new FilteredElementCollector(doc);
            colViewFamilies.OfClass(typeof(ViewFamilyType));

            // Find 3D View type views
            var view3DFamilyTypes = from elem in colViewFamilies
                                  let type = elem as ViewFamilyType
                                  where type.ViewFamily == ViewFamily.ThreeDimensional
                                  select type;

            // Modify document within a transaction
            using (Transaction tx1 = new Transaction(doc))
            {
                tx1.Start("CreateView");

                // Arrays with the XYZ coordinates of the up and forward vectors for the needed views
                XYZ[] positionsUp = new XYZ[3];
                positionsUp[0] = new XYZ(0, 0, 1); // Left view
                positionsUp[1] = new XYZ(0, 0, 1); // Front view
                positionsUp[2] = new XYZ(1, 0, 0); // Top view

                XYZ[] positionsForward = new XYZ[3];
                positionsForward[0] = new XYZ(1, 0, 0); // Left view
                positionsForward[1] = new XYZ(0, 1, 0); // Front view
                positionsForward[2] = new XYZ(0, 0, -1); // Top view

                // Create new 2D Views of the model with different orientations
                for (int i = 0; i &amp;lt; 3; i++)
                {
                    View3D view = View3D.CreateIsometric(doc, view3DFamilyTypes.Last().Id);
                    XYZ eye = new XYZ(0, 0, 0);
                    XYZ up = positionsUp[i];
                    XYZ forward = positionsForward[i];
                    view.SetOrientation(new ViewOrientation3D(eye, up, forward));
                    view.DetailLevel = ViewDetailLevel.Fine;
                    view.Scale = 300;

                    // Disable Analytical Model category Graphic Override
                    foreach(Category cat in doc.Settings.Categories)
                    {
                        if(cat.CategoryType == CategoryType.AnalyticalModel)
                        {
                            if (view.CanCategoryBeHidden(cat.Id))
                            {
                                view.SetCategoryHidden(cat.Id, true);
                            }
                        }
                    }
                }

                tx1.Commit();
            }
            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AddViewToSheetCommand.cs (Gets created views and Level 1 (default level), creates viewports and adds them to a sheet):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    class AddViewToSheetCommand : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Filtered Element Collector list for the 3D Views
            FilteredElementCollector collector3DViews = new FilteredElementCollector(doc);
            collector3DViews.OfClass(typeof(View3D));
            List&amp;lt;View3D&amp;gt; all3DViews = collector3DViews.Cast&amp;lt;View3D&amp;gt;().ToList();

            // Filtered Element Collector for the Floor Plans
            FilteredElementCollector collectorFloorPlans = new FilteredElementCollector(doc);
            collectorFloorPlans.OfClass(typeof(ViewPlan));
            List&amp;lt;ViewPlan&amp;gt; allViewPlans = collectorFloorPlans.Cast&amp;lt;ViewPlan&amp;gt;().ToList();

            // Filtered Element Collector list for Sheet Views
            FilteredElementCollector collectorSheetViews = new FilteredElementCollector(doc);
            collectorSheetViews.OfClass(typeof(ViewSheet));
            List&amp;lt;ViewSheet&amp;gt; allSheetViews = collectorSheetViews.Cast&amp;lt;ViewSheet&amp;gt;().ToList();

            // Grab created Sheet View
            ViewSheet sheet = allSheetViews.LastOrDefault();

            // Grab default level 1 floor plan
            ViewPlan level1 = allViewPlans.First(n =&amp;gt; n.Name == "Level 1");

            // Grab all created Views
            View3D v1 = all3DViews[all3DViews.Count - 3];
            View3D v2 = all3DViews[all3DViews.Count - 2];
            View3D v3 = all3DViews[all3DViews.Count - 1];

            // Get ids of Project Points
            List&amp;lt;ElementId&amp;gt; basePointIds = new FilteredElementCollector(uidoc.Document, level1.Id)
                .WhereElementIsNotElementType()
                .OfClass(typeof(BasePoint))
                .ToElementIds()
                .ToList();

            // Get ids for the view's Elevation Markers points
            List&amp;lt;ElementId&amp;gt; viewElevationMarkerIds = new FilteredElementCollector(uidoc.Document, level1.Id)
                .WhereElementIsNotElementType()
                .OfClass(typeof(ElevationMarker))
                .ToElementIds()
                .ToList();

            // Modify document within a transaction
            using (Transaction tx3 = new Transaction(doc))
            {
                tx3.Start("AddViewToSheet");

                // Edit level1 to fit criteria
                level1.DetailLevel = ViewDetailLevel.Fine;
                level1.Scale = 300;
                if (basePointIds?.Count &amp;gt; 0)
                    level1.HideElements(basePointIds);
                if (viewElevationMarkerIds?.Count &amp;gt; 0)
                    level1.HideElements(viewElevationMarkerIds);

                // Set default viewport to "No Title" type
                ElementType elementType = new FilteredElementCollector(doc)
                    .OfClass(typeof(ElementType)).Cast&amp;lt;ElementType&amp;gt;()
                    .Where(x =&amp;gt; x.Name == "No Title").First();
                doc.SetDefaultElementTypeId(ElementTypeGroup.ViewportType, elementType.Id);

                // Add 4 viewports, 1 for each view
                Viewport viewport1 = Viewport.Create(doc, sheet.Id, v1.Id, new XYZ(0.45, 0.30, 0));
                Viewport viewport2 = Viewport.Create(doc, sheet.Id, v2.Id, new XYZ(0.35, 0.85, 0));
                Viewport viewport3 = Viewport.Create(doc, sheet.Id, v3.Id, new XYZ(0.45, 0.50, 0));
                Viewport viewport4 = Viewport.Create(doc, sheet.Id, level1.Id, new XYZ(1, 0.40, 0));

                tx3.Commit();
            }

            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is missing here? I've been having this issue for a while so any feedback is appreciated.&lt;/P&gt;&lt;P&gt;Also, bellow is the test .rvt document and the .sln document for the addin.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2022 09:16:23 GMT</pubDate>
    <dc:creator>joaofmoco</dc:creator>
    <dc:date>2022-04-26T09:16:23Z</dc:date>
    <item>
      <title>Hide Level Heads and Elevation Markers</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11128915#M19432</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been working on a Revit Addin and, so far, the end result is in the image bellow:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="imagem_2022-04-26_100345838.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1059440i24D8E33515B81C6E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="imagem_2022-04-26_100345838.png" alt="imagem_2022-04-26_100345838.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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I want the Level Heads visible in the viewports to the left, the elevation markers and the axis arrows in the right-most viewport to not be visible. Bellow is parts of the code I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CreateView.cs (Creates views visible in the left-most viewports):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    class CreateViewCommand : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData1,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData1.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Get available Views - Filtered Element Collector
            FilteredElementCollector colViewFamilies = new FilteredElementCollector(doc);
            colViewFamilies.OfClass(typeof(ViewFamilyType));

            // Find 3D View type views
            var view3DFamilyTypes = from elem in colViewFamilies
                                  let type = elem as ViewFamilyType
                                  where type.ViewFamily == ViewFamily.ThreeDimensional
                                  select type;

            // Modify document within a transaction
            using (Transaction tx1 = new Transaction(doc))
            {
                tx1.Start("CreateView");

                // Arrays with the XYZ coordinates of the up and forward vectors for the needed views
                XYZ[] positionsUp = new XYZ[3];
                positionsUp[0] = new XYZ(0, 0, 1); // Left view
                positionsUp[1] = new XYZ(0, 0, 1); // Front view
                positionsUp[2] = new XYZ(1, 0, 0); // Top view

                XYZ[] positionsForward = new XYZ[3];
                positionsForward[0] = new XYZ(1, 0, 0); // Left view
                positionsForward[1] = new XYZ(0, 1, 0); // Front view
                positionsForward[2] = new XYZ(0, 0, -1); // Top view

                // Create new 2D Views of the model with different orientations
                for (int i = 0; i &amp;lt; 3; i++)
                {
                    View3D view = View3D.CreateIsometric(doc, view3DFamilyTypes.Last().Id);
                    XYZ eye = new XYZ(0, 0, 0);
                    XYZ up = positionsUp[i];
                    XYZ forward = positionsForward[i];
                    view.SetOrientation(new ViewOrientation3D(eye, up, forward));
                    view.DetailLevel = ViewDetailLevel.Fine;
                    view.Scale = 300;

                    // Disable Analytical Model category Graphic Override
                    foreach(Category cat in doc.Settings.Categories)
                    {
                        if(cat.CategoryType == CategoryType.AnalyticalModel)
                        {
                            if (view.CanCategoryBeHidden(cat.Id))
                            {
                                view.SetCategoryHidden(cat.Id, true);
                            }
                        }
                    }
                }

                tx1.Commit();
            }
            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AddViewToSheetCommand.cs (Gets created views and Level 1 (default level), creates viewports and adds them to a sheet):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    class AddViewToSheetCommand : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Filtered Element Collector list for the 3D Views
            FilteredElementCollector collector3DViews = new FilteredElementCollector(doc);
            collector3DViews.OfClass(typeof(View3D));
            List&amp;lt;View3D&amp;gt; all3DViews = collector3DViews.Cast&amp;lt;View3D&amp;gt;().ToList();

            // Filtered Element Collector for the Floor Plans
            FilteredElementCollector collectorFloorPlans = new FilteredElementCollector(doc);
            collectorFloorPlans.OfClass(typeof(ViewPlan));
            List&amp;lt;ViewPlan&amp;gt; allViewPlans = collectorFloorPlans.Cast&amp;lt;ViewPlan&amp;gt;().ToList();

            // Filtered Element Collector list for Sheet Views
            FilteredElementCollector collectorSheetViews = new FilteredElementCollector(doc);
            collectorSheetViews.OfClass(typeof(ViewSheet));
            List&amp;lt;ViewSheet&amp;gt; allSheetViews = collectorSheetViews.Cast&amp;lt;ViewSheet&amp;gt;().ToList();

            // Grab created Sheet View
            ViewSheet sheet = allSheetViews.LastOrDefault();

            // Grab default level 1 floor plan
            ViewPlan level1 = allViewPlans.First(n =&amp;gt; n.Name == "Level 1");

            // Grab all created Views
            View3D v1 = all3DViews[all3DViews.Count - 3];
            View3D v2 = all3DViews[all3DViews.Count - 2];
            View3D v3 = all3DViews[all3DViews.Count - 1];

            // Get ids of Project Points
            List&amp;lt;ElementId&amp;gt; basePointIds = new FilteredElementCollector(uidoc.Document, level1.Id)
                .WhereElementIsNotElementType()
                .OfClass(typeof(BasePoint))
                .ToElementIds()
                .ToList();

            // Get ids for the view's Elevation Markers points
            List&amp;lt;ElementId&amp;gt; viewElevationMarkerIds = new FilteredElementCollector(uidoc.Document, level1.Id)
                .WhereElementIsNotElementType()
                .OfClass(typeof(ElevationMarker))
                .ToElementIds()
                .ToList();

            // Modify document within a transaction
            using (Transaction tx3 = new Transaction(doc))
            {
                tx3.Start("AddViewToSheet");

                // Edit level1 to fit criteria
                level1.DetailLevel = ViewDetailLevel.Fine;
                level1.Scale = 300;
                if (basePointIds?.Count &amp;gt; 0)
                    level1.HideElements(basePointIds);
                if (viewElevationMarkerIds?.Count &amp;gt; 0)
                    level1.HideElements(viewElevationMarkerIds);

                // Set default viewport to "No Title" type
                ElementType elementType = new FilteredElementCollector(doc)
                    .OfClass(typeof(ElementType)).Cast&amp;lt;ElementType&amp;gt;()
                    .Where(x =&amp;gt; x.Name == "No Title").First();
                doc.SetDefaultElementTypeId(ElementTypeGroup.ViewportType, elementType.Id);

                // Add 4 viewports, 1 for each view
                Viewport viewport1 = Viewport.Create(doc, sheet.Id, v1.Id, new XYZ(0.45, 0.30, 0));
                Viewport viewport2 = Viewport.Create(doc, sheet.Id, v2.Id, new XYZ(0.35, 0.85, 0));
                Viewport viewport3 = Viewport.Create(doc, sheet.Id, v3.Id, new XYZ(0.45, 0.50, 0));
                Viewport viewport4 = Viewport.Create(doc, sheet.Id, level1.Id, new XYZ(1, 0.40, 0));

                tx3.Commit();
            }

            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is missing here? I've been having this issue for a while so any feedback is appreciated.&lt;/P&gt;&lt;P&gt;Also, bellow is the test .rvt document and the .sln document for the addin.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 09:16:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11128915#M19432</guid>
      <dc:creator>joaofmoco</dc:creator>
      <dc:date>2022-04-26T09:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Level Heads and Elevation Markers</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11129920#M19433</link>
      <description>&lt;P&gt;Sorry for repeating myself hundreds of times over, but somehow I have become an anti-ToList&amp;nbsp;fanatic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can save yourself some code and your computer some performance time and memory space by avoiding the calls to ToList for&amp;nbsp; the base point and other ids. You may need to convert them from List to ICollection or something, but it will save (minimal) code, space and execution time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sorry this does not answer your question, though...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 16:18:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11129920#M19433</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-04-26T16:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Level Heads and Elevation Markers</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11129935#M19434</link>
      <description>&lt;P&gt;Hello Jeremy and thank you for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Although this does not answer my question, I appreciate the suggestion and I will figure out a way to not use .ToList so to save performance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 16:22:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11129935#M19434</guid>
      <dc:creator>joaofmoco</dc:creator>
      <dc:date>2022-04-26T16:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Level Heads and Elevation Markers</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11131980#M19435</link>
      <description>&lt;P&gt;I have figured the solutions for my issue and I'll leave the corrected code bellow:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CreateViewCommand.cs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    class CreateViewCommand : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData1,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData1.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Get available Views - Filtered Element Collector
            FilteredElementCollector colViewFamilies = new FilteredElementCollector(doc);
            colViewFamilies.OfClass(typeof(ViewFamilyType));

            // Find 3D View type views
            var view3DFamilyTypes = from elem in colViewFamilies
                                  let type = elem as ViewFamilyType
                                  where type.ViewFamily == ViewFamily.ThreeDimensional
                                  select type;
            
            // Get id list of the elements regarding the NSWE building sections on the level 1 view
            var levelHeadsCollector = new FilteredElementCollector(doc)
                .OfCategory(BuiltInCategory.OST_Levels)
                .ToElementIds();

            // Modify document within a transaction
            using (Transaction tx1 = new Transaction(doc))
            {
                tx1.Start("CreateView");

                // Arrays with the XYZ coordinates of the up and forward vectors for the needed views
                XYZ[] positionsUp = new XYZ[3];
                positionsUp[0] = new XYZ(0, 0, 1); // Left view
                positionsUp[1] = new XYZ(0, 0, 1); // Front view
                positionsUp[2] = new XYZ(1, 0, 0); // Top view

                XYZ[] positionsForward = new XYZ[3];
                positionsForward[0] = new XYZ(1, 0, 0); // Left view
                positionsForward[1] = new XYZ(0, 1, 0); // Front view
                positionsForward[2] = new XYZ(0, 0, -1); // Top view

                // Create new 2D Views of the model with different orientations
                for (int i = 0; i &amp;lt; 3; i++)
                {
                    View3D view = View3D.CreateIsometric(doc, view3DFamilyTypes.Last().Id);
                    XYZ eye = new XYZ(0, 0, 0);
                    XYZ up = positionsUp[i];
                    XYZ forward = positionsForward[i];
                    view.SetOrientation(new ViewOrientation3D(eye, up, forward));
                    view.DetailLevel = ViewDetailLevel.Fine;
                    view.Scale = 300;
                    view.HideElements(levelHeadsCollector);


                    // Disable Analytical Model category Graphic Override
                    foreach (Category cat in doc.Settings.Categories)
                    {
                        if(cat.CategoryType == CategoryType.AnalyticalModel)
                        {
                            if (view.CanCategoryBeHidden(cat.Id))
                            {
                                view.SetCategoryHidden(cat.Id, true);
                            }
                        }
                    }
                }

                tx1.Commit();
            }
            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;AddViewToSheetCommand.cs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#region Namespaces
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
#endregion

namespace RevitAddin
{
    [Transaction(TransactionMode.Manual)]
    class AddViewToSheetCommand : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            // Filtered Element Collector list for the 3D Views
            FilteredElementCollector collector3DViews = new FilteredElementCollector(doc);
            collector3DViews.OfClass(typeof(View3D));
            List&amp;lt;View3D&amp;gt; all3DViews = collector3DViews.Cast&amp;lt;View3D&amp;gt;().ToList();

            // Filtered Element Collector for the Floor Plans
            FilteredElementCollector collectorFloorPlans = new FilteredElementCollector(doc);
            collectorFloorPlans.OfClass(typeof(ViewPlan));
            List&amp;lt;ViewPlan&amp;gt; allViewPlans = collectorFloorPlans.Cast&amp;lt;ViewPlan&amp;gt;().ToList();

            // Filtered Element Collector list for Sheet Views
            FilteredElementCollector collectorSheetViews = new FilteredElementCollector(doc);
            collectorSheetViews.OfClass(typeof(ViewSheet));
            List&amp;lt;ViewSheet&amp;gt; allSheetViews = collectorSheetViews.Cast&amp;lt;ViewSheet&amp;gt;().ToList();

            // Grab created Sheet View
            ViewSheet sheet = allSheetViews.LastOrDefault();

            // Grab default level 1 floor plan
            ViewPlan level1 = allViewPlans.First(n =&amp;gt; n.Name == "Level 1");

            // Grab all created Views
            View3D v1 = all3DViews[all3DViews.Count - 3];
            View3D v2 = all3DViews[all3DViews.Count - 2];
            View3D v3 = all3DViews[all3DViews.Count - 1];

            // Get id list of Project Points
            List&amp;lt;ElementId&amp;gt; basePointIds = new FilteredElementCollector(uidoc.Document, level1.Id)
                .WhereElementIsNotElementType()
                .OfClass(typeof(BasePoint))
                .ToElementIds()
                .ToList();

            // Get id list for the view's Elevation Markers points
            List&amp;lt;ElementId&amp;gt; viewElevationMarkerIds = new FilteredElementCollector(uidoc.Document, level1.Id)
                .WhereElementIsNotElementType()
                .OfClass(typeof(ElevationMarker))
                .ToElementIds()
                .ToList();

            // Get id list of the elements regarding the NSWE building sections on the level 1 view
            FilteredElementCollector viewerCollector = new FilteredElementCollector(doc, level1.Id)
                .OfCategory(BuiltInCategory.OST_Viewers);

            // Get building elevation Ids
            IEnumerable&amp;lt;ElementId&amp;gt; elemIds = from Element d in viewerCollector 
                                             where doc.GetElement(d.GetTypeId()).Name.Equals("Building Elevation") 
                                             select d.Id;

            // Create a list with the building elevation Ids
            ICollection&amp;lt;ElementId&amp;gt; hideMarksIds = elemIds.Cast&amp;lt;ElementId&amp;gt;().ToList();

            // Get id list for axis arrow y on level1 view
            var internalOriginCollector = new FilteredElementCollector(doc, level1.Id)
                .OfClass(typeof(InternalOrigin))
                .ToElementIds();

            // Modify document within a transaction
            using (Transaction tx3 = new Transaction(doc))
            {
                tx3.Start("AddViewToSheet");

                // Edit level1 to fit criteria
                level1.DetailLevel = ViewDetailLevel.Fine;
                level1.Scale = 300;
                if (basePointIds?.Count &amp;gt; 0)
                    level1.HideElements(basePointIds);
                if (viewElevationMarkerIds?.Count &amp;gt; 0)
                    level1.HideElements(viewElevationMarkerIds);
                if (hideMarksIds?.Count &amp;gt; 0)
                    level1.HideElements(hideMarksIds);
                if (internalOriginCollector?.Count &amp;gt; 0)
                    level1.HideElements(internalOriginCollector);

                // Set default viewport to "No Title" type
                ElementType elementType = new FilteredElementCollector(doc)
                    .OfClass(typeof(ElementType)).Cast&amp;lt;ElementType&amp;gt;()
                    .Where(x =&amp;gt; x.Name == "No Title").First();
                doc.SetDefaultElementTypeId(ElementTypeGroup.ViewportType, elementType.Id);

                // Add 4 viewports, 1 for each view
                Viewport viewport1 = Viewport.Create(doc, sheet.Id, v1.Id, new XYZ(0.45, 0.25, 0));
                Viewport viewport2 = Viewport.Create(doc, sheet.Id, v2.Id, new XYZ(0.45, 0.85, 0));
                Viewport viewport3 = Viewport.Create(doc, sheet.Id, v3.Id, new XYZ(0.45, 0.55, 0));
                Viewport viewport4 = Viewport.Create(doc, sheet.Id, level1.Id, new XYZ(1.10, 0.55, 0));

                tx3.Commit();
            }

            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you all!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 11:16:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-level-heads-and-elevation-markers/m-p/11131980#M19435</guid>
      <dc:creator>joaofmoco</dc:creator>
      <dc:date>2022-04-27T11:16:22Z</dc:date>
    </item>
  </channel>
</rss>

