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