BuildingCoder.CmdAnalyticalModelGeom.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 uiapp = commandData.Application;
              UIDocument uidoc = uiapp.ActiveUIDocument;
              Application app = uiapp.Application;
              Document doc = uidoc.Document;

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

              //XYZ p;
              //List<XYZ> wall_start_points
              //  = walls.Select<Element, XYZ>( e => {
              //    Util.GetElementLocation( out p, e );
              //      return p; } )
              //        .ToList<XYZ>();

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