- 积分
- 724
- 明经币
- 个
- 注册时间
- 2007-7-30
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2012-5-11 23:05:32
|
显示全部楼层
已OK了
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.GeomeTry
Imports Autodesk.AutoCAD.Runtime
Namespace tooltip
Public Class Class1
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
<CommandMethod("TestOn")> _
Public Sub MyTestOn()
AddHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
End Sub
<CommandMethod("TestOff")> _
Public Sub MyTestOff()
RemoveHandler ed.PointMonitor, New PointMonitorEventHandler(AddressOf ed_PointMonitor)
End Sub
Private Sub ed_PointMonitor(ByVal sender As Object, ByVal e As PointMonitorEventArgs)
Dim db As Database = HostApplicationServices.WorkingDatabase
Dim ipc As InputPointContext = e.Context
Dim ePaths() As FullSubentityPath = ipc.GetPickedEntities()
If ePaths.Length > 0 Then
Dim ePath As FullSubentityPath = ePaths(0)
Dim trans As Transaction = db.TransactionManager.StartTransaction()
Dim entId As ObjectId = ePath.GetObjectIds()(0)
Dim ent As Entity = CType(trans.GetObject(entId, OpenMode.ForRead), Entity)
e.AppendToolTipText(vbCrLf & "这是 :" + ent.GetType().FullName)
trans.Commit()
End If
End Sub
End Class
End Namespace |
|