Bounding Box of Tag

Is there a way to get a tags bounding box?

Thanks for any help you can provide,

Figured out a really bad way of doing it but I guess it works.

If you have a better way of doing this I am all ears. This really slows down my computer.


import clr
import math

import Autodesk
from Autodesk.Revit.DB import *

import Revit

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

tag = UnwrapElement(IN[0])
view = UnwrapElement(IN[1])
list = []
for i in tag:

	bbox = (i.BoundingBox[view])
	pt = (bbox.Min,bbox.Max)

OUT = list
1 Like

What kind of tags are you working with?

Someone went through and hit tag all doors and walls in our overall plans. We have unites and do not want everyone to show these tags as they are called out on the enlarged typical unit plan. We do however want all door and wall tags outside the units. My goal was to delete all door and wall inside the units and leave all others.

I tried Elements in Room from Archi-lab but it errs out saying “‘Location’ object has not attribute”.

Room.IsInsideRoom will take a point but Element.BoundingBox returns null and Element.Geometry Empty List. This is why I wrote the code above because I can get the Revit BBox min and max points. The section after where I reassemble the points was because my lack of python and the time crunch I was in. It’s not pretty but it worked.

Do you have any suggestions @john_pierson?


Yeah, I thought about it a bit and it seems like you can use the following method to find where the tag resides in the model.

Here is the python for it:

import clr
from Autodesk.DesignScript.Geometry import *

# Import ToDSType(bool) extension method
import Revit
# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

from System.Collections.Generic import *

# Import RevitAPI
import Autodesk

#unwrap all elements to use with API
tags = UnwrapElement(IN[0])
#apply lineweight override to elements in an input list
tagHeadPosition = list()
for i in tags:

#Assign your output to the OUT variable
OUT = tagHeadPosition

This could prove to not work on door tags “inside” the wall though.

That being said, I bet you could make a custom bounding box and intersect them against your rooms or something.

So this graph:

20180220-tagsIntersectingRoom.dyn (25.0 KB)

Would result in this.

Since I did not know the filtering you were using, I just filtered rooms out that started with “12” in the number.



Thanks John,

Really helpful post and thanks for the python code as well. Since I am starting to learn code its helpful to see how to complete an idea.

Quick question: Is “try:” the task to get the head point and then “except:” will return the tag IN[0] if it cannot exquisite TagHeadPosition?


Yeah, what that will end up doing is outputting an empty list to filter against.

I actually picked up on this technique from @Andreas_Dieckmann’s awesome clockwork package. :slight_smile:

for i in tag:
    bbox = (i.BoundingBox[view])

This code Showing Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
unexpected indent

How can i fix it.

Mechanical Equipment Tags
i have tags from multiple views and i want to get bounding box of them

Geniusloci has it inside his package :wink:
Try this:

Thanks for sharing
But using this making dynamo Crash
It runs only for single time.
If i am using bounding box minimum and maximum point to make a cuboid than it is giving error :

Warning: BoundingBox.ToCuboid operation failed.
Unable to create block : ACIS_EXCEPTION_ACCESS_VIOLATION – Access violation