境界条件

BoundaryConditions

次の 3 つの種類の BoundaryConditions があります。

次のコードを使用して、タイプと該当するジオメトリが取得されます。

コード領域 29-9: 境界条件タイプとジオメトリを取得

public void GetInfo_BoundaryConditions(BoundaryConditions boundaryConditions)
{
    string message = "BoundaryConditions : ";

    boundaryConditions.GetBoundaryConditionsType();
    switch (boundaryConditions.GetBoundaryConditionsType())
    {
        case BoundaryConditionsType.Point:
            XYZ point = boundaryConditions.Point;
            message += "\nThis BoundaryConditions is a Point Boundary Conditions.";
            message += "\nLocation point: (" + point.X + ", "
                        + point.Y + ", " + point.Z + ")";
            break;
        case BoundaryConditionsType.Line:
            message += "\nThis BoundaryConditions is a Line Boundary Conditions.";
            Curve curve = boundaryConditions.get_Curve(0);
            // Get curve start point
            message += "\nLocation Line: start point: (" + curve.GetEndPoint(0).X + ", "
                    + curve.GetEndPoint(0).Y + ", " + curve.GetEndPoint(0).Z + ")";
            // Get curve end point
            message += ";  end point:(" + curve.GetEndPoint(1).X + ", "
                    + curve.GetEndPoint(1).Y + ", " + curve.GetEndPoint(1).Z + ")";
            break;
        case BoundaryConditionsType.Area:
            message += "\nThis BoundaryConditions is an Area Boundary Conditions.";
            for (int i = 0; i < boundaryConditions.NumCurves; i++)
            {
                Autodesk.Revit.DB.Curve areaCurve = boundaryConditions.get_Curve(i);
                // Get curve start point
                message += "\nCurve start point:(" + areaCurve.GetEndPoint(0).X + ", "
                        + areaCurve.GetEndPoint(0).Y + ", " + areaCurve.GetEndPoint(0).Z + ")";
                // Get curve end point
                message += "; Curve end point:(" + areaCurve.GetEndPoint(1).X + ", "
                        + areaCurve.GetEndPoint(1).Y + ", " + areaCurve.GetEndPoint(1).Z + ")";
            }
            break;
        default:
            break;
    }

    TaskDialog.Show("Revit",message);
}