BuildingCoder.CmdWallDimensions.Execute C# (CSharp) Method

Execute() public method

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

              string msg = string.Empty;

              //Selection sel = uidoc.Selection; // 2014
              //foreach( Element e in sel.Elements ) // 2014

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

              if( Util.GetSelectedElementsOrAll( walls, uidoc, typeof( Wall ) ) )
              {
            foreach( Wall wall in walls )
            {
              msg += ProcessWall( wall );
            }
              }

              if( 0 == msg.Length )
              {
            msg = "Please select some walls.";
              }

              Util.InfoMsg( msg );

              return Result.Succeeded;
        }