BuildingCoder.CmdWallProfile.Execute1 C# (CSharp) Метод

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

Original implementation published November 17, 2008: http://thebuildingcoder.typepad.com/blog/2008/11/wall-elevation-profile.html
public Execute1 ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
commandData ExternalCommandData
message string
elements ElementSet
Результат System.Result
        public Result Execute1(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication app = commandData.Application;
              UIDocument uidoc = app.ActiveUIDocument;
              Document doc = uidoc.Document;

              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;
              }

              Options opt = app.Application.Create.NewGeometryOptions();

              List<List<XYZ>> polygons
            = GetWallProfilePolygons( walls, opt );

              int n = polygons.Count;

              Debug.Print(
            "{0} boundary loop{1} found.",
            n, Util.PluralSuffix( n ) );

              Creator creator = new Creator( doc );

              using( Transaction tx = new Transaction( doc ) )
              {
            tx.Start( "Draw Wall Elevation Profile Model Lines" );
            creator.DrawPolygons( polygons );
            tx.Commit();
              }
              return Result.Succeeded;
        }