Cannot end command in progress

Discussion in 'AutoCAD' started by JoeP, May 13, 2004.

  1. JoeP

    JoeP Guest

    I have written a Lisp program that creates the proper path to find our drawing files....

    The program worked fine with AutoCad 2000.

    The program stores the name in a variable called odwg

    ie: odwg = "U:\\details\\25\\2508\\2508-317.dwg"

    amsg = "Drawing was not located"

    The command it issues to open the drawing is:

    (if odwg (command "_.VBASTMT"(strcat"AcadApplication.Documents.Open\""odwg"\"")) (alert amsg))

    When I run the program in Autocad Mechanical, the drawing gets opened but if I try to SAVEAS, I get an error message that a Command is in progress, hit enter to abort or [RETRY].

    Enter and ESC do not work, nor does RETRY. The only command that works is QUIT.

    (I am now running on Windows XP but was also having the problem with Windows NT4.0

    What command could be in progress?

    I have been checking other reports of similar 'command in progress' errors and have tried the recommended work arounds...

    draw a line, mirror it, then proceed.
    hit up arrow key, then enter
    save the drawing, then begin edit

    None works...when I try to do a saveas, I keep getting the message that a command is in progress..

    Hope someone has an answer, besides, its a bug, live with it. I used to use this program dozens of times a day and it has saved me considerable time locating the drawings by only entering the number without navigating the path. I am now forced to labor through the navigation process to open every drawing.

    THIS IS ONE OF THE REASONS I CRINGE EVERY TIME AUTOCAD COMES OUT WITH A NEW RELEASE.

    Joe Posge
    Application Engineer
     
    JoeP, May 13, 2004
    #1
  2. JoeP

    ECCAD Guest

    In VBA, do you release the document object ?
    Bob
     
    ECCAD, May 13, 2004
    #2
  3. JoeP

    Steve Doman Guest

    Joe,

    Just a guess: Note in the function below, the extra space character at
    the end of the Open word. Perhaps AutoCAD is waiting for this space
    character which acts as like hitting the <Enter> key?

    (defun OpenDwg (fqnName)
    ;; Posted by Mr. Robert Bell
    (command "._VBAStmt"
    (strcat "AcadApplication.Documents.Open \"" fqnName "\"")))

    - Steve Doman

    JoeP wrote:

     
    Steve Doman, May 14, 2004
    #3
  4. JoeP

    JoeP Guest

    I will give it a try, thanks.

    Also, your example shows (command "._VBA...) while mine begins (command :_.VBA...)

    where the underscore begins my statement, yours begins with the period.

    I will try that also.

    Thanks

    Joe
     
    JoeP, May 14, 2004
    #4
  5. JoeP

    JoeP Guest

    Adding the extra space at the end prevented the program from finding the drawing at all.

    Joe
     
    JoeP, May 14, 2004
    #5
  6. JoeP

    JoeP Guest

    Reversing the period and underscore caused an UNKNOWN COMMAND error.

    Joe
     
    JoeP, May 14, 2004
    #6
  7. JoeP

    Steve Doman Guest

    Joe,

    Robert's function works fine for me. Are you sure that your file name
    is ok? Try (findfile "U:\\details\\25\\2508\\2508-317.dwg")

    The dot and underscore prefixes may be used in any order.

    Steve
     
    Steve Doman, May 14, 2004
    #7
  8. JoeP

    JoeP Guest

    Still cannot get this to work. The drawing opens but I cannot do a SAVEAS.

    Is there another command I can use to open drawings from within lisp or VBA while in MDI mode?

    Thanks

    Joe
     
    JoeP, May 14, 2004
    #8
  9. JoeP

    ECCAD Guest

    Joe,
    If MDI = 1, then to open / save .dwg's you need to do a 'close' somewhere in the loop..
    e.g. if from script..
    open
    drawing_1
    do something
    qsave
    close
    open
    drawing_2
    do something
    qsave
    close
    ....

    Bob
     
    ECCAD, May 15, 2004
    #9
  10. JoeP

    JoeP Guest

    Is this new to Mechanical 6 PowerPack? This code ran fine for Acad2000.

    The whole point of my program is to type the drawing name (same as our part numbers) and let the program locate the drawing to avoid length process of finding the drawings via folder tree.

    Thanks

    Joe
     
    JoeP, May 16, 2004
    #10
  11. JoeP

    ECCAD Guest

    Try this change:
    (if odwg (command "_.VBASTMT" (strcat "AcadApplication.Documents.Open" chr(34) odwg chr(34))) (alert amsg))

    Bob
     
    ECCAD, May 16, 2004
    #11
  12. JoeP

    CAB2k Guest

    Joe,
    This has nothing to do with your problem but you might want to
    revise the section to this:

    Code:
    ;Try to locate drawings...
    (cond
    ((setq odwg (findfile loc1)))
    ((setq odwg (findfile loc4)))
    ((setq odwg (findfile loc2)))
    ((setq odwg (findfile loc5)))
    ((setq odwg (findfile loc6)))
    ((setq odwg (findfile loc7)))
    ((setq odwg (findfile loc8)))
    ((setq odwg (findfile loc9)))
    ((setq odwg (findfile loc10)))
    ((setq odwg (findfile loc11)))
    ((setq odwg (findfile loc12)))
    )
    
    It will be faster as the findfiles will stop at the first hit.
    Ugh unless you wanted to find the last occurences if duplicates
    exist in other directories.
     
    CAB2k, May 16, 2004
    #12
  13. JoeP

    JoeP Guest

    Thanks, this is helpful to know.

    I was getting ready to add a loop to the program as now our drawings include the revision letter...so

    2508-317 is first occurrance
    2508-317-A is first revision
    2508-317-B is next revision
    etc.

    Thus, I was planning to look for the first 8 characters then (if not found) loop through a-z extensions. (Most are a, b, or c).

    However, if I cannot work with the drawing, once it is found and opened, I have to abandon the program alltogether.

    Joe
     
    JoeP, May 17, 2004
    #13
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.