BuildingCoder.CmdRollingOffset.f C# (CSharp) Метод

f() приватный Метод

private f ( UIDocument uidoc, Document doc ) : System.Result
uidoc UIDocument
doc Document
Результат System.Result
        Result f(
            UIDocument uidoc,
            Document doc)
        {
            string message = string.Empty;

              // Extract all pipe system types

              var mepSystemTypes
            = new FilteredElementCollector( doc )
              .OfClass( typeof( PipingSystemType ) )
              .OfType<PipingSystemType>()
              .ToList();

              // Get the Domestic hot water type

              var domesticHotWaterSystemType =
            mepSystemTypes.FirstOrDefault(
              st => st.SystemClassification ==
            MEPSystemClassification.DomesticHotWater );

              if( domesticHotWaterSystemType == null )
              {
            message = "Could not find Domestic Hot Water System Type";
            return Result.Failed;
              }

              // Looking for the PipeType

              var pipeTypes =
            new FilteredElementCollector( doc )
              .OfClass( typeof( PipeType ) )
              .OfType<PipeType>()
              .ToList();

              // Get the first type from the collection

              var firstPipeType =
              pipeTypes.FirstOrDefault();

              if( firstPipeType == null )
              {
            message = "Could not find Pipe Type";
            return Result.Failed;
              }

              var level = uidoc.ActiveView.GenLevel;

              if( level == null )
              {
            message = "Wrong Active View";
            return Result.Failed;
              }

              var startPoint = XYZ.Zero;

              var endPoint = new XYZ( 100, 0, 0 );

              using( var t = new Transaction( doc ) )
              {
            t.Start( "Create pipe using Pipe.Create" );

            var pipe = Pipe.Create( doc,
              domesticHotWaterSystemType.Id,
              firstPipeType.Id,
              level.Id,
              startPoint,
              endPoint );

            t.Commit();
              }
              Debug.Print( message );
              return Result.Succeeded;
        }