Autodesk.Revit.DB Opening类

Autodesk.Revit.DB Opening

Autodesk Revit项目或族文档中的洞口。

语法

public class Opening : Element

附注

该对象表示各种不同类型的洞口:

  • 墙中由修订项目中的两个边界点创建的矩形洞口。
  • 由应用于屋顶、楼板、天花板、梁、支撑或柱的一组曲线创建的洞口。
  • 一个垂直的竖井开口延伸到一个或多个水平。
  • 在族文档中的墙或天花板上创建的简单洞口。

根据打开的类型,此类的某些属性将不可用。

这个对象派生自Element基对象,并且支持该对象的所有方法,例如检索该对象的参数的能力。此对象还支持访问结构分析模型,但此功能仅适用于Autodesk Revit Structure。

示例

### private void Getinfo_Opening(Opening opening)

{
    string message = "Opening:";

    //get the host element of this opening
    message += "\nThe id of the opening's host element is : " + opening.Host.Id.IntegerValue;
    
    //get the information whether the opening has a rect boundary
    //If the opening has a rect boundary, we can get the geometry information from BoundaryRect property.
    //Otherwise we should get the geometry information from BoundaryCurves property
    if (opening.IsRectBoundary)
    {
        message += "\nThe opening has a rectangular boundary.";
        //array contains two XYZ objects: the max and min coords of boundary
        IList<XYZ> boundaryRect = opening.BoundaryRect;
    
        //get the coordinate value of the min coordinate point
        XYZ point = opening.BoundaryRect[0];
        message += "\nMin coordinate point:(" + point.X + ", "
                                + point.Y + ", " + point.Z + ")";
    
        //get the coordinate value of the Max coordinate point
        point = opening.BoundaryRect[1];
        message += "\nMax coordinate point: (" + point.X + ", "
                                + point.Y + ", " + point.Z + ")";
    }
    else
    {
        message += "\nThe opening doesn't have a rectangular boundary.";
        // Get curve number
        int curves = opening.BoundaryCurves.Size;
        message += "\nNumber of curves is : " + curves;
        for (int i = 0; i < curves; i++)
        {
            Autodesk.Revit.DB.Curve curve = opening.BoundaryCurves.get_Item(i);
            // Get curve start point
            message += "\nCurve start point: " + XYZToString(curve.GetEndPoint(0));
            // Get curve end point
            message += "; Curve end point: " + XYZToString(curve.GetEndPoint(1));
        }
    }
    TaskDialog.Show("Revit",message);

}

// output the point's three coordinates
string XYZToString(XYZ point)
{
    return "(" + point.X + ", " + point.Y + ", " + point.Z + ")";
}

继承层次结构

System Object

Autodesk.Revit.DB Element

Autodesk.Revit.DB Opening

另见

Opening Members

Autodesk.Revit.DB Namespace

属性

BoundaryCurves

项目文档中非矩形洞口或族文档中所有洞口的几何图形信息。

BoundaryRect

如果开口边界是矩形,则检索几何体信息。

Host

检索此洞口的宿主元素。

IsRectBoundary

检索洞口是否具有矩形边界的信息。

IsoburrentIn3D

指示洞口在载入到项目中时在三维视图中是否透明。

IsTransparentInElevation

指示洞口载入到项目中时在立面视图中是否透明。

注:翻译自Revit Api docs 2018

posted @ 2024-11-17 22:54  funtim  阅读(23)  评论(0)    收藏  举报