I need a little help here, I am making a tool to add a Revit link to a project, it seems to be working, it makes a link, but then that link isn’t useable or visible to python or dynamo after it’s created, able to succeed using Dynamo so it is possible…
Here you can see the link manager displaying 2 links but only the one not made with my tool appears to Dynamo:
And my code:
`
Load Pyrevit
from pyrevit import revit, DB
doc = revit.doc
Path to the file you want to link
file_path = r’Z:\SEA\Projects\00018.zlab\Data Strategy R&D\Working Files\Office Benchmarking\Revit Files\Office Benchmarking Template.rvt’
Convert the file path to a ModelPath object
model_path = DB.ModelPathUtils.ConvertUserVisiblePathToModelPath(file_path)
Begin a new transaction
transaction = DB.Transaction(doc, “Create Revit Link”)
transaction.Start()
try:
# Create a new instance of RevitLinkOptions
link_options = DB.RevitLinkOptions(True)
# Create a new instance of RevitLinkType
link_type = DB.RevitLinkType.Create(doc, model_path, link_options)
# Commit the transaction
transaction.Commit()
except Exception as ex:
# Rollback the transaction in case of any exception
transaction.RollBack()
raise ex
`
What am I missing here?
Thanks!