'文字画框 Sub WZhk() On Error Resume Next Dim mypnt1 As Variant Dim mypnt2 As Variant mypnt1 = ThisDrawing.Utility.GetPoint(, "请选择左下角点:") mypnt2 = ThisDrawing.Utility.GetCorner(mypnt1, "请选择右上角点:") 'crossing 方法选择所有内部对象 Dim sset1 As AcadSelectionSet If Not IsNull(ThisDrawing.SelectionSets.Item("SS1")) Then Set sset1 = ThisDrawing.SelectionSets.Item("SS1") sset1.Delete End If Set sset1 = ThisDrawing.SelectionSets.Add("SS1") '定义过滤规则 Dim filterType1(0) As Integer Dim filterData1(0) As Variant filterType1(0) = 0 filterData1(0) = "TEXT" sset1.Select acSelectionSetCrossing, mypnt1, mypnt2, filterType1, filterData1 ' 使用Crossing选择模式,选择内部所有对象(包含边界本身) Dim ADTEXT As AcadText Dim MINPT As Variant Dim MAXPT As Variant Dim RECPL As AcadLWPolyline For Each ADTEXT In sset1 ADTEXT.GetBoundingBox MINPT, MAXPT Set RECPL = 绘制矩形(MINPT, MAXPT, 0) Next End Sub
|