Results 1 to 6 of 6

Thread: Last Command/Resent Input.

  1. #1
    Active Member
    Join Date
    2002-05
    Posts
    72
    Login to Give a bone
    0

    Default Last Command/Resent Input.

    Through VBA can we set what the "Last Command" was?

    For example I have an mleader routine (Xleader) that sets a bunch of environmental variables, the layer etc. then executes the mleader, then restores the layer....

    ...
    ThisDrawing.SendCommand "mleader" & vbCr
    ThisDrawing.ActiveLayer = savedLayer

    Now if the user want to do the command multiple times they must select it from the button, menu or tool pallet. I want them to be able to right click to get "Xleader" but of course they get mleader.

  2. #2
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Last Command/Resent Input.

    I use a combo of VBA and AutoLISP to do that. I make the VBA program into a macro and then envoke the macro with AutoLISP. I keep a simple line of LISP in either my ACADDOC.lsp or my ACAD.lsp that loads everytime and allows me to type a command on the command line that runs the macro...

    (defun c:Macrocommand () (command "-vbarun" "Macrocommand"))

    Now when I type Macrocommand (or whatever you want the command to be) at the command line, it runs the macro "Macrocommand" from VBA. I'm sure there's a better and probably faster way of doing it but this allows me to keep hitting the space bar (i.e. ENTER KEY) and keep right on running the macro over and over again. actually, I hope there is a better way and someone else can shed some light. This might get ya started though.

  3. #3
    Active Member
    Join Date
    2002-05
    Posts
    72
    Login to Give a bone
    0

    Default Re: Last Command/Resent Input.

    The problem is the sendcommand throws that out the window.

  4. #4
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Last Command/Resent Input.

    you could place a "sendcommand" of the actual lisp routine command at the bottom so the loop continues. Of course you'd probably have to hit the ESC key to get out.

  5. #5
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: Last Command/Resent Input.

    SendCommand is asyncronous and runs outside of vba. There's no way to avoid that. If all you're doing is just those two lines, use lisp or .NET. Otherwise, don't use SendCommand.
    C:> ED WORKING....

  6. #6
    Woo! Hoo! my 1st post
    Join Date
    2014-02
    Posts
    1
    Login to Give a bone
    0

    Default Re: Last Command/Resent Input.

    I suggest you to try to post "mleader" command this way:
    ThisDrawing.SendCommand "(command ""mleader"")" & vbCr

    The built in lisp function "command" will not affect the command line history, and when the user clicks right button then the right routine (Xleader) is started. This solution works at least in Autocad 2005 VBA/COM interface.

    So, I don't know if it is possible to set the "Last Command", but maybe this will help to solve yopur problem.

    Filip

Similar Threads

  1. Replies: 1
    Last Post: 2010-03-05, 04:51 AM
  2. Recent numeric input at command line
    By dflores.83105 in forum AutoCAD General
    Replies: 2
    Last Post: 2009-09-22, 07:31 PM
  3. Command Input by Drawing a Symbol
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2007-11-28, 05:39 PM
  4. Input @ command appears to be slow
    By nw-surv3 in forum AutoCAD LT - General
    Replies: 4
    Last Post: 2007-02-14, 06:32 PM
  5. Offset command from Dynamic Input
    By Grumpy in forum AutoCAD General
    Replies: 1
    Last Post: 2005-08-23, 09:05 PM

Posting Permissions

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