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