Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ObjectIDtoHandle fails on entities that have been erased

66 views
Skip to first unread message

Mike Tuersley

unread,
Mar 29, 2003, 2:26:53 AM3/29/03
to
To expand on that, 2004 is not vc6 compatable. It requires the code to
be recompiled using vc7.0 - NOT 7.1.
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies

Ian Swatton

unread,
Apr 1, 2003, 3:06:09 AM4/1/03
to
Hi

Cheers for the information.

Is there another way of gets an object's handle from its ID number if the
object has been erased?

VBA/VB gives an error that the object has been erased when using
.ObjectIDToObject.

Thanks in advance.

Ian

Ed Jobe

unread,
Apr 1, 2003, 11:50:28 AM4/1/03
to
How about this function:

Public Function UndeleteObjectByHandle(Handle As Long) As AcadEntity
'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
Set UndeleteObjectByHandle = ThisDrawing.Database.HandleToObject(Handle)
End Function

--
Ed
--

"Ian Swatton" <ian.s...@microdrainage.co.uk> wrote in message
news:oprmxx4j...@discussion.autodesk.com...

Ian Swatton

unread,
Apr 2, 2003, 4:30:08 AM4/2/03
to
On Tue, 1 Apr 2003 08:50:28 -0800, Ed Jobe <edl...@hotmail.com> wrote:

> How about this function:
>
> Public Function UndeleteObjectByHandle(Handle As Long) As AcadEntity
> '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
> Set UndeleteObjectByHandle = ThisDrawing.Database.HandleToObject(Handle)
> End Function
>

Cheers for this function...

This function looks good - but which reference file do I need to add to VBA
get the VLAX object/interface?

Thanks in advance

Ian

Ed Jobe

unread,
Apr 2, 2003, 11:48:25 AM4/2/03
to
VLAX is a class module that wraps the vlide. Here is a link to a description
of working with lisp in vba. http://code.acadx.com/articles/002.htm. Look
for a link to vlax.cls.

--
Ed
--

"Ian Swatton" <ian.s...@microdrainage.co.uk> wrote in message

news:oprmzwoi...@discussion.autodesk.com...

Ian Swatton

unread,
Apr 3, 2003, 7:47:21 AM4/3/03
to
Cheers for this Ed

On Wed, 2 Apr 2003 08:48:25 -0800, Ed Jobe <edl...@hotmail.com> wrote:

> VLAX is a class module that wraps the vlide. Here is a link to a
> description
> of working with lisp in vba. http://code.acadx.com/articles/002.htm. Look
> for a link to vlax.cls.
>
> --
> Ed
> --

I've now tried this code which works (if you know the handle of the entity
that you want to undelete). However AutoCad only returns the objectID
number in the ACADDocument_ObjectErased event and there does not seem to be
away to map the objectID number back to the handle (which in VB/VBA is a
string whereas objectID is a long).

Thanks in advance for any further info.

Cheers

Ian

0 new messages