Check if an object has been deleted

Discussion in 'AutoCAD' started by mgrigoriev, May 27, 2004.

  1. mgrigoriev

    mgrigoriev Guest

    Hi,
    How can I distinguish if an AutoCAD object was deleted or hasn't yet been created.

    The following code returns an error, saying that the object was deleted:

    ERRORHANDLER:
    On Error Resume Next
    If (TypeName(PL1O) = "IAcadLine" Or TypeName(PL1O) = "IAcadArc") And Not PL1O Is Nothing Then PL1O.Delete

    Even if the object hasn't yet been created it goes through to the PL1O.Delete line. The only reason I added the (TypeName(PL1O) = "IAcadLine" code is that I thought that if the object doesn't exist, it will be false. Anyway, I am lost here...
     
    mgrigoriev, May 27, 2004
    #1
  2. mgrigoriev

    manoj_vest Guest

    You need to post the code by which you are initialize the variable PL1O. Which will guide why your if statement is coming to true. May be error is not in this line but is due to the way the object has be created/Initialize.
     
    manoj_vest, May 27, 2004
    #2
  3. A possible workaround, in VBA, is to use the SendCommand method to pass the
    handle back to the command-line, and execute the (entdel) there

    PL1O Is Nothing Then PL1O.Delete
    PL1O.Delete line. The only reason I added the (TypeName(PL1O) = "IAcadLine"
    code is that I thought that if the object doesn't exist, it will be false.
    Anyway, I am lost here...
     
    Humberto Guerrero Obando, May 27, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.