Edit parameters of the linked file (identity data and reference type)

when you import a linked file.. it has an identity Data.
but how can i change this.. want to set the Name and the Mark

also i want to set the reference type to Attachment

but i can;t change it..

anybody a clue

Hey,

I think it’s just like a regular element?

Hope that helps,

Mark

but that doesn’t work for the reference type…

No, that is another level of fun…

import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

instance = UnwrapElement(IN[0])

type_id = instance.GetTypeId()
link_type = doc.GetElement(type_id)

current_attachment_type = link_type.AttachmentType

new_attachment_type = AttachmentType.Attachment
# currently AttachmentType.Overlay

TransactionManager.Instance.EnsureInTransaction(doc)
link_type.AttachmentType = new_attachment_type
TransactionManager.Instance.TransactionTaskDone()

OUT = link_type.AttachmentType

Hope that helps,

Mark

1 Like

No, that is another level of fun…

import clr
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

instance = UnwrapElement(IN[0])

# we need to get the Link Type from the Instance
type_id = instance.GetTypeId()
link_type = doc.GetElement(type_id)

# now we find the attachment type, it is an enumeration
current_attachment_type = link_type.AttachmentType

# change from current Overlay to Attachment
# overlay returns 2,  Attachment returns 3.
new_attachment_type = AttachmentType.Attachment

# we need this in a transaction
TransactionManager.Instance.EnsureInTransaction(doc)
link_type.AttachmentType = new_attachment_type
TransactionManager.Instance.TransactionTaskDone()

OUT = link_type.AttachmentType

Looping will need to be added if multiple… Then you’ll need to get unique values if the same type is multiple times… A few things to make it work in practice.

Hope that helps,

Mark

works perfect…
trying to get this to work for multiple links in the document but haveing trouble with the for n in..

1 Like

Hey,

You’ll be doing something like…

unique_values = set() #sets can only contain unique values
for revit_link in revit_link_list:
    for link_instance in link_instance_list:
        # logic to get Type here
        unique_values.add(type)
1 Like