BuildingCoder.CmdRotatedBeamLocation.Execute C# (CSharp) Метод

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

public Execute ( ExternalCommandData commandData, string &message, ElementSet elements ) : System.Result
commandData ExternalCommandData
message string
elements ElementSet
Результат System.Result
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication app = commandData.Application;
              UIDocument uidoc = app.ActiveUIDocument;
              Document doc = uidoc.Document;

              FamilyInstance beam = Util.SelectSingleElementOfType(
            uidoc, typeof( FamilyInstance ), "a beam", false ) as FamilyInstance;

              BuiltInCategory bic
            = BuiltInCategory.OST_StructuralFraming;

              if( null == beam
            || null == beam.Category
            || !beam.Category.Id.IntegerValue.Equals( (int) bic ) )
              {
            message = "Please select a single beam element.";
              }
              else
              {
            LocationCurve curve
              = beam.Location as LocationCurve;

            if( null == curve )
            {
              message = "No curve available";
              return Result.Failed;
            }

            XYZ p = curve.Curve.GetEndPoint( 0 );
            XYZ q = curve.Curve.GetEndPoint( 1 );
            XYZ v = 0.1 * (q - p);
            p = p - v;
            q = q + v;

            //Creator creator = new Creator( doc );
            //creator.CreateModelLine( p, q );

            using ( Transaction t = new Transaction( doc ) )
            {
              t.Start( "Create Model Line" );

              Creator.CreateModelLine( doc, p, q );

              t.Commit();
            }
              }
              return Result.Succeeded;
        }
CmdRotatedBeamLocation