var selectedIds = uidoc.Selection.GetElementIds(); using (Transaction tx = new Transaction(doc, "修改参数")) { tx.Start(); foreach (ElementId id in selectedIds) { Element elem = doc.GetElement(id); Parameter param = elem.LookupParameter("参数名称"); // 替换实际参数名 // 或者使用内置参数:elem.get_Parameter(BuiltInParameter.参数枚举) if (param != null && !param.IsReadOnly) { // 根据参数类型设置值 if (param.StorageType == StorageType.String) param.Set("新值"); else if (param.StorageType == StorageType.Double) param.Set(123.45); } } tx.Commit(); } uidoc.RefreshActiveView(); // 刷新界面显示新值