嗨,小家伙。我用了一种更具描述性的方式。正在等待帮助。提前谢谢。
当我移动到区域2时,对象会出错。欺骗我。(UCS)坐标使问题成为?
- Sub DEDECTIPONPL()
- Dim Poly1 As AcadLWPolyline
- Dim Poly2 As AcadLWPolyline
- Dim pts As Variant
- Dim varPick As Variant
- Dim objEnt As AcadEntity
- ThisDrawing.Utility.GetEntity objEnt, varPick, "Select Poly 1: "
- If objEnt.ObjectName = "AcDbPolyline" Then
- Set Poly1 = objEnt
- End If
- ThisDrawing.Utility.GetEntity objEnt, varPick, "Select Poly 2: "
- If objEnt.ObjectName = "AcDbPolyline" Then
- Set Poly2 = objEnt
- End If
- 'This Project can be dedected, 1,2 or 3 intersection point of Plines.
- 'This program will detect the number of point of intersection.
- pts = Poly1.IntersectWith(Poly2, acExtendNone)
- If UBound(pts) = 2 Then
- MsgBox "1 intersection point dedected." & vbCr & _
- "X= " & pts(0) & ", " & "Y= " & pts(1) & vbCr, _
- vbInformation, "Intersection Point Dedector"
- ElseIf UBound(pts) = 5 Then
- MsgBox "2 intersection point dedected." & vbCr & _
- "X= " & pts(0) & ", " & "Y= " & pts(1) & vbCr & _
- "X= " & pts(3) & ", " & "Y= " & pts(4), _
- vbInformation, "Intersection Point Dedector"
- ElseIf UBound(pts) = 8 Then
- MsgBox "3 intersection point dedected." & vbCr & _
- "X= " & pts(0) & ", " & "Y= " & pts(1) & vbCr & _
- "X= " & pts(3) & ", " & "Y= " & pts(4) & vbCr & _
- "X= " & pts(6) & ", " & "Y= " & pts(7), _
- vbInformation, "Intersection Point Dedector"
- Else
- MsgBox "intersection point number > 3" & vbCr & "Program Limits Exceed"
- End If
- End Sub
trim3.dwg
|