- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've been pulling my hair out trying to query GetChangeTypeModified to react based on a series of concatenated parameter values.
So far, whenever I use the IsChangeTriggered method it returns false. Every time. On all of my parameters.
I think the way I'm referencing the Elements and their Parameters is correct because when I use both GetChangeType ElementAdded and GetChangeTypeElementModified, a) the calculations done correctly, setting the needed parameter and b) somethings get triggered (I just don't know what exactly).
Basically what I need to do here is:
- Query my Shared Parameter for a change. Update the related Elevation Height Parameter respectively OR
- Query my Elevation Height Parameter for a change and update the related Shared Parameter OR
- Query the associated Level of the Element for a change and update the Shared Parameter OR
- If an element is added look at all three of these things and calculate the Shared Parameter
ChangeType.ConcatenateChangeTypes( Element.GetChangeTypeParameter(absHeight.Id), ChangeType.ConcatenateChangeTypes(Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.INSTANCE_ELEVATION_PARAM)), ChangeType.ConcatenateChangeTypes(Element.GetChangeTypeParameter(new ElementId(BuiltInParameter.FAMILY_LEVEL_PARAM)), Element.GetChangeTypeElementAddition()))));
if (data.GetModifiedElementIds().Count() > 0) { foreach (ElementId id in data.GetModifiedElementIds()) { String whatChanged = data.GetModifiedElementIds().ToString(); Element e = doc.GetElement(id); Parameter aEle = e.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM); Parameter aAbsLevel = e.get_Parameter(absHeightId); Parameter aLevelP = e.get_Parameter(BuiltInParameter.FAMILY_LEVEL_PARAM); //why aren't the parameters getting recognized as being changed?! if (data.IsChangeTriggered(id, Element.GetChangeTypeParameter(aEle))) { TaskDialog.Show("The Elevation changed","The Elevation changed"); } else if (data.IsChangeTriggered(id, Element.GetChangeTypeParameter(aLevelP))) { TaskDialog.Show("The Level changed", "The Level changed"); } else if (data.IsChangeTriggered(id, Element.GetChangeTypeParameter(aAbsLevel))) { TaskDialog.Show("The Absolute Height changed","The Absolute Height changed"); } else { TaskDialog.Show("Nothing was changed","Nothing was changed"); }
Essentially what I'm getting every time is a dialogue with the given title "Nothing was changed" if I modify any of these 3 parameters.
I'm wondering if what I'm experiencing is similar to here or here. (Which I can't tell if either were resolved.)
But being relatively inexperienced with the API, C#, and a rookie at programming generally, also don't know if my code or approach is just plain incorrect or missing something (iterating the wrong thing for example).
Big thanks in advanced to those that can help. Whether it be with my code, my insecurities, or my sanity.
Solved! Go to Solution.