public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
FilteredElementCollector filteredElementCollectorWall = new FilteredElementCollector(doc);
var wall = filteredElementCollectorWall.OfClass(typeof(Wall)).FirstElement() as Wall;
Parameter widthParam = wall.get_Parameter("Ширина2");
double widthValue = widthParam.AsDouble();
Parameter heightParam = wall.get_Parameter("Длина2");
double heightValue = heightParam.AsDouble();
double areaValue = widthValue * heightValue;
using (Transaction t = new Transaction(doc, "Обновление параметра"))
{
t.Start();
var res = wall.get_Parameter("Площадь_стены2").Set(areaValue);
t.Commit();
TaskDialog.Show("Запись значения в параметр", res.ToString());
}
return Result.Succeeded;
}