Cannot set parameter in linked Revit files - Third Party Updater

Cannot set parameter in linked Revit files - Third Party Updater

lastparametrics
Community Visitor Community Visitor
528 Views
3 Replies
Message 1 of 4

Cannot set parameter in linked Revit files - Third Party Updater

lastparametrics
Community Visitor
Community Visitor

Hello

I created a dynamo script that sets any room parameter in linked Revit files. The script works perfect, you run it on a “master model” with several linked files, select one of them and set a parameter name you would like to change - I am transfering name of the level where the room is located to one of its instance parameters. Dynamo opens the project on a background, set the parameters and loads the project back to the master. The script works perfect, when I test it with a blank project based on AC template.

The problem is that when I run the script on a certain project (it is very old project that is in the process many years - many versions of Revit), the link file unloads, the parameters are set, but it crashes when Dynamo wants to load the project back to the master model.

lastparametrics_0-1667205298187.png

 

I figured out, that the problem might be in Third Party Updater. The Journal file says that the Third Party Updater ‘Revit: ObjectNumberingUpdater’ has been unregistered. I do not have any addins installed, and I believe that the problem might be, that someone in the past installed some addin to Revit, used it on this project, and then uninstall it. (Tested on revit 2022 and 2023)

I attach the journal file and also the Python script that does the job.

Anyone has any idea? Maybe it is possibble to figure this out with Python. Thank you for all the help.

Lucie

 

 

import clr

clr.AddReference('System')
from System.Collections.Generic import List

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

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI 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
uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
app = DocumentManager.Instance.CurrentUIApplication.Application

link = UnwrapElement(IN[0])
parname = IN[1]
val = IN[2]


linkPath = link.GetLinkDocument().PathName
linkType = doc.GetElement(link.GetTypeId())

TransactionManager.Instance.ForceCloseTransaction()
linkType.Unload(None)

linkDoc = app.OpenDocumentFile(linkPath)
el = FilteredElementCollector(linkDoc).OfCategory(BuiltInCategory.OST_Rooms).WhereElementIsNotElementType().ToElements()

TransactionManager.Instance.EnsureInTransaction(linkDoc)
for e,v in zip(el,val):
        e.LookupParameter(parname).Set(v)

TransactionManager.Instance.TransactionTaskDone()
TransactionManager.Instance.ForceCloseTransaction()

linkDoc.Close()
linkType.Reload()

OUT = linkDoc

 

 

 

 

0 Likes
529 Views
3 Replies
Replies (3)
Message 2 of 4

jeremy_tammik
Alumni
Alumni

Yes. That sounds as if you need to remove the obsolete updater reference stored in that old linked file.

  

The Building Coder explained how to proceed in the year 2010:

  

http://thebuildingcoder.typepad.com/blog/2010/12/vsta-to-stay-and-updater-to-go.html#2.

  

Right now, typepad is experiencing problems, so you can read the article in the tbc GitHub repository instead:

  

https://jeremytammik.github.io/tbc/a/0501_vsta_and_updater.htm#2

  

I hope this helps.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 4

lastparametrics
Community Visitor
Community Visitor

Hello Jeremy, 

 

thank you for your reply. The problem is that the warning message with an option "Do not warn about this updater again and continue working with the file" does not appear when  I open the project. The solution you send me does not work for me. I have this problem only when I make Dynamo to open the project on background, change it, save it and load it back to to the "Master" model. When I do it manually, it works without any warning. 

 

Thank you for your help. 

Lucie 

0 Likes
Message 4 of 4

jeremy_tammik
Alumni
Alumni

Oh, dear. That sounds hard. Well, I'm sorry I have no further suggestions. I doubt you can fix it using the API. It sounds like it will require manual interaction to repair the model.

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes