make sure to turn on the option
- 使用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;
}
}
- 连续的墙体,对于共面的墙无法获取reference。取消墙连接即可。
WallUtils.DisallowWallJoinAtEnd(wall, 0);