求助:选择集中的过滤问题
有一个明细表,想通过下面的代码,采用鼠标点选范围的方法,读取指定位置的文字信息。如读取点1(15,0)和点2(25,10)之间的文字。但是选取内容总是为空。请高手诊断:Dim adText as AcadText
Dim adMText As AcadMText
Dim adss as AcadSelectionset
Dim fType(0 to 3)As Integet
Dim fData(0 to 3) As Variant
Dim ReturnPoint As Variant
Dim LTPoint(3),RBPoint(3) As Double
On Error Resume Next
Form1.Hide
ReturnPoint=ThisDrawing.Utility.getPoint(,"Enter the 1st Point:")
LTPoint(0)=ReturnPoint(0):LTPoint(1)=ReturnPoint(1):LTPoint(2)=0
ReturnPoint=ThisDrawing.Utility.getPoint(,"Enter the 1st Point:")
RBPoint(0)=ReturnPoint(0):RBPoint(1)=ReturnPoint(1):RBPoint(2)=0
If Not IsNull(ThisDrawing.selectionSets.Item("adss"))Then
Set adss=ThisDrawing.SelectionSets.Item("adss")
adss.Delete
End If
set adss=ThisDrawing.SelectionSets/Add("adss")
adss.Clear
fType(0)=-4:fData(0)="<OR"
fType(1)=0:fData(1)="TEXT"
fType(2)=0:fData(2)="MTEXT"
fType(3)=-4:fData(3)="OR>"
adss.SelectionSetsWindow LTPoint,RBPoint,fType,fData
/就是这一句出现问题,选择集总是空白。如果去掉后面的fType,fData参数,还是空白。采用Crossing方法,也是空白
采用adss.SelectOnScreen,则可以选择到对象,ObjectName为AcadText。/
Form1.Show
........
请指教
adss.Select acSelectionSetWindow, p1, p2 本帖最后由 woaishuijia 于 2012-8-24 10:22 编辑
变量声明错了Dim LTPoint(3),RBPoint(3) As Double应为Dim LTPoint(2) As Double, RBPoint(2) As Double 感谢大家的回复。
把Dim LTPoint(3),RBPoint(3) As Double
改成Dim LTPoint(3),RBPoint(3)
就可以了
页:
[1]