By Augusto Goncalves (@augustomaia)
Here is a quick code showing how to delete a family parameter using API. It’s not on the “obvious” way, but it’s possible.
UIApplication uiapp = commandData.Application;UIDocument uidoc = uiapp.ActiveUIDocument;Application app = uiapp.Application;Document doc = uidoc.Document; if (doc.IsFamilyDocument){ FamilyParameter famParam = doc.FamilyManager.get_Parameter("Custom_Param_Name"); if (famParam != null) { Transaction trans = new Transaction(doc, "Erase custom family parameter"); trans.Start(); //doc.FamilyManager.Parameters.Erase(famParam); // cannot erase, read-only //doc.ParameterBindings.Remove(famParam.Definition); // not available on fam doc doc.Delete(famParam.Id); // this works! trans.Commit(); }}

Leave a Reply