Determine If The Command Line Is Ready

Discussion in 'AutoCAD' started by ptti, Jan 7, 2005.

  1. ptti

    ptti Guest

    Hello All. I am writing a macro to override the SAVE,QSAVE,SAVEAS, and OPEN commands in AutoCAD 2000. I have a macro in which I have ACADStartup(). I want to send the "UNDEFINE" function and "SAVE" to the command line in ACADStartup(), but when I do it sends it but the command does not work since the command line is not quite ready to receive commands yet. It is sending the command when the command line says:

    Regenerating model.
    Initializing VBA System...
    Loading VBA startup file...

    But the command line does not say:

    Command:

    yet. So I am guessing that this means that AutoCAD is doing some loading of stuff and the command line is not quite ready to receive anything. So my question is how to determine that the command line is ready to receive commands? Or should I be placing the "UNDEFINE" command in a different place and where?

    Thanks,
    Brad
     
    ptti, Jan 7, 2005
    #1
  2. The (S::Startup) function in AutoLISP. Or see if one of the Document events
    would fit the bill.

    --
    R. Robert Bell


    Hello All. I am writing a macro to override the SAVE,QSAVE,SAVEAS, and OPEN
    commands in AutoCAD 2000. I have a macro in which I have ACADStartup(). I
    want to send the "UNDEFINE" function and "SAVE" to the command line in
    ACADStartup(), but when I do it sends it but the command does not work since
    the command line is not quite ready to receive commands yet. It is sending
    the command when the command line says:

    Regenerating model.
    Initializing VBA System...
    Loading VBA startup file...

    But the command line does not say:

    Command:

    yet. So I am guessing that this means that AutoCAD is doing some loading of
    stuff and the command line is not quite ready to receive anything. So my
    question is how to determine that the command line is ready to receive
    commands? Or should I be placing the "UNDEFINE" command in a different
    place and where?

    Thanks,
    Brad
     
    R. Robert Bell, Jan 7, 2005
    #2
  3. Public Function IsAwake() As Boolean
    '+-- check acadState object to see if
    'AutoCAD is running a command
    Dim State As AcadState
    State = _cadApp.GetAcadState
    'send back return value
    IsAwake = IIf(State.IsQuiescent, True, False)
    End Function

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jan 7, 2005
    #3
  4. "Mike Tuersley" write:
    PMJI, but what is the difference between the above
    and this:

    IsAwake = State.IsQuiescent
     
    Tony Tanzillo, Jan 7, 2005
    #4
  5. Good question =) One of those "I grabbed it from ADN but never spent the
    time to read it"s.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jan 10, 2005
    #5
  6. ptti

    ptti Guest

    I tried this but it is not quite what I want. Within the
    Sub ACADStartup()
    I ran a Do Loop calling this routine but it just caused AutoCAD to focus on this Do loop and not on finishing loading up. I also have a DoEvents within the Do loop.

    What I want is to run an "UNDEFINE" function and then redefine the OPEN and SAVE methods. When I do this in
    Sub ACADStartup()
    it fires the code before the actual Command prompt is ready therefore the undefining and redefining did not actually work.

    So, I was wanting a way to see when the command prompt showed "Command:"
    At the beginning of launching AutoCAD the command line says:
    Regenerating model.
    Initializing VBA System...
    Loading VBA startup file...
    and then will say:
    Command:
    It is here where I want my VB code in
    Sub ACADStartup()
    to actually run.

    Any ideas or suggestions?

    Thanks in Advance.

    Brad
     
    ptti, Jan 10, 2005
    #6
  7. Try on EndLoad?

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jan 10, 2005
    #7
  8. ADN? You got that from ADN ?
     
    Tony Tanzillo, Jan 10, 2005
    #8
  9. Why are you trying to undefine OPEN and SAVE?

    What are you going to do in place of them?
     
    Tony Tanzillo, Jan 10, 2005
    #9
  10. ADN? You got that from ADN ?
    Fairly sure ???? - back about 2000i/2002 time frame

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Jan 10, 2005
    #10
  11. The following works fine for me:

    (DEFUN S::STARTUP ()
    (SETVAR "CMDECHO" 0)
    (command "undefine" "copy")
    (SETVAR "CMDECHO" 1)
    )

    Regards - Nathan
     
    Nathan Taylor, Jan 10, 2005
    #11
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.