Rebar Tag Check


#1

Hello,

I have been working with the the rebar tool in Revit alot lately and i had an idea for a dynamo script but i dont whether it can be done. One of the things with the rebar tool it has no checks to tell you if a bar has been tagged or not.

So my question is, is there a way that i could make a script that would tell me what bars have not been tagged ?

Cheers


#2

Hello Kieran!

Here’s a suggestion for you:

rebarTagCheck.dyn (4.4 KB)

###The Python script:

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
tag = UnwrapElement(IN[0])
OUT = []
for t in tag:
	id = t.TaggedLocalElementId
	element = doc.GetElement(id).ToDSType(True)
	OUT.append(element)

#3

So will that show up the rebars that have not been tagged ?


#4

Yes, was that not what you asked for?


#5

yes that’s exactly what i was asking for, i have run the script on a dummy re-bar example but the tagged bar doesn’t highlight.


#6

The output of the SetDifference node is a list of non tagged elements. If you want to highlight them in Revit you can get their ids and use select by id.


#7

I use multi re-bar annotations for the tag categories, but when i change it in dynamo and run it i get an error in the python script as follows:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 23, in
AttributeError: ‘MultiReferenceAnnotation’ object has no attribute ‘TaggedLocalElementId’


#8

Here is a updated python script that should work for tags in Mulit Reference Annotations. Note that it will not work if you select the multi rebar annotation, but you have to select the tag in it.

rebarTagCheck.dyn (4.6 KB)

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
tag = UnwrapElement(IN[0])
OUT = []
for t in tag:
	id = t.TaggedLocalElementId
	element = doc.GetElement(id)

	if element.GetType().ToString() == "Autodesk.Revit.DB.Dimension":
		uId = set([r.ElementId for r in element.References])
		for ui in uId:
			OUT.append(doc.GetElement(ui).ToDSType(True))
	else:
			OUT.append(element.ToDSType(True))


#9

The script works an absolute treat, thank you for your time Einar. :grin:


#10

Einar, Is there a way to separate the rebar into partitions ? I have multiple Rebar jobs in going on in 1 model so i need to check each instance of jobs ?


#11

You can get the partition from the rebar elements with Element.GetParameterValueByName and filter the one you need with FilterByBoolMask. Then you need to check which elements in the rebar list is not in the tagged rebars list.

Can you test and see if this works?

rebarTagCheckFiltered.dyn (9.9 KB)


#12

Again, that works brilliant, Thanks for your time Einar.


#13

How could you modify the code so that it only shows me the list of the active view.

Thans You


#14

Here is one way to only select the rebars in the active view:


#15

I am very grateful for your help


#16

did it work?


#17

If it is perfect, but if I put the tag in another view and can not detect it in the current view.


#18

I just tried with a file where I have several floors, it happens that despite being in the active view the programming detects me from the rest of the structures, try to do it with selected elements but I happen the same, I can do.

I just want it to detect me from the elements that are in an active view like this:


#19

OK, try this and see if it works better:

rebarTagCheckInCurrentView.dyn (8.1 KB)


#20

I have tried it and if it detects all the elements that are seen in the view, but I get the same number has or does not have the tag, for example they are 84 elements, I write 2 and it indicates to me that they are 84 that it lacks the tag