AMEE_in_Revit.Addin.Commands.RecalculateCO2eCommand.Execute C# (CSharp) Метод

Execute() публичный Метод

public Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : Result
commandData ExternalCommandData
message string
elements ElementSet
Результат Result
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            SetStatusText("Recalculating CO2e for each elemeBnt...");
            var sw = new Stopwatch();
            sw.Start();

            var collector = new FilteredElementCollector(commandData.Application.ActiveUIDocument.Document);
            ICollection<Element> ameeElements = collector.WherePasses(Settings.CreateFilterForElementsWithCO2eParameter()).WhereElementIsNotElementType().ToElements();

            var transaction = new Transaction(commandData.Application.ActiveUIDocument.Document, "RecalculateCO2eCommand");
            transaction.Start();
            Settings.GetCO2eCalculator().UpdateElementCO2eParameters(ameeElements);
            transaction.Commit();

            sw.Stop();
            SetStatusText("Recalculated all COe2 values in {0}", sw.Elapsed);
            logger.InfoFormat("Recalculated all COe2 values in {0}", sw.Elapsed);

            return Result.Succeeded;
        }
RecalculateCO2eCommand