2、先做一个ActiveXDll
clsEntity类:
Private WithEvents oEntity As AcadEntity
Private Sub oEntity_Modified(ByVal pObject As AutoCAD.IAcadObject) If pObject.ObjectName = "AcDbCircle" Then MsgBox pObject.Handle End If End Sub
Public Sub GetEntity(Entity As AcadEntity) Set oEntity = Entity End Sub
TlsTest类:
Private Entitys As New Collection Public Sub Add(Entity As AcadEntity) Dim oEnt As New clsEntity oEnt.GetEntity Entity Entitys.Add oEnt End Sub
编译后在VBA这样调用:
Private myTest As New TlsTest
Sub test() Dim obj As AcadEntity, pnt ThisDrawing.Utility.GetEntity obj, pnt myTest.Add obj End Sub
用上面的代码选择圆
改变圆的属性时会弹出该圆的Handle