public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication app   = commandData.Application;
            UIDocument    uidoc = app.ActiveUIDocument;
            Document      doc   = uidoc.Document;

            // retrieve selected walls, or all walls,
            // if nothing is selected:

            List <Element> walls = new List <Element>();

            if (!Util.GetSelectedElementsOrAll(
                    walls, uidoc, typeof(Wall)))
            {
                Selection sel = uidoc.Selection;
                message = (0 < sel.GetElementIds().Count)
          ? "Please select some wall elements."
          : "No wall elements found.";
                return(Result.Failed);
            }


            // mapping of compound wall layers to total cumulated volume;
            // the key is "<wall type name> : <wall layer function>",
            // the value is its cumulated volume across all selected walls:

            MapLayerToVolume totalVolumes
                = new MapLayerToVolume();

            foreach (Wall wall in walls)
            {
                GetWallLayerVolumes(wall, ref totalVolumes);
            }

            string msg
                = "Compound wall layer volumes formatted as '"
                  + "wall type : layer function :"
                  + " volume in cubic meters':\n";

            List <string> keys = new List <string>(
                totalVolumes.Keys);

            keys.Sort();

            foreach (string key in keys)
            {
                msg += "\n" + key + " : "
                       + Util.RealString(
                    Util.CubicFootToCubicMeter(
                        totalVolumes[key]));
            }

            Util.InfoMsg(msg);

            return(Result.Cancelled);
        }