mr0810 发表于 2018-9-25 17:05:00

求助,怎么构造选择集筛选出cad图中的栅格图片(RasterImage)?求VBA代码!

请问,我用AddRaster方法插入到CAD图纸中的图片,怎么用选择集筛选出来(VBA)?
If Not IsNull(Thisdrawing.SelectionSets.Add.SelectionSets.Item("XXX")) Then
    Set ObjSset = Thisdrawing.SelectionSets.Add.SelectionSets.Item("XXX")
    ObjSset.Delete
End If
Set ObjSset = Thisdrawing.SelectionSets.Add("XXX")
fType(0) =100
fData(0) ="RasterImage"
ObjSset.Select acSelectionSetWindow, Pnt1,Pnt2,fType, fData
我把fType(0) =100改成0也不行
哪位给指点一下,多谢
在Pnt1,Pnt2范围内肯定有图片的

poly168 发表于 2018-10-8 09:31:00

Sub aaa()
    Dim myss As AcadSelectionSet, datavalue(0) As Variant, gpcode(0) As Integer, groupCode As Variant, dataCode As Variant, n As Long
    Do While ThisDrawing.SelectionSets.count0
      ThisDrawing.SelectionSets.Item(0).Delete
    Loop
    Set myss = ThisDrawing.SelectionSets.Add("XXX")
    gpcode(0) = 100: datavalue(0) = "RasterImage"
    groupCode = gpcode: dataCode = datavalue
    myss.SelectOnScreen groupCode, dataCode   '鼠标框选
    'myss.Select acSelectionSetWindow, pnt1, pnt2, groupCode, dataCode'给定坐标窗口范围选择,pnt1和pnt2 为维数为3的数组
    n = myss.count
End Sub
经实测可用,将鼠标框选语句替换成窗选语句即可。
页: [1]
查看完整版本: 求助,怎么构造选择集筛选出cad图中的栅格图片(RasterImage)?求VBA代码!