4

I have a problem working with a central file model and two local files on two different machines. When I add an element on one machine, do a sync and then reload on the other machine, the API does not see this newly added element with the DocumentChanged event.

This is the code:

private void DocumentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
    {
        switch(e.Operation.ToString())
        {
            case "TransactionUndone":
            case "TransactionRedone":
            case "TransactionCommitted":

                this.transactionEventHandler.HandleEvent(sender, e, this.persistance, this.elementMutationHandler);

                break;
        }            
    }

Immediately after this code I do this:

ICollection<ElementId> deletedElements = e.GetDeletedElementIds();
ICollection<ElementId> changedElements = e.GetModifiedElementIds();
ICollection<ElementId> addedElements = e.GetAddedElementIds();

The problem is that for deleted elements this works perfectly (after a reload) but for modified and added elements this does nothing.

The code works perfectly when adding or modifying elements in the local file, but this is not what I need. I need to handle modified and added elements from other users who synced these changes to the central file.

Does anybody know if I am doing something wrong, or maybe there is some other way to accomplish this?

RandomUsername
  • 364
  • 1
  • 5
  • 13
  • I would love to know this as well. Did you ever find a solution to this issue? – matthewrdev Sep 01 '13 at 23:09
  • I did not find the solution to this problem. Maybe it is possible in version 2014 of the API. – RandomUsername Sep 05 '13 at 11:16
  • 1
    @TomvandenBerk - you might have to Regenerate the document first before you can get the element. Most of these commands require you to deal with the document (or view) as it currently is so that state may be out of whack unless you force a regeneration – prestonsmith Dec 21 '18 at 14:04

1 Answers1

0

I think that you need to add the Attribute

[Regeneration(RegenerationOption.Automatic)]