Get changes in IUpdater

Get changes in IUpdater

Anonymous
Not applicable
1,977 Views
5 Replies
Message 1 of 6

Get changes in IUpdater

Anonymous
Not applicable

Is there a way to actually get what is changed? We can get the elementids that are changed but i would like to see what is changed. A Parameter or maybe it is moved etc etc.

0 Likes
Accepted solutions (1)
1,978 Views
5 Replies
Replies (5)
Message 2 of 6

matthew_taylor
Advisor
Advisor
Accepted solution

Hi Michal,

There probably is, but the overhead would likely be prohibitive.

Consider a transactional approach like the one in Jeremy Tammik's blog:

http://thebuildingcoder.typepad.com/blog/2016/01/tracking-element-modification.html

 

You could always combine the two approaches, and upon opening the model export each element's 'state' (both as data and as hashes of that data). Getting the data would have to be in the current thread, but writing the data (as strings etc, not Revit elements) could be done on a different thread.

When you get the modified elements via your updater, recreate the data again and compare the hashes. If the hashes differ, then do a diff on the actual data.

You could create different data buckets (parameters, geometry, etc) for each element so upon checking ChangeType, you could check just the data bucket (and hash) appropriate to the change.

Depending on your requirements, you could compare the data and hash on a different thread also and re-gather the results when needed (or wait for them to complete).

 

Worksharing, BIM360, Revit Server etc would all make this a wee bit more complicated (and perhaps slower), so an approach would have to be well thought out before commencing.

 

Cheers,

 

Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes
Message 3 of 6

Anonymous
Not applicable

Than why is the IUpdater sold as "when you change a element, like a wall, you can make the window change as well". If we have no idea what happend with the wall.

0 Likes
Message 4 of 6

matthew_taylor
Advisor
Advisor

Hi Michal,

Well, you can work out what happened to the wall. You just need to provide a framework with which to make it work. And you have to be selective, and minimise what you do so you don't affect performance.

If you want to track geometry changes for a wall, set up an Element.GetChangeTypeGeometry updater. You could pre-add the existing geometry data (as ExtensibleStorage?) to the wall when it's created, and make a comparison of that data if the wall changes (and of course update the geometry ExtensibleStorage data on the wall when you're done, in preparation for the next change).

What are you actually trying to achieve?

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes
Message 5 of 6

Anonymous
Not applicable
Im trying to figure out a solution, that when a model group is changed for another model group. And when for example in the new model group a room is bigger, that a room next to it will be made smaller to fit the new bigger room. For example a bathroom which is bigger in a different model group.
0 Likes
Message 6 of 6

matthew_taylor
Advisor
Advisor

Well, finding out if the model group type is fairly easy. Set up a GetChangeTypeParameter in your iUpdater.

Something like this:

elementId = new ElementId(BUILTINPARAMETER.ELEM_TYPE_PARAM)

Element.GetChangeTypeParameter(elementId)

 

 

You could add information to your model group when you create it, and react to that when the model group is changed.

Think storing the model group type uniqueId.

Exist model group type - get elements and geometry.

New model group type - get elements and geometry.

Compare, and react to the difference. Get the adjacent rooms via bounding box filteredelementcollector or something (I don't work with them - there are probably better ways). Modify the room / room contents.

 


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes