BuildingCoder.CmdNewDimensionLabel.findSketchPlane C# (CSharp) Метод

findSketchPlane() статический приватный Метод

Return a sketch plane from the given document with the specified normal vector, if one exists, else null.
static private findSketchPlane ( Document doc, XYZ normal ) : SketchPlane
doc Document
normal XYZ
Результат SketchPlane
        static SketchPlane findSketchPlane(
            Document doc,
            XYZ normal)
        {
            FilteredElementCollector collector
            = new FilteredElementCollector( doc );

              collector.OfClass( typeof( SketchPlane ) );

            #if EXPLICIT_CODE
              SketchPlane result = null;
              foreach( SketchPlane e in collector )
              {
            if( e.Plane.Normal.IsAlmostEqualTo( normal ) )
            {
              result = e;
              break;
            }
              }
              return result;
            #endif // EXPLICIT_CODE

              //Func<SketchPlane, bool> normalEquals = e => e.Plane.Normal.IsAlmostEqualTo( normal ); // 2013

              Func<SketchPlane, bool> normalEquals = e => e.GetPlane().Normal.IsAlmostEqualTo( normal ); // 2014

              return collector.Cast<SketchPlane>().First<SketchPlane>( normalEquals );
        }
CmdNewDimensionLabel