<?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: Electrical Wire not found in BoundingBoxIsInsideFilter in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11969399#M12366</link>
    <description>&lt;P&gt;Thank you very much for the great analysis and useful utility classes,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4176855"&gt;@ricaun&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shared here on the blog:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/05/aligning-elements-finding-and-visualising-wires.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/05/aligning-elements-finding-and-visualising-wires.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2023 07:24:27 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2023-05-17T07:24:27Z</dc:date>
    <item>
      <title>Electrical Wire not found in BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11926866#M12361</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am currently trying to locate electrical wires that exist within a dependent view's bounding box. However, I have not been successful in using methods such as BoundingBoxIsInsideFilter, BoundingBoxIntersectsFilter, or VisibleInViewFilter.&lt;/P&gt;&lt;P&gt;In order to obtain the wires' bounding box, I had to use wire.get_BoundingBox(viewTheyExistOn) to get any value for their location. Despite following Jeremy's example in message #4 of this link&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/revit-api-forum/check-to-see-if-a-point-is-inside-bounding-box/m-p/4354446" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/revit-api-forum/check-to-see-if-a-point-is-inside-bounding-box/m-p/4354446&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;I am still unable to get any wires into my list.&lt;/P&gt;&lt;P&gt;I apologize for the mess in my example snippets as I have been trying various approaches to make it work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_3-1682625734940.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207708i08F7D41982104795/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_3-1682625734940.png" alt="MikeM615_3-1682625734940.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_2-1682625440894.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207706i602C625F0C0FFCFC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_2-1682625440894.png" alt="MikeM615_2-1682625440894.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 20:37:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11926866#M12361</guid>
      <dc:creator>MikeM615</dc:creator>
      <dc:date>2023-04-27T20:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Electrical Wire not found in BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11927851#M12362</link>
      <description>&lt;P&gt;I am not sure whether the filtered element collectors are ever able to take wire geometry into account. Do your wires have real geometry, e.g., a curve and a location? The&amp;nbsp;filtered element collectors only deal with BIM elements and BIM element geometry. If your wires have valid geometry, it may not be recognised by them a valid BIM element geometry, so you will have to treat is as abstract pure non-BIM geometry and use other means than the filtered element collectors to retrieve it. So, yes, using a pure geometry bounding box sounds like a good way to go. Just be clear that this is completely separate from&amp;nbsp;filtered element collectors.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 09:10:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11927851#M12362</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-04-28T09:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Electrical Wire not found in BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11928215#M12363</link>
      <description>&lt;P&gt;Yes sir they do have a curve and location, I am able to find them just fine through the FilteredElementCollector for each View, except on a Dependent View.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Dependent View will show all wires of the Primary View not just what is within its Crop Region. Took a few iterations but I finally found how to get the actual Crop Region of the Dependent View, the first few ways I tried gave me the Primary Views Crop Region, so I ended up having to get the extents from the BuiltInParameter&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_1-1682683809965.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207922iD858CB85587FB106/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_1-1682683809965.png" alt="MikeM615_1-1682683809965.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I also tried to extend my Z from that 1000' in either direction and it still did not show up, but if I invert any of those three filters, it finds all the wires of the Primary View even including the handful inside the Crop Region which shouldn't with it inverted.&lt;/P&gt;&lt;P&gt;This is the extents of the Dependent Views Crop Region:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_3-1682684885657.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207941iA50A410BF563E9E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_3-1682684885657.png" alt="MikeM615_3-1682684885657.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And these are the wires within it:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_4-1682684901736.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207942iBA3C3E7C8200F173/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_4-1682684901736.png" alt="MikeM615_4-1682684901736.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_5-1682684903736.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207943i9ACA1126989D3BB7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_5-1682684903736.png" alt="MikeM615_5-1682684903736.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MikeM615_6-1682684905452.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1207944i68FFD795AC05ECDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MikeM615_6-1682684905452.png" alt="MikeM615_6-1682684905452.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything at face value looks like the filters should work, it just seems I am missing something simple.&lt;BR /&gt;Here is the section of code I used just to produce those values, but the BoundingBoxIsInsideFilter is failing on:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private List&amp;lt;Wire&amp;gt; WireCollector( ForEachView viewPlan )
        {
            List&amp;lt;Wire&amp;gt; wireCollector = new FilteredElementCollector( _Doc, viewPlan.Id )
                    .OfCategory( BuiltInCategory.OST_Wire )
                    .WhereElementIsNotElementType( )
                    .OfType&amp;lt;Wire&amp;gt;( )
                    .ToList( );
            //If view is dependent view, filter wires by bounding box
            if ( viewPlan.PrimaryPlan != ElementId.InvalidElementId )
            {
                ////Set Z value to 1 ft above and below level
                XYZ viewBoundingBoxMin = new XYZ( viewPlan.ViewBoundingBox.Min.X, viewPlan.ViewBoundingBox.Min.Y, -1 );
                XYZ viewBoundingBoxMax = new XYZ( viewPlan.ViewBoundingBox.Max.X, viewPlan.ViewBoundingBox.Max.Y,  1 );
                //Create Outline and BoundingBox
                Outline outline = new Outline( viewBoundingBoxMin, viewBoundingBoxMax );
                BoundingBoxIsInsideFilter boundingBoxIsInsideFilter = new BoundingBoxIsInsideFilter( outline );
                //Test Value Reporting
                TaskDialog.Show( "Wire Export", viewBoundingBoxMin.ToString( ) + " Min " + viewBoundingBoxMax.ToString( ) + " Max " );
                //Add elements to new list if passes filter

                //Test Value Reporting
                foreach ( Wire wire in wireCollector)
                {
                    TaskDialog.Show( "Wire Export", wire.get_BoundingBox( viewPlan.CropRegionElement ).Min.ToString( ) + " Min " + wire.get_BoundingBox( viewPlan.CropRegionElement ).Max.ToString( ) + "Max" );
                }


                List&amp;lt;Wire&amp;gt; filteredWires = wireCollector
                    .Where( w =&amp;gt; boundingBoxIsInsideFilter.PassesFilter(w) )
                    .ToList( );

                //Test Value Reporting
                TaskDialog.Show( "Wire Export", $"There are {filteredWires.Count} wires in the view {viewPlan.Name}." );
                return filteredWires;
            }
            else
            {
                //Test Value Reporting
                TaskDialog.Show( "Wire Export", $"There are {wireCollector.Count} wires in the view {viewPlan.Name}." );
                return wireCollector;
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 12:35:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11928215#M12363</guid>
      <dc:creator>MikeM615</dc:creator>
      <dc:date>2023-04-28T12:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Electrical Wire not found in BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11928740#M12364</link>
      <description>&lt;P&gt;I'm not sure the bound box filter does work with 2d elements that are owned by a view.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess in the bound box filter implementation, the filter tries to get the bound box of the element without a view, like &lt;STRONG&gt;element.get_BoundingBox(null)&lt;/STRONG&gt;, and the result would be null, resulting in a &lt;STRONG&gt;PassesFilter&lt;/STRONG&gt; to false.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I guess the only way should be to create your own filter and add a &lt;STRONG&gt;View&lt;/STRONG&gt; to use in the comparison &lt;EM&gt;(Gonna be a slow filter to use with Linq)&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created the &lt;STRONG&gt;BoundingBoxViewIntersectsFilter&lt;/STRONG&gt; and &lt;STRONG&gt;BoundingBoxViewIsInsideFilter. &lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;A href="https://gist.github.com/ricaun/14ec0730e7efb3cc737f2134475e2539" target="_blank" rel="noopener"&gt;https://gist.github.com/ricaun/14ec0730e7efb3cc737f2134475e2539&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here is a code sample to test, I put a big tolerance to force the &lt;STRONG&gt;PassesFilter&lt;/STRONG&gt; to be true.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Electrical;
using Autodesk.Revit.UI;
using System.Linq;

namespace RevitAddin.Commands
{
    [Transaction(TransactionMode.Manual)]
    public class CommandWireIsInside : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            UIApplication uiapp = commandData.Application;

            UIDocument uidoc = uiapp.ActiveUIDocument;
            Document document = uidoc.Document;
            View view = uidoc.ActiveView;

            var wires = new FilteredElementCollector(document)
                    .OfCategory(BuiltInCategory.OST_Wire)
                    .WhereElementIsNotElementType()
                    .OfType&amp;lt;Wire&amp;gt;()
                    .ToList();

            System.Console.WriteLine($"Wires: {wires.Count}");

            var tolerance = 1e3;
            var viewBox = view.CropBox;
            var outline = new Outline(viewBox.Min, viewBox.Max);
            var boundingBoxFilter = new BoundingBoxViewIsInsideFilter(outline, view, tolerance);

            var wiresBox = wires
                    .Where(boundingBoxFilter.PassesFilter)
                    .ToList();

            System.Console.WriteLine($"WiresBox: {wiresBox.Count}");

            TaskDialog.Show($"Wires: {wires.Count}", $"WiresBox: {wiresBox.Count}");

            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2023 15:34:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11928740#M12364</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2023-04-28T15:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: Electrical Wire not found in BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11938583#M12365</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4176855"&gt;@ricaun&lt;/a&gt;, that makes a lot of sense and matches what I was seeing in my results and assumptions, I definitely got stuck on the problem and couldn't think of a next step at all in the moment!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the examples, that is exactly what I needed!&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2023 12:17:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11938583#M12365</guid>
      <dc:creator>MikeM615</dc:creator>
      <dc:date>2023-05-03T12:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Electrical Wire not found in BoundingBoxIsInsideFilter</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11969399#M12366</link>
      <description>&lt;P&gt;Thank you very much for the great analysis and useful utility classes,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4176855"&gt;@ricaun&lt;/a&gt;&amp;nbsp;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shared here on the blog:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2023/05/aligning-elements-finding-and-visualising-wires.html#2" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2023/05/aligning-elements-finding-and-visualising-wires.html#2&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 07:24:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/electrical-wire-not-found-in-boundingboxisinsidefilter/m-p/11969399#M12366</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-05-17T07:24:27Z</dc:date>
    </item>
  </channel>
</rss>

