在Revit API中,CylindricalFace 是描述圆柱面的类之一。该类继承自 PlanarFace 类,拥有其所有的属性和方法。
Axis: 获取或设置圆柱面的轴线,类型为 Line。Radius: 获取或设置圆柱面的半径,类型为 double。CylindricalFace 类提供了以下方法:
CylindricalFace(Reference reference, Element element, Line axis, double radius):通过传入某个元素的引用,元素所在的面的引用,圆柱面的轴线和半径创建一个 CylindricalFace 实例。该构造函数为类的初始化方法。Project(Geometry.Plane plane):将该圆柱面投影到指定的平面上,返回一个 PlanarFace 实例。以下示例展示了如何使用 CylindricalFace 类,以获取元素的所有圆柱面,并将其半径和轴线打印出来。
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.OfClass(typeof(FamilyInstance));
foreach (Element element in collector)
{
GeometryElement geometryElement = element.get_Geometry(new Options());
foreach (GeometryObject geometryObject in geometryElement)
{
Solid solid = geometryObject as Solid;
if (solid != null && soli