# BoundingBoxIntersectsFilter / IsInsideFilter

**URL:** <https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441>\
**Category:** Developers\
**Created:** [July 5, 2018, 3:04pm UTC](https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441 "2018-07-05T15:04:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![igpema](https://avatars.discourse-cdn.com/v4/letter/i/5e9695/32.png) [@igpema](https://forum.dynamobim.com/u/igpema)\
**Post date:** [July 5, 2018, 3:04pm UTC](https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441/1 "2018-07-05T15:04:29Z")

</div>

Hallo community,

maybe someone knows why the filter doesnt collect the elements within the boundingbox… ?  
If I try to retrieve the elements without considering the boundingbox, it works out. Only when I try to retrieve the elements within the boundingbox, there is no output.  
Revit view:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/4/e4d773a768d416c815ac16310842d7f03a5fe6c1.png)

Code:

```
_linkDoc = IN[0]
_category = IN[1][0]

activeView = UnwrapElement(IN[2])

bbxMin = activeView.GetSectionBox().Min
bbxMax = activeView.GetSectionBox().Max

ol = Outline(bbxMin,bbxMax)

try:
	errorReport = None
	filter = ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory, _category.Id))
	bbfilter = BoundingBoxIntersectsFilter(ol)
	andfilter = LogicalAndFilter(filter,bbfilter)
	result = FilteredElementCollector(_linkDoc).WherePasses(andfilter).WhereElementIsNotElementType().ToElements()
except:
	# if error accurs anywhere in the process catch it
	import traceback
	errorReport = traceback.format_exc()

#Assign your output to the OUT variable
if errorReport == None:
	OUT = result
else:
	OUT = errorReport
```

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 5, 2018, 3:15pm UTC](https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441/2 "2018-07-05T15:15:02Z")

</div>

Try to get your code working without a try loop first. Otherwise you can’t see what error you’re getting.

---

<div class="post-metadata">

**Author:** ![igpema](https://avatars.discourse-cdn.com/v4/letter/i/5e9695/32.png) [@igpema](https://forum.dynamobim.com/u/igpema)\
**Post date:** [July 5, 2018, 3:19pm UTC](https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441/3 "2018-07-05T15:19:25Z")

</div>

I also tried out without the try / except and the output is again empty:

```
lnkDoc = IN[0]
category =UnwrapElement(IN[1])[0]

activeView = UnwrapElement(IN[2])

bbxMin = activeView.GetSectionBox().Min
bbxMax = activeView.GetSectionBox().Max

ol = Outline(bbxMin,bbxMax)

#category filter
catfilter = [ElementCategoryFilter(System.Enum.ToObject(BuiltInCategory, int(str(category.Id))))]

catfilterlist = List[ElementFilter](catfilter)
filter = LogicalOrFilter(catfilter)

#combining boundingbox and category filters
bbfilter = BoundingBoxIsInsideFilter(ol)
andfilter = LogicalAndFilter(filter,bbfilter)

#collecting elements

coll = FilteredElementCollector(lnkDoc).WherePasses(andfilter).WhereElementIsNotElementType().ToElements()

OUT = coll
```

---

<div class="post-metadata">

**Author:** ![igpema](https://avatars.discourse-cdn.com/v4/letter/i/5e9695/32.png) [@igpema](https://forum.dynamobim.com/u/igpema)\
**Post date:** [July 5, 2018, 3:22pm UTC](https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441/4 "2018-07-05T15:22:02Z")

</div>

oh, i found out the reason

```
lnkDoc = IN[0]
category =UnwrapElement(IN[1])[0]

activeView = UnwrapElement(IN[2])

bbx = activeView.GetSectionBox()
bbx.Max = XYZ(500,500,500)
bbx.Min = XYZ(-500,-500,-500)
#bbxMin = activeView.GetSectionBox().Min
#bbxMax = activeView.GetSectionBox().Max
bbxMin = bbx.Min
bbxMax = bbx.Max

ol = Outline(bbxMin,bbxMax)

```

I just redefined the boundingBox manually by giving other values and somehow the elements are retrieved, it means that bbx = activeView.GetSectionBox is not working out properly…

any ideas why?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 5, 2018, 4:29pm UTC](https://forum.dynamobim.com/t/boundingboxintersectsfilter-isinsidefilter/23441/5 "2018-07-05T16:29:38Z")

</div>

It’s hard to say without seeing any of your inputs, but I would guess the view does not have a section box assigned or you’re not handling the view properly.
