Find CAD link referencing View

This has been a great help to me. Unfortunately, this no longer works in 2018 (at least for me). Something with the Python code isn’t producing the same output as before.

I’ve updated the parameter names as required but I keep getting a null from the Python Script.

Find Lost CAD Inserts v0.1.dyn (44.9 KB)

Here’s the code: (I apologize that’s it’s formatted as indented text).

import clr

Import RevitAPI Classes

clr.AddReference(‘RevitAPI’)
from Autodesk.Revit.DB import *
#the above can be changed to import just specific classes separated by a comma

clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *

clr.AddReference(‘RevitNodes’)
import Revit

Adds ToDSType (bool) extension method to wrapped elements

clr.ImportExtensions(Revit.Elements)
#adds ToProtoType, ToRevitType geometry conversion extension methods to objects
clr.ImportExtensions(Revit.GeometryConversion)

#import documentmanager and transaction manager
clr.AddReference(‘RevitServices’)
from RevitServices.Transactions import TransactionManager
from RevitServices.Persistence import DocumentManager

create varible for revit document

doc = DocumentManager.Instance.CurrentDBDocument
elements = UnwrapElement(IN[0])
nams =

start transaction

TransactionManager.Instance.EnsureInTransaction(doc)

code that modifies revit database goes here

for ele in elements:

#end transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = nams

Thanks again!

1 Like