How to find a modified Dimension using IUpdater (or another way)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to monitor deletion and modification of Dimensions that occur when the blue wall in the picture underneath is deleted programmatically. Dimensions C and A are deleted, My IUpdater succeeds in reporting that. However, the IUpdater does not succeed in reporting that Dimension B is modified.
My IUpdater uses updaterData.GetModifiedElementIds(), but that returns an empty list. See code below for my implementation of Execute().
I also tried using wall.GetDependentElements() to find Dimension B. But since Dimension B is not deleted it is considered not to be a DependentElement (which is a pity).
I have also thought about getting ALL Dimensions in the doc, and check ALL their references for the blue wall. But that seems very inefficient and not smart.
Do you have advice on how I can find the modified Dimension B? Would it be possible to hookup IUpdater to monitor deleted DimensionSegments?
public void Execute(UpdaterData data)
{
Document doc = data.GetDocument();
ICollection<ElementId> addedIds = data.GetAddedElementIds();
foreach (ElementId id in addedIds)
{
Element elem = doc.GetElement(id);
MessageBox.Show(string.Format("{0}({1}) has been added.", elem.Name, id.IntegerValue));
}
ICollection<ElementId> deletedIds = data.GetDeletedElementIds();
foreach (ElementId id in deletedIds)
{
MessageBox.Show(string.Format("{0} has been deleted.", id.IntegerValue));
}
ICollection<ElementId> modifiedIds = data.GetModifiedElementIds();
foreach (ElementId id in modifiedIds)
{
MessageBox.Show(string.Format("{0} has been modified.", id.IntegerValue));
}
}