- 积分
- 73549
- 明经币
- 个
- 注册时间
- 2001-6-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2002-7-9 12:56:00
|
显示全部楼层
我把程序给写出来,你看看吧
Sub GetTxtIntPnt()
ThisDrawing.Utility.Prompt vbCrLf & "本程序可显示所有选中文字(包括单行文字及多行文字)的坐标点"
Dim sSet As AcadSelectionSet
'On Error Resume Next
Set sSet = CreateSelectionSet
Dim fType As Variant, fData As Variant
BuildFilter fType, fData, 0, "*text"
sSet.SelectOnScreen fType, fData
Dim entry As AcadEntity
Dim Pnt As Variant
ThisDrawing.Utility.Prompt vbCrLf & "以下为所有文本的坐标点:"
For Each entry In sSet
Pnt = entry.InsertionPoint
ThisDrawing.Utility.Prompt vbCrLf & Pnt(0) & ", " & Pnt(1) & ", " & Pnt(2)
Next entry
ThisDrawing.Utility.Prompt vbCrLf & "坐标点显示完毕,此程序由明经通道提供:http://www.mjtd.com"
ThisDrawing.Utility.Prompt vbCrLf
End Sub
Public Function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet
Dim ss As AcadSelectionSet
On Error Resume Next
Set ss = ThisDrawing.SelectionSets(ssName)
If Err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)
ss.Clear
Set CreateSelectionSet = ss
End Function
Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())
Dim fType() As Integer, fData()
Dim index As Long, i As Long
index = LBound(gCodes) - 1
For i = LBound(gCodes) To UBound(gCodes) Step 2
index = index + 1
ReDim Preserve fType(0 To index)
ReDim Preserve fData(0 To index)
fType(index) = CInt(gCodes(i))
fData(index) = gCodes(i + 1)
Next
typeArray = fType: dataArray = fData
End Sub |
|