How to find a modified Dimension using IUpdater (or another way)

How to find a modified Dimension using IUpdater (or another way)

jos.noordzijXE9UB
Contributor Contributor
337 Views
1 Reply
Message 1 of 2

How to find a modified Dimension using IUpdater (or another way)

jos.noordzijXE9UB
Contributor
Contributor

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? 

 

 

20220825.jpg

 

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));
}
}

0 Likes
338 Views
1 Reply
Reply (1)
Message 2 of 2

RPTHOMAS108
Mentor
Mentor

Have you tried monitoring the parameter change of:

DIM_VALUE_LENGTH (Element.GetChangeTypeParameter)

with ChangePriority Annotations
 
Can't say that it will trigger, there are plenty of parameter changes that don't it seems.

 

0 Likes