private void documentChanged(object sender, Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
{
var pd = ProjectData.Get(e.GetDocument());
var document = e.GetDocument();
foreach (var changedElementId in e.GetAddedElementIds())
AddTrigger(document, changedElementId);
}
private void AddTrigger(Document document, ElementId elementId)
{
var element = document.GetElement(elementId);
if (element != null && element.Name == "ХХХ")//проверку по другому можно сделать...
{
Parameter LeftSet = element.get_Parameter("Left Set");
if (LeftSet != null)
{
var ductFittingCatFilter = new ElementCategoryFilter(BuiltInCategory.OST_DuctFitting);
var updaterLeftSet = new TransitionLeftSetUpdater(application.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(updaterLeftSet);
UpdaterRegistry.AddTrigger(updaterLeftSet.GetUpdaterId(), ductFittingCatFilter, Element.GetChangeTypeParameter(LeftSet));
}
Parameter TopChange = element.get_Parameter("Top Change");
if (TopChange != null)
{
var ductFittingCatFilter = new ElementCategoryFilter(BuiltInCategory.OST_DuctFitting);
var updaterTopChange = new TransitionTopChangeUpdater(application.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(updaterTopChange);
UpdaterRegistry.AddTrigger(updaterTopChange.GetUpdaterId(), ductFittingCatFilter, Element.GetChangeTypeParameter(TopChange));
}
}
}