static Transform _t = Transform.CreateTranslation(_offset); // 2014
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;
List <Element> walls = new List <Element>();
if (!Util.GetSelectedElementsOrAll(
walls, uidoc, typeof(Wall)))
{
Selection sel = uidoc.Selection;
//message = ( 0 < sel.Elements.Size ) // 2014
message = (0 < sel.GetElementIds().Count) // 2015
? "Please select some wall elements."
: "No wall elements found.";
return(Result.Failed);
}
using (Transaction tx = new Transaction(doc))
{
tx.Start("Create model curve copies of analytical model curves");
Creator creator = new Creator(doc);
foreach (Wall wall in walls)
{
AnalyticalModel am = wall.GetAnalyticalModel();
foreach (AnalyticalCurveType ct in _curveTypes)
{
IList <Curve> curves = am.GetCurves(ct);
int n = curves.Count;
Debug.Print("{0} {1} curve{2}.",
n, ct, Util.PluralSuffix(n));
foreach (Curve curve in curves)
{
//creator.CreateModelCurve( curve.get_Transformed( _t ) ); // 2013
creator.CreateModelCurve(curve.CreateTransformed(_t)); // 2014
}
}
}
tx.Commit();
}
return(Result.Succeeded);
}