Revit API 二次开发 C# 获取线与线之间的关系 获取相交点.

  Wall wall1 = doc.GetElement(uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, "")) as Wall;
  Wall wall2 = doc.GetElement(uiDoc.Selection.PickObject(Autodesk.Revit.UI.Selection.ObjectType.Element, "")) as Wall;
            
  Curve curve1 = (wall1.Location as LocationCurve).Curve;
  Curve curve2 = (wall2.Location as LocationCurve).Curve;

  IntersectionResultArray resultArray = null;
  SetComparisonResult result = curve1.Intersect(curve2, out resultArray);

   //获取相交点
    XYZ point = null;
     if (result.Equals(SetComparisonResult.Overlap))
     {
          foreach (IntersectionResult item in resultArray)
            {
                point= item.XYZPoint;
             }
      }

你可能感兴趣的:(Revit,二次开发)