<?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 BoundingBox outline and BoundingBoxIsInsideFilter in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7921336#M50964</link>
    <description>&lt;P&gt;&lt;FONT size="3"&gt;Hi all,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;I have questions about bounding box. I tried to get outline of BoundingBox and retrieve elements inside it. But I've&amp;nbsp;faced 3 cases:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;1. My code works fine with horizontal&amp;nbsp;&lt;SPAN&gt;BoundingBox&amp;nbsp; (rorate = 0 deg).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/486766i37180117A91D78DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN&gt;2. BoundingBox still can get outline, but can not select all element inside.&amp;nbsp;(rorate =&amp;nbsp;10 ~ 20&amp;nbsp;deg).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/486767i5ECA44D28D39795E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;3. BoundingBox can't get outline(rorate &amp;gt; 45&amp;nbsp;deg) .Error message is&amp;nbsp;"outline is an empty outline".See code below in red line&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/486768i344E753DDBE5AC08/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3"&gt;[Transaction(TransactionMode.Manual)]
    public class ElementInsideBoundingBox : 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;
            
            View3D curView3d = doc.ActiveView as View3D;
            BoundingBoxXYZ box = curView3d.GetSectionBox();
            Transform t = box.Transform;
            
            &lt;FONT color="#FF0000"&gt;Outline o = new Outline(t.OfPoint(box.Min), t.OfPoint(box.Max));&lt;/FONT&gt;
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            BoundingBoxIsInsideFilter bbfilter = new BoundingBoxIsInsideFilter(o);
            IList&amp;lt;ElementId&amp;gt; insideList = collector
                    .WhereElementIsNotElementType()
                    .WherePasses(bbfilter)
                    .Where(x =&amp;gt; x.GetTypeId().IntegerValue != -1)
                    .Where(x =&amp;gt; x.IsPhysicalElement())
                    .Select(x =&amp;gt; x.Id)
                    .ToList();
            uidoc.Selection.SetElementIds(insideList);
            return Result.Succeeded;
        }
    }&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="3"&gt;I attached revit file for example. Please tell me where I was wrong?&lt;BR /&gt;Thank you in advanced!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2018 13:53:49 GMT</pubDate>
    <dc:creator>Shai.Nguyen</dc:creator>
    <dc:date>2018-04-10T13:53:49Z</dc:date>
    <item>
      <title>BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7921336#M50964</link>
      <description>&lt;P&gt;&lt;FONT size="3"&gt;Hi all,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;I have questions about bounding box. I tried to get outline of BoundingBox and retrieve elements inside it. But I've&amp;nbsp;faced 3 cases:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;1. My code works fine with horizontal&amp;nbsp;&lt;SPAN&gt;BoundingBox&amp;nbsp; (rorate = 0 deg).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/486766i37180117A91D78DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN&gt;2. BoundingBox still can get outline, but can not select all element inside.&amp;nbsp;(rorate =&amp;nbsp;10 ~ 20&amp;nbsp;deg).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/486767i5ECA44D28D39795E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;3. BoundingBox can't get outline(rorate &amp;gt; 45&amp;nbsp;deg) .Error message is&amp;nbsp;"outline is an empty outline".See code below in red line&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/486768i344E753DDBE5AC08/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;FONT size="3"&gt;[Transaction(TransactionMode.Manual)]
    public class ElementInsideBoundingBox : 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;
            
            View3D curView3d = doc.ActiveView as View3D;
            BoundingBoxXYZ box = curView3d.GetSectionBox();
            Transform t = box.Transform;
            
            &lt;FONT color="#FF0000"&gt;Outline o = new Outline(t.OfPoint(box.Min), t.OfPoint(box.Max));&lt;/FONT&gt;
            FilteredElementCollector collector = new FilteredElementCollector(doc);
            BoundingBoxIsInsideFilter bbfilter = new BoundingBoxIsInsideFilter(o);
            IList&amp;lt;ElementId&amp;gt; insideList = collector
                    .WhereElementIsNotElementType()
                    .WherePasses(bbfilter)
                    .Where(x =&amp;gt; x.GetTypeId().IntegerValue != -1)
                    .Where(x =&amp;gt; x.IsPhysicalElement())
                    .Select(x =&amp;gt; x.Id)
                    .ToList();
            uidoc.Selection.SetElementIds(insideList);
            return Result.Succeeded;
        }
    }&lt;/FONT&gt;&lt;/PRE&gt;&lt;P&gt;&lt;FONT size="3"&gt;I attached revit file for example. Please tell me where I was wrong?&lt;BR /&gt;Thank you in advanced!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 13:53:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7921336#M50964</guid>
      <dc:creator>Shai.Nguyen</dc:creator>
      <dc:date>2018-04-10T13:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7923334#M50965</link>
      <description>&lt;P&gt;Thank you for your query, good explanation and reproducible case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I passed it on to the development team to ask what they can say off-hand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 05:45:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7923334#M50965</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-04-11T05:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7925847#M50966</link>
      <description>&lt;P&gt;I heard back from the development team on this. They say:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We struggled with a similar issue. My understanding is that an Outline is always axis aligned -&amp;nbsp;you&amp;nbsp;are rotating the min and max points of the bounding box, `new Outline(t.OfPoint(box.Min), t.OfPoint(box.Max));` this doesn't give the&amp;nbsp; results you seem to be expecting (a rotated box). Instead, it creates an axis aligned outline, which won't have the same proportions as the original BB (the min and max were rotated). We solved this problem by doing the opposite, i.e., rotating the elements' outlines and not the BBox's outline (new outline from all rotated corners, so we loose some precision, but we didn't care). Perhaps there is another way but that is what we ended up doing and it worked pretty well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 18:37:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7925847#M50966</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-04-11T18:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7926978#M50967</link>
      <description>&lt;P&gt;I edited and cleaned up our discussion for posterity, plus adding another, new, suggestion to address your need using a solid intersection filter instead:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2018/04/bounding-box-filter-always-axis-aligned.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2018/04/bounding-box-filter-always-axis-aligned.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 07:36:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7926978#M50967</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-04-12T07:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7927390#M50968</link>
      <description>&lt;P&gt;thank you Jeremy. I'd love to&amp;nbsp;see that.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 10:27:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7927390#M50968</guid>
      <dc:creator>Shai.Nguyen</dc:creator>
      <dc:date>2018-04-12T10:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7927430#M50969</link>
      <description>&lt;P&gt;So would I&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Go ahead, try it out, and share the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 10:45:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7927430#M50969</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-04-12T10:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7928440#M50970</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;There are many categories that cannot get Solid out of geometry, i.e Lines, Planting,... That means I cannot use&amp;nbsp;ElementIntersectsSolidFilter to retrieve them. Do you have any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:25:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7928440#M50970</guid>
      <dc:creator>Shai.Nguyen</dc:creator>
      <dc:date>2018-04-12T15:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7928450#M50971</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a larger axis aligned bounding box filter to&amp;nbsp;apply quick filtering.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a second step, eliminate the elements that lie outside the enclosed rotated box that you are really interested in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 15:27:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/7928450#M50971</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-04-12T15:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/8123227#M50972</link>
      <description>&lt;P&gt;hi&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you mentioned about this case as below.&lt;/P&gt;&lt;P&gt;ou can solve this problem by doing the opposite, i.e., rotating the elements' outlines and not the BBox's outline (new outline from all rotated corners, so you lose some precision).&lt;/P&gt;&lt;P&gt;We ended up doing that is one case and it worked pretty well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please share the code in which you rotated the bounding box&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 13:50:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/8123227#M50972</guid>
      <dc:creator>BIM_S_S</dc:creator>
      <dc:date>2018-07-11T13:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/8657484#M50973</link>
      <description>&lt;P&gt;Why in this line:&lt;BR /&gt;".Where(x =&amp;gt; x.IsPhysicalElement())"&lt;BR /&gt;can't find "IsPhysicalElement()"(ps:even in the API Doc)?&lt;/P&gt;
&lt;P&gt;Did you create a method?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 03:51:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/8657484#M50973</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-14T03:51:25Z</dc:date>
    </item>
    <item>
      <title>Re: BoundingBox outline and BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/8657546#M50975</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;It's a method that not decleared in RevitAPI.&lt;/P&gt;
&lt;P&gt;But I think it's name is quite easy to understand.&lt;/P&gt;
&lt;P&gt;And also, you can try these lines:&lt;/P&gt;
&lt;PRE&gt;        internal static IEnumerable&amp;lt;Element&amp;gt; GetLocationElems(View v)
        {
            // Get elements that are visible in a View
            // And the elements must have a valid location (curve/point)
            
            var es = new FilteredElementCollector(v.Document, v.ID).ToElements();
            return (from e in es
                    where e != null &amp;amp;&amp;amp; e.IsValidObject &amp;amp;&amp;amp; e.Location != null
                    where (e.Location is LocationCurve) || (e.Location is LocationPoint)
                    select e).ToList();
        }
&lt;/PRE&gt;
&lt;P&gt;I replaced some lines in the above codes. So if there is some little errors, I do believe it's also quite easy to work it out.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 04:53:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/boundingbox-outline-and-boundingboxisinsidefilter/m-p/8657546#M50975</guid>
      <dc:creator>jlpgy</dc:creator>
      <dc:date>2019-03-14T04:53:38Z</dc:date>
    </item>
  </channel>
</rss>

