Autodesk.Revit.DB.PointOnEdgeEdgeIntersection是Revit API中的一个类,表示图形中两个边的交点。
PointOnEdgeEdgeIntersection有两个构造函数:
PointOnEdgeEdgeIntersection(Edge edge1, Edge edge2, XYZ intersectionPoint)
edge1和edge2分别为两个相交的边intersectionPoint为交点坐标PointOnEdgeEdgeIntersection(Edge edge1, Edge edge2, double t1, double t2, XYZ intersectionPoint)
edge1和edge2分别为两个相交的边t1和t2分别为edge1和edge2上与交点相邻的参数值intersectionPoint为交点坐标PointOnEdgeEdgeIntersection有如下属性:
Edge1:获取或设置第一个相交的边Edge2:获取或设置第二个相交的边IntersectionPoint:获取或设置交点坐标T1:获取或设置Edge1上与交点相邻的参数值T2:获取或设置Edge2上与交点相邻的参数值PointOnEdgeEdgeIntersection没有公开的方法。
// 获取两个选中的边对象
List<Edge> selectedEdges = new List<Edge>();
// ...
// 遍历边列表,找到相交的边并获取交点
foreach (Edge edge1 in selectedEdges)
{
foreach (Edge edge2 in selectedEdges)
{
if (edge1.Equals(edge2)) continue;
IntersectionResult result = edge1.Intersect(edge2);
if (result == null) continue;
if (result.GetType() != typeof(PointOnEdgeEdgeIntersection)) continue;
PointOnEdgeEdgeIntersection intersection = result as PointOnEdgeEdgeIntersection;
// 需要进一步判断交点是否在两条边上
// ...
}
}