I'm still confused sol et me try and explain what I am trying to do and show you the code I have been trying and changing based on your suggestion and maybe you can enlighten me to what I am doing wrong.
I am trying to create something that will run when a project is opened and look for a specific parameter within the family types of what is loaded and then create an updater based on that parameter. I have hacked some code together from Harry's webpage that I referenced and the help files.
I have tested the code after changing the element class filter from FamilySymbol to FamilyInstance while also changing the parameterName from a shared parameter name ("Image Height") to a built in parameter name, using Model for type parameter and Comments for the instance parameter). It will work with both ,a shared parameter or a built in parameter, if I set the class filter to Family Instance. If I set the class filter to FamilySymbol it only works with a built in parameter. I have checked element Id of the "Image Height" parameter as both a type parameter and an instance parameter and it is the same, so whether I get the parameter id from a type or an instance doesn't seem to matter.
Here is the code that I am using now:
public void Test_2()
{
UIDocument UIdoc = this.ActiveUIDocument;
Document doc = UIdoc.Document;
ParameterUpdater pUpdater = new ParameterUpdater(Application.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(pUpdater);
FilteredElementCollector eCollector = new FilteredElementCollector(doc);
eCollector.OfCategory(BuiltInCategory.OST_CommunicationDevices);
String parameterName = "Image Height";
foreach (Element e in eCollector){
foreach (Parameter p in e.Parameters){
if (p.Definition.Name == parameterName) {
UpdaterRegistry.AddTrigger(pUpdater.GetUpdaterId(),new ElementClassFilter(typeof(FamilySymbol)), Element.GetChangeTypeParameter(p));
}
}
}
}
I really appreciate all of your help and sorry that I am just not getting how to make this work with a type shared parameter. I am intrigued that you were able to though. I understand how GetTypeId() would work if I was selecting the elements and look just for a certain parameter by name but what I am doing is iterating through all of the parameters of the element. Would you be able to show me what i would need to change in my code and also explain why?
Thanks again for helping this newbie out.