嗨,小家伙。
我不会解决这个问题。但对我来说是正确的部分。更好地检查。问题坐标系。我想。我想知道数字是否会带来财富?当问题不接近坐标0,0,0时。当远离问题和错误时。问候语。
- 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
- 'New . New . New . New . New
- Dim pont(0 To 2) As Double
- Dim kont(0 To 2) As Double
- pont(0) = Poly1.Coordinates(0)
- pont(1) = Poly1.Coordinates(1)
- pont(2) = 0
- kont(0) = 0
- kont(1) = 0
- kont(2) = 0
- Poly1.Move pont, kont
- Poly2.Move pont, kont
- 'New . New . New . New . New
- '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
- 'New . New . New . New . New
- Poly1.Move kont, pont
- Poly2.Move kont, pont
- 'New . New . New . New . New
- End Sub
|