Results 1 to 4 of 4

Thread: AutoCAD command intercept and cancel

  1. #1
    Join Date
    Mar 2009
    Posts
    19

    AutoCAD command intercept and cancel

    Does anyone know how to cancel an AutoCAD command once started? At the moment I'm intercepting commands using VBA and running particular macros - ie the TEXT command causes a specific text layer to be selected, the BLOCK command changes the layer to 0 etc.

    However, sometimes it would be better to take more control of the situation by cancelling the command and I can't find any information on how to do this.

  2. #2
    Join Date
    Jan 2008
    Location
    English Lake District
    Posts
    2,833
    Press the Esc key.

    That should abort any commands / macros / lisps / ect that are running, (unless it has been redefined).
    Im intelligent enough to know that I dont know everything; but I'll tell you all about it anyway.

  3. #3
    Join Date
    Mar 2009
    Posts
    19
    Probably should have been more specific - I'm looking to cancel commands within a VBA macro. For example... if I wanted to stop users from exploding blocks...

    Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)

    If UCase(CommandName) Like "EXPLODE*

    ' insert command cancelling code here

    End If

  4. #4
    Join Date
    Jan 2008
    Location
    English Lake District
    Posts
    2,833
    Could you not just put a null string (or a regen or similar) where you say "insert command cancelling code here"?

    Remember to put it back to explode as the macro exits.

    Of course there is the usual problem that if the macro crashes or is stopped the redefined command is not restored to its original.

    This link talks about undefining and redefining commands (the explode command as it happens).

    http://www.cadeverything.com/help/sh...light=redefine
    Im intelligent enough to know that I dont know everything; but I'll tell you all about it anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •