- Sub test()
- Dim e As AcadEntity
- Set e = ThisDrawing.ModelSpace(0)
- If TypeOf e Is AcadRasterImage Then
- Dim ri As AcadRasterImage
- Set ri = e
- Dim c As mccomarx.AcDbRasterImage
- Set c = New mccomarx.AcDbRasterImage
- ' 获取光栅图像定义的ObjectId
- Dim id As Long
- id = c.imageDefId(ri)
- If id <> 0 Then
- Dim o As AcadObject
- Set o = ThisDrawing.ObjectIdToObject(id)
- o.Delete
- End If
- End If
- End Sub
其中用到了ARX的COM库,需要哪个版本的,我可以发布下。 |