Skip to content

Instantly share code, notes, and snippets.

@johnpierson
Created March 17, 2022 14:31
Show Gist options
  • Save johnpierson/70cc69ba2471d547c230cfe2cf40149a to your computer and use it in GitHub Desktop.
Save johnpierson/70cc69ba2471d547c230cfe2cf40149a to your computer and use it in GitHub Desktop.
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
linkTypes = UnwrapElement(IN[0])
attachmentType = IN[1]
results = []
TransactionManager.Instance.EnsureInTransaction(doc)
for link in linkTypes:
if attachmentType == 0:
link.AttachmentType = AttachmentType.Attachment
results.append("Changed to attached")
if attachmentType == 1:
link.AttachmentType = AttachmentType.Overlay
results.append("Changed to overlay")
TransactionManager.Instance.TransactionTaskDone()
OUT = linkTypes, results
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment