|
发表于 2007-8-20 10:03:00
|
显示全部楼层
刚刚找了找VBA的帮助,找到了个方法GETSUBENTY,我就知道,可以做到了,以下是源程序。
Sub delsubent()
' This example prompts the user to select on object on the screen with a mouse click,
' and returns some information about the selected object.
Dim Object As AcadEntity
Dim PickedPoint As Variant, TransMatrix As Variant, ContextData As Variant
Dim HasContextData As String
On Error GoTo NOT_ENTITY
Err.Clear
TRYAGAIN:
' MsgBox "Use the mouse to click on an object in the current drawing after dismissing this dialog box."
' Get information about selected object
ThisDrawing.Utility.GetSubEntity Object, PickedPoint, TransMatrix, ContextData
' Process and display selected object properties
If VarType(ContextData) vbEmpty Then
Object.Delete
ThisDrawing.Regen acActiveViewport
End If
GoTo TRYAGAIN
NOT_ENTITY:
End Sub
|
|