高人,显显吧,这个交点的问题在哪啊
Public Sub selectAtPoint()Dim selectionSet1 As AcadSelectionSet, Lastset As AcadSelectionSet<BR> Dim pyline As AcadLWPolyline<BR> Dim line1 As AcadLine<BR> Dim intPoints As Variant<BR> Dim Fdata(0) As Variant<BR> Dim Ftype(0) As Integer<BR> Dim i As Integer, j As Integer, k As Integer, m As Integer, n As Integer, p As Integer, q As Integer, r As Integer, s As Integer<BR> Dim pointPt(0 To 8000) As Double<BR> <BR> Dim str As String<BR> <BR> Dim vSelectPoint As Variant, vSelectPoint1 As Variant<BR> Dim selection As AcadSelectionSet<BR> ThisDrawing.SendCommand "cmdecho" & vbCr & "0" & vbCr<BR> <BR> On Error Resume Next<BR> Set selectionSet1 = ThisDrawing.SelectionSets.Add("SS1")<BR> If Err Then<BR> Set selectionSet1 = ThisDrawing.SelectionSets("SS1")<BR> selectionSet1.Delete<BR> End If<BR> Set selectionSet1 = ThisDrawing.PickfirstSelectionSet<BR> If selectionSet1.Count = 0 Then<BR> Set selectionSet1 = ThisDrawing.SelectionSets("SS1")<BR> If Err Then Set selectionSet1 = ThisDrawing.SelectionSets.Add("SS1")<BR> selectionSet1.Clear<BR> selectionSet1.SelectOnScreen<BR> End If<BR> <BR> Set Lastset = ThisDrawing.SelectionSets.Add("SS2")<BR> ThisDrawing.Utility.Prompt "请选择测线:"<BR> Fdata(0) = "3"<BR> Ftype(0) = 8<BR> <BR> m = 0<BR> For i = 0 To selectionSet1.Count - 1<BR> Set line1 = selectionSet1.Item(i)<BR> line1.Color = acGreen<BR> line1.GetBoundingBox vSelectPoint, vSelectPoint1<BR> <BR> Set selection = ThisDrawing.ActiveSelectionSet<BR> selection.Select acSelectionSetCrossing, vSelectPoint, vSelectPoint1, Ftype, Fdata<BR> For j = 0 To selection.Count - 1<BR> Set pyline = selection.Item(j)<BR> pyline.Color = acBlue<BR> intPoints = line1.IntersectWith(pyline, acExtendNone)<BR> If VarType(intPoints) <> vbEmpty Then<BR> n = 0<BR> For k = LBound(intPoints) To UBound(intPoints)<BR> pointPt(m) = intPoints(n)<BR> pointPt(m + 1) = intPoints(n + 1)<BR> pointPt(m + 2) = intPoints(n + 2)<BR> k = k + 2<BR> m = m + 3<BR> n = n + 3<BR> Next<BR> Else<BR> MsgBox "无交点数据", , "IntersectWith Example"<BR> End If<BR> Next<BR> Next
end sub
为什么 intPoints 是空的呢,问题出在哪呢,pyline是些LWPolyline的等高线。 等高线的Z轴是0么? 全是0,可能是些什么问题呢,飞狐大哥!
页:
[1]