简体   繁体   中英

Keep track of element editings or element edited event in Revit 2018/ 2019

I am working on a project that rebars to host elements in Revit 2018 and Revit 2019. After my code regenerates the rebar reinforcement for the host element, I can not know if the user has manually edited my host or my rebars (generated by my code, of course). I just come up with these 2 ideas:

  1. Store all rebar and host info into the host 's extensible storage (literally every property, ids, ….) at the time the rebars are generated by my code. When I call my code to work on the host again, I am going to compare all the current info with the saved info in the host 's entity to find out what has been changed. Clearly, this approach is going to cost me a lot and has a huge penalty on performance.

  2. Catch all the change the user might do to my rebars and hosts through an "Element - edited - event". However, I can't seem to find the right event that suits my need. I 've tried Element and Document events and ITransactionFinalizer class without results.

Where can I find the event I want or how to achieve what I wanted? Another and better approach is much welcome. Thank you all in advance.

Congratulations on spotting the link to Tracking Element Modification yourself. I would have pointed to that too. You might also want to check out the GitHub repository for that project, plus a follow-up project idea:

Looking forward to hearing about your final solution. If it is generic enough to be of interest to others as well, I would love to share it on the blog for you. Thank you!

The solution I (as well as Mr. Jeremy Tammik) have mentioned Tracking Element Modification

is what I need, but it is a little too generic though.

For a more detailed solution to this specific problem, I filtered for my rebar host (beam, column, wall …) , get all the hosted rebars then take a snapshot of their parameters.

Some small notes for newbies like me though:

  1. Some of the parameters will change depends on other ones. If user modification is what you are after, filter out the ReadOnly parameter that has been changed will narrow the list down quite a bit.

  2. If you delete all rebar from host, or add rebar to an empty host, some parameters will be removed or added accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM