Pause for a specified interval

Discussion in 'AutoCAD' started by Dale Levesque, Jun 9, 2004.

  1. I'm having a problem with the following code. The first time the app runs, i
    get a 'no function definition: C:BR_VW' error. The next time it is run,
    everything works fine. I'm hoping that If i get the lisp routine to wait
    while the vlx is loading it might work.

    Does anybody have a pause routine that you could pass an arg in seconds to?

    Any suggestions?

    Dale

    (defun c:br_view ()
    (if (and (null c:br_vw) (findfile "Bo.vlx"))
    (progn
    (load "Bo.vlx")
    (c:br_vw)
    )
    (c:br_vw)
    )
    )
     
    Dale Levesque, Jun 9, 2004
    #1
  2. No function definition for delay. This is what I've used previously in VB.

    Public Sub g_sb_Delay(ai_Count As Long)

    Dim Start As Long
    Dim i As Long
    i = 0

    Start = Timer ' Set start time.
    Do While Timer < Start + ai_Count
    DoEvents ' Yield to other processes.
    Loop

    End Sub
     
    Dale Levesque, Jun 9, 2004
    #2
  3. Got it. Thanks to Tony Tanzillo.

    (defun wait (seconds / stop)
    (setq stop (+ (getvar "DATE")
    (/ seconds 86400.0)))
    (while (> stop (getvar "DATE")))
    )
     
    Dale Levesque, Jun 9, 2004
    #3
  4. The waiting has no affect whatsoever though.

    I still get the error no matter how long it waits.
     
    Dale Levesque, Jun 9, 2004
    #4
  5. Dale Levesque

    Matt W Guest

    Oops!
    It should've been...

    (command "delay" "1000")

    --
    Matt W

    There are 3 kinds of people:
    Those who can count, and those who can't.

    "Dale Levesque" <dale at dynamicwindows.com> wrote in message
    | No function definition for delay. This is what I've used previously in VB.
    |
    | Public Sub g_sb_Delay(ai_Count As Long)
    |
    | Dim Start As Long
    | Dim i As Long
    | i = 0
    |
    | Start = Timer ' Set start time.
    | Do While Timer < Start + ai_Count
    | DoEvents ' Yield to other processes.
    | Loop
    |
    | End Sub
    |
    |
    | | > If I remeber correctly, (delay 1000) will make LSP wait for 1 second.
    | > Don't know if there's something similar for VLISP.
    | >
    | > --
    | > Matt W
    | >
    | > There are 3 kinds of people:
    | > Those who can count, and those who can't.
    | >
    | > "Dale Levesque" <dale at dynamicwindows.com> wrote in message
    | > | > | I'm having a problem with the following code. The first time the app
    | runs,
    | > i
    | > | get a 'no function definition: C:BR_VW' error. The next time it is
    run,
    | > | everything works fine. I'm hoping that If i get the lisp routine to
    wait
    | > | while the vlx is loading it might work.
    | > |
    | > | Does anybody have a pause routine that you could pass an arg in
    seconds
    | > to?
    | > |
    | > | Any suggestions?
    | > |
    | > | Dale
    | > |
    | > | (defun c:br_view ()
    | > | (if (and (null c:br_vw) (findfile "Bo.vlx"))
    | > | (progn
    | > | (load "Bo.vlx")
    | > | (c:br_vw)
    | > | )
    | > | (c:br_vw)
    | > | )
    | > | )
    | > |
    | > |
    | >
    | >
    |
    |
     
    Matt W, Jun 9, 2004
    #5
  6. Dale Levesque

    JRWalker Guest

    Make a call within the lsp to load itself and run.
     
    JRWalker, Jun 9, 2004
    #6
  7. Huh? How can it run it's code to load itself and run if it isn't loaded?
     
    Dale Levesque, Jun 9, 2004
    #7
  8. Dale Levesque

    TCEBob Guest

    consider:

    .. . .
    (defun lobo()(load "bo.vlx"))
    (vlax-add-cmd "lobo" 'lobo)
    (command "lobo")
    ((while (= (logand (getvar "cmdactive") 1) 1)
    (command pause))
    .. . .

    rs
     
    TCEBob, Jun 9, 2004
    #8
  9. Dale Levesque

    ECCAD Guest

    Just load the function in acad2000.lsp or acad2002.lsp.
    Then call it when needed.
    Bob
     
    ECCAD, Jun 9, 2004
    #9
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.