- 积分
- 451
- 明经币
- 个
- 注册时间
- 2005-1-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Public Sub selectAtPoint()
Dim selectionSet1 As AcadSelectionSet, Lastset As AcadSelectionSet Dim pyline As AcadLWPolyline Dim line1 As AcadLine Dim intPoints As Variant Dim Fdata(0) As Variant Dim Ftype(0) As Integer 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 Dim pointPt(0 To 8000) As Double Dim str As String Dim vSelectPoint As Variant, vSelectPoint1 As Variant Dim selection As AcadSelectionSet ThisDrawing.SendCommand "cmdecho" & vbCr & "0" & vbCr On Error Resume Next Set selectionSet1 = ThisDrawing.SelectionSets.Add("SS1") If Err Then Set selectionSet1 = ThisDrawing.SelectionSets("SS1") selectionSet1.Delete End If Set selectionSet1 = ThisDrawing.PickfirstSelectionSet If selectionSet1.Count = 0 Then Set selectionSet1 = ThisDrawing.SelectionSets("SS1") If Err Then Set selectionSet1 = ThisDrawing.SelectionSets.Add("SS1") selectionSet1.Clear selectionSet1.SelectOnScreen End If Set Lastset = ThisDrawing.SelectionSets.Add("SS2") ThisDrawing.Utility.Prompt "请选择测线:" Fdata(0) = "3" Ftype(0) = 8 m = 0 For i = 0 To selectionSet1.Count - 1 Set line1 = selectionSet1.Item(i) line1.Color = acGreen line1.GetBoundingBox vSelectPoint, vSelectPoint1 Set selection = ThisDrawing.ActiveSelectionSet selection.Select acSelectionSetCrossing, vSelectPoint, vSelectPoint1, Ftype, Fdata For j = 0 To selection.Count - 1 Set pyline = selection.Item(j) pyline.Color = acBlue intPoints = line1.IntersectWith(pyline, acExtendNone) If VarType(intPoints) <> vbEmpty Then n = 0 For k = LBound(intPoints) To UBound(intPoints) pointPt(m) = intPoints(n) pointPt(m + 1) = intPoints(n + 1) pointPt(m + 2) = intPoints(n + 2) k = k + 2 m = m + 3 n = n + 3 Next Else MsgBox "无交点数据", , "IntersectWith Example" End If Next Next
end sub
为什么 intPoints 是空的呢,问题出在哪呢,pyline是些LWPolyline的等高线。 |
|