Detect Dynamo changes

Detect Dynamo changes

Anonymous
Not applicable
679 Views
2 Replies
Message 1 of 3

Detect Dynamo changes

Anonymous
Not applicable

Hi!

I am using Dynamic Model Update to handle changes made by the user. And I need to handle changes, made with Dynamo scripts separately. How can I check if changes that call my updater made by Dynamo?

I wanted to check if current transaction name contains "Dynamo", but how can I get current transaction name from the updater?

Thank you for reading 🙂

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

Anonymous
Not applicable

Hi everyone!

The question is still actual for me... While I cannot check transaction name from within updater Execute method I was thinking about other ways. For example, try to communicate to Dynamo Revit (not Sandbox) thread, but it's not separate from Revit thread Robot tongue, is it? If not... should I try to communicate to Dynamo window?

Still hoping that I am missing some official way Man Embarassed

0 Likes
Message 3 of 3

recepagah12
Advocate
Advocate

You can access the transaction names from DocumentChangedEventArgs Event

 

 Even in DB level you can access to transaction names via like this code snippet.

 public void ELementChangedEvent(object sender, DocumentChangedEventArgs args)
        { 
            ElementClassFilter filter2 = new ElementClassFilter(typeof(TextNoteType));
            Document doc = args.GetDocument();

            List<ElementId> AddedElements = args.GetAddedElementIds(filter2).ToList();
            List<ElementId> ModifiedElements = args.GetModifiedElementIds(filter2).ToList();

            string transactionName = args.GetTransactionNames().First();

            if (AddedElements.Count > 0)
            {
                TaskDialog.Show("ADDED ELEMENT", "A Text Note added to the document with: " + transactionName);

                doc.Delete(AddedElements.First());
            }
            if ( ModifiedElements.Count >0 )
            {
                TaskDialog.Show("MODIFIED ELEMENT","A Text Note modified with: " + transactionName);
            }
        }

Hope this sample helps.

 

0 Likes