Sub test()
Dim oEnt As AcadEntity
Dim pp As Variant
Dim lHandle As Long
ThisDrawing.Utility.GetEntity oEnt, pp
lHandle = oEnt.Handle
oEnt.Delete
UndeleteObjectByHandle lHandle
End Sub
Public Sub UndeleteObjectByHandle(Handle As Long)
'bring back deleted object
'by calling (entdel) with the object's handle.
Dim lispstr As String
Dim VL As New VLAX
lispstr = "(entdel (handent """ & Handle & """))"
VL.EvalLispExpression lispstr
End Sub
Public Function Ent2lspEnt(entObj As AcadEntity) As String
'Designed to work with SendCommand, which can't pass objects.
'This gets an objects handle and converts it to a string
'of lisp commands that returns an entity name when run in SendCommand.
Dim entHandle As String
entHandle = entObj.Handle
Ent2lspEnt = "(handent " & Chr(34) & entHandle & Chr(34) & ")"
End Function
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Ed_Jobe" <eljobe> wrote in messageLisp
href="news:f129247.0@WebX.maYIadrTaRb">news:f129247.0@WebX.maYIadrTaRb...
is the only way I know of. If you know the hanle pass it to the (handent)
function, which returns an ename. Pass that to the (entdel) function. If the
entity is already deleted, (entdel) undeletes it. Works in the current editing
session only. Here's what I have. It requires VLAX.cls from acadx.com.
Sub test()
Dim oEnt As AcadEntity
Dim pp As Variant
Dim lHandle As Long
ThisDrawing.Utility.GetEntity oEnt, pp
lHandle = oEnt.Handle
oEnt.Delete
UndeleteObjectByHandle lHandle
End SubPublic Sub UndeleteObjectByHandle(Handle As Long)
'bring back deleted object
'by calling (entdel) with the object's handle.
Dim lispstr As String
Dim VL As New VLAXlispstr = "(entdel (handent """ & Handle & """))"
VL.EvalLispExpression lispstr
End SubPublic Function Ent2lspEnt(entObj As AcadEntity) As String
'Designed to work with SendCommand, which can't pass objects.
'This gets an objects handle and converts it to a string
'of lisp commands that returns an entity name when run in SendCommand.
Dim entHandle As String
entHandle = entObj.Handle
Ent2lspEnt = "(handent " & Chr(34) & entHandle & Chr(34) & ")"
End Function