Set the value of a shared parameter in a linked file.

Set the value of a shared parameter in a linked file.

208ramyy98
Participant Participant
200 Views
2 Replies
Message 1 of 3

Set the value of a shared parameter in a linked file.

208ramyy98
Participant
Participant

Hi everyone,

I’m currently working on a scenario involving two Revit models:

  1. Electrical Model – Contains lighting fixtures (currently the active model).
  2. Architectural Model – Contains rooms (linked inside the electrical model).

Here’s the issue:
I need to update a shared parameter on the rooms in the linked architectural model based on some conditions in the electrical model.

However, Revit does not allow transactions in linked documents, as transactions can only be executed in the primary document.

What would be the best way to handle this situation using the Revit API?

I appreciate any suggestions, code snippets, or workflows that might help.

Thanks in advance!

0 Likes
201 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @208ramyy98 ,

 

You cannot directly edit elements, such as modifying parameter values or adding or deleting elements, within a linked file. To perform such modifications, 

  1. Open the linked document as a primary document (referred to here as "Main Document B").
  2. Begin a transaction for Main Document B.
  3. Modify the desired elements within this document.
  4. Commit the transaction.
  5. Reload Main Document B into the current main document as a linked document.

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 3

jeremy_tammik
Alumni
Alumni

What exactly does your code look like (simplified). If Revit has both documents open and you have variables to reference each of them, e.g., obtained from the Application.Documents property, you may be able to open a transaction on the linked document directly without explicitly loading it yourself.

  

  

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