Check user is using dynamo to change object

Hi everyone,
whether we have any way to check event user has used dynamo to change element: modify, delete, …
Even though I used the IUpdate event in Revit API but still have no way of knowing if they are using Dyanmo for automation process.
Any answer is appreciated!

A users journal would indicate if Dynamo (or Dynamo Player) was used in that session, but as far as I know unless you code in a means of tracking element level modifications (perhaps picking into extensible storage? writing the GUIDs to an external DB?) you can’t directly access Dynamo modified elements.

I was able to export a large amount of user history data to the outside, but I need to go with whether they are using automation with dynamo for those objects? This is impossible ?

If you would like to know if Dynamo created the objects, mining the GUID from the element binding may be a path forward, but this would require gathering that data from the file on each save.

How are you getting data to this point?

I get persistent data from user via Revit update event. Maybe I need to wait for someone else to try to intervene and achieve this.

Ah! So you have an add-in listening for events, why not listen for the Dynamo event and mark that stream as Dynamo driven?

It’s a good idea, I thought of that but failed. Change events are often the same as normal operations, it is difficult to distinguish and know if they have actually been changed by the user using Dynamo or user using add-in.

Think you would need to listen for commands, then changes.

Maybe you can track the Transaction Name associated with each event (it’s not perfect because we can use Revit Transactions instead of Dynamo Transactions)
https://www.revitapidocs.com/2021.1/bc13391a-66bd-1530-3d08-f1b48a460416.htm

2 Likes

Thanks @c.poupin @JacobSmall. I think I’ll accept this solution for the time being, as some objects are still not correct with this event. Because when ForceCloseTransaction. We can create a new Transaction with name other.

image

2 Likes

I believe any element created or modified by Dynamo has extensible storage applied to it to store the data required for element binding cc @Michael_Kirschner2 please verify this as it’s an educated guess (I’m referring to the Tags property which the Revit.Elements.Element has).

If you subscribe to the Document changed event or implement IUpdater you could query the elements when the event is raised and access it’s ES - if it contains Dynamo attributes, then it’s modified or created by Dynamo. That’ll also be a lot quicker than parsing a Dyn. Still, this technique - assuming it is viable - isn’t infallible since the user might modify an element which was previously created by Dynamo so in this circumstance there will be no way to tell, not without more validation checks.

I’m curious about these issues, hope someone comes across here to clarify :slightly_smiling_face:

AFAIK - we do not use extensible storage for element binding, the bindings are stored in dynamo’s vm until save, and linked to the element via it’s element id.

You can look in the ElementBinder for a particular element id to see if it’s been referenced. You might also look at the RevitOwned element property on the Dynamo wrapper to see who created the element.

2 Likes

perhaps this rough writeup is useful:

3 Likes