<?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: Remove view breaks in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11371881#M17318</link>
    <description>&lt;P&gt;How about a completely different approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the &lt;U&gt;Failure API&lt;/U&gt; to suppress the warning:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe it can be achieved using the generic warning swallower listed in the topic group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Aug 2022 18:28:04 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2022-08-21T18:28:04Z</dc:date>
    <item>
      <title>Remove view breaks</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11370485#M17317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to use PathOFTravel feature in my addin, but view breaks exist that give the &lt;STRONG&gt;"&lt;EM&gt;A crop region is enabled in the view. The Path of Travel may not be the optimized route because it is calculating only inside the crop region. ...&lt;/EM&gt; "&lt;/STRONG&gt; error.&lt;/P&gt;&lt;P&gt;I used the following code to remove the view breaks, but it doesn't work.&lt;/P&gt;&lt;P&gt;Does anyone know how to temporarily remove the view breaks and use the PathOfTravel without this annoying warning?&lt;/P&gt;&lt;P&gt;I checked the UI, and it gives the same error, but when I check the route, to me it's good and seems to be the shortest and optimal path. So I was wondering if there is no straightforward solution for the above problem, adding a remove warning command. Any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public static void RemoveCropRegionsInAllViews(Document mydoc)
        {
            #region Code for making a list of levels on Floor plans

            List&amp;lt;View&amp;gt; Floorplans = new FilteredElementCollector(mydoc).OfClass(typeof(View)).WhereElementIsNotElementType().Cast&amp;lt;View&amp;gt;().Where(e =&amp;gt; e.ViewType == ViewType.FloorPlan).ToList();
            List&amp;lt;ElementId&amp;gt; Levels = new List&amp;lt;ElementId&amp;gt;();
            List&amp;lt;View&amp;gt; FloorViews = new List&amp;lt;View&amp;gt;();

            try
            {
                foreach (Element e in Floorplans)
                {
                    if (e is View)
                    {
                        View floorview = e as View;
                        Level floorlevel;
                        if (floorview.GenLevel == null)
                        {
                            continue;
                        }
                        else
                        {
                            floorlevel = floorview.GenLevel;

                            bool check = false;
                            if (!Levels.Contains(floorlevel.Id))
                            {
                                Levels.Add(floorlevel.Id);
                                check = true;
                            }

                            if (!floorview.IsTemplate &amp;amp;&amp;amp; check == true) //|| !Levels.Contains(floorlevel.Name))
                            {
                                FloorViews.Add(floorview);

                            }

                        }
                    }
                }

            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);

            }

            #endregion

            using (Transaction t = new Transaction(mydoc, "Remove the croped lines from the view"))
            {
                t.Start();
                foreach (var v in FloorViews)
                {
                    MessageBox.Show("Hi", v.Id.ToString());
                    ViewCropRegionShapeManager cropedView = v.GetCropRegionShapeManager();
                    cropedView.RemoveSplit();
                }
                t.Commit();
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Aug 2022 11:06:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11370485#M17317</guid>
      <dc:creator>soheila.bigdeli</dc:creator>
      <dc:date>2022-08-20T11:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Remove view breaks</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11371881#M17318</link>
      <description>&lt;P&gt;How about a completely different approach?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the &lt;U&gt;Failure API&lt;/U&gt; to suppress the warning:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.32&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe it can be achieved using the generic warning swallower listed in the topic group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 18:28:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11371881#M17318</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-08-21T18:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Remove view breaks</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11372465#M17319</link>
      <description>Thanks Jeremy, it worked.&lt;BR /&gt;However the running time has nearly doubled.&lt;BR /&gt;BTW, does it mean that there is no way in the API to remove the view breaks?</description>
      <pubDate>Mon, 22 Aug 2022 06:02:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11372465#M17319</guid>
      <dc:creator>soheila.bigdeli</dc:creator>
      <dc:date>2022-08-22T06:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Remove view breaks</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11372499#M17320</link>
      <description>&lt;P&gt;How has the running time doubled? Did you implement a failure processor, and that increased execution time? Would you like to show exactly how you implemented that? Maybe it can be improved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;No, it does not mean that the other approach is not possible. This alternative just seemed simpler to me, and more directly addressing the issue you described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 06:33:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11372499#M17320</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2022-08-22T06:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Remove view breaks</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11372731#M17321</link>
      <description>&lt;P&gt;my fault, I just had to restart my laptop after constantly working for 4 days.&lt;BR /&gt;Now the running times are much better, way shorter than before when&amp;nbsp;I needed to silence the warning manually.&lt;BR /&gt;But I used the following code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;public class WarningSwallower : IFailuresPreprocessor
    {
        public FailureProcessingResult PreprocessFailures(FailuresAccessor a)
        {
            IList&amp;lt;FailureMessageAccessor&amp;gt; failures = a.GetFailureMessages();

            foreach (FailureMessageAccessor f in failures)
            {
                FailureSeverity fseverity = a.GetSeverity();
                if (fseverity == FailureSeverity.Warning) a.DeleteWarning(f);
                else
                {
                    a.ResolveFailure(f);
                    return FailureProcessingResult.ProceedWithCommit;
                }
            }
            return FailureProcessingResult.Continue;
        }

        public static void setFailureDialogSuppressor(Transaction tranasaction)
        {
            FailureHandlingOptions failOpt = tranasaction.GetFailureHandlingOptions();
            failOpt.SetFailuresPreprocessor(new WarningSwallower());
            tranasaction.SetFailureHandlingOptions(failOpt);
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;then I Call it as the following code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt; using (Transaction t = new Transaction(mydoc, "Check Distances"))
                    {
                        t.Start();
                        #region Remove warnings
                        WarningSwallower.setFailureDialogSuppressor(t);
                        #endregion
.
.
.
t.RollBack;
}&lt;/LI-CODE&gt;&lt;P&gt;The only thing is that I assume that all warnings are suppressed. If there is a new warning in a new model, I would like to know.&lt;/P&gt;&lt;P&gt;So if there is a solution to remove the view breaks I think that would be the better solution. Do you have any idea or tip on how to implement this?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 22 Aug 2022 08:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-view-breaks/m-p/11372731#M17321</guid>
      <dc:creator>soheila.bigdeli</dc:creator>
      <dc:date>2022-08-22T08:43:09Z</dc:date>
    </item>
  </channel>
</rss>

