BIMnotes

Revit二次开发:创建FamilyInstance无法获取面

2020-02-24  本文已影响0人  BIMnotes
make sure to turn on the option
  1. 使用NewFamilyInstance带有face的重载,必须用Element.Geometry 获取,并打开ComputeReferences选项
Face face = null;
Options geomOptions = new Options();
geomOptions.ComputeReferences = true;
GeometryElement wallGeom = wall.get_Geometry(geomOptions);
foreach (GeometryObject geomObj in wallGeom)
{
    Solid geomSolid = geomObj as Solid;
    if (null != geomSolid)
    {
        foreach (Face geomFace in geomSolid.Faces)
        {
            face = geomFace;
            break;
        }
        break;
    }
}

  1. 连续的墙体,对于共面的墙无法获取reference。取消墙连接即可。
WallUtils.DisallowWallJoinAtEnd(wall, 0);
上一篇 下一篇

猜你喜欢

热点阅读