BuildingCoder.CmdRectDuctCorners.AnalyseDuct C# (CSharp) Méthode

AnalyseDuct() static private méthode

Analyse the given duct element: determine its first rectangular connector, retrieve its solid, find the face containing the connector, and list its four vertices.
static private AnalyseDuct ( Duct duct ) : bool
duct Duct
Résultat bool
        static bool AnalyseDuct( Duct duct )
        {
            bool rc = false;

              Connector c1;
              if( !GetFirstRectangularConnector( duct, out c1 ) )
              {
            Trace.TraceError( "The duct is not rectangular!" );
              }
              else
              {
            Options opt = new Options();
            opt.DetailLevel = ViewDetailLevel.Fine;
            GeometryElement geoElement = duct.get_Geometry( opt );

            //foreach( GeometryObject obj in geoElement.Objects ) // 2012

            foreach( GeometryObject obj in geoElement ) // 2013
            {
              Solid solid = obj as Solid;
              if( solid != null )
              {
            bool foundFace = false;
            foreach( Face face in solid.Faces )
            {
              foundFace = FaceContainsConnector( face, c1 );
              if( foundFace )
              {
                Trace.WriteLine( "==> Four face corners:" );

                EdgeArray a = face.EdgeLoops.get_Item( 0 );

                foreach( Edge e in a )
                {
                  XYZ p = e.Evaluate( 0.0 );

                  Trace.WriteLine( "Point = "
                    + Util.PointString( p ) );
                }
                rc = true;
                break;
              }
            }
            if( !foundFace )
            {
              Trace.WriteLine( "[Error] Face not found" );
            }
              }
            }
              }
              return rc;
        }