- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-5-15 22:43:00
|
显示全部楼层
- 可以通过XY轴判断
- Function GetDimByX(ByVal X)
- '获取一标注点的横坐标为X的所有标注
- Dim FilterType(6) As Integer
- Dim FilterData(6) As Variant
- Dim pDims() As AcadObject
- Dim ss As AcadSelectionSet
- Dim pnt(2) As Double
- pnt(0) = X
- FilterType(0) = 0
- FilterData(0) = "Dim*"
- FilterType(1) = -4
- FilterData(1) = "<or"
- FilterType(2) = -4
- FilterData(2) = "=,*,*"
- FilterType(3) = 13
- FilterData(3) = pnt
- FilterType(4) = -4
- FilterData(4) = "=,*,*"
- FilterType(5) = 14
- FilterData(5) = pnt
- FilterType(6) = -4
- FilterData(6) = "or>"
- Set ss = ThisDrawing.ActiveSelectionSet
- ss.Clear
- ss.Select acSelectionSetAll, , , FilterType, FilterData
- ReDim pDims(ss.Count - 1)
- For i = 0 To ss.Count - 1
- Set pDims(i) = ss(i)
- Next i
- GetDimByX = pDims
- End FunctionFunction GetDimByY(ByVal Y)
- '获取一标注点的纵坐标为Y的所有标注
- Dim FilterType(6) As Integer
- Dim FilterData(6) As Variant
- Dim pDims() As AcadObject
- Dim ss As AcadSelectionSet
- Dim pnt(2) As Double
- pnt(1) = Y
- FilterType(0) = 0
- FilterData(0) = "Dim*"
- FilterType(1) = -4
- FilterData(1) = "<or"
- FilterType(2) = -4
- FilterData(2) = "*,=,*"
- FilterType(3) = 13
- FilterData(3) = pnt
- FilterType(4) = -4
- FilterData(4) = "*,=,*"
- FilterType(5) = 14
- FilterData(5) = pnt
- FilterType(6) = -4
- FilterData(6) = "or>"
- Set ss = ThisDrawing.ActiveSelectionSet
- ss.Clear
- ss.Select acSelectionSetAll, , , FilterType, FilterData
- ReDim pDims(ss.Count - 1)
- For i = 0 To ss.Count - 1
- Set pDims(i) = ss(i)
- Next i
- GetDimByY = pDims
- End FunctionSub Test2()
- Dim obj As AcadLine
- ThisDrawing.Utility.GetEntity obj, pnt
- Dim a As Double
- a = obj.StartPoint(0)
- For Each i In GetDimByX(a)
- MsgBox i.ObjectName
- Next i
- End Sub
|
|