ActiveDocument.Utility.Prompt

Discussion in 'AutoCAD' started by Allen Johnson, May 26, 2004.

  1. How come this doesn't prompt anything to the command window when I run the
    macro from a lisp function?


    ActiveDocument.Utility.Prompt "UCSFollow is " & IIf(val, "On", "Off") &
    vbCrLf


    Calling Lisp Routine:

    (defun C:UF0 () (vl-vbarun "ToggleUCSFollow.FOff") (princ))

    When I run the macro directly from the VBA IDE it displays the proper
    prompt, but not when I enter UF0 at the command prompt.

    Running from within the VBA IDE:
    Command:
    Command: UCSFollow is Off
    UCSFollow is On
    UCSFollow is Off
    UCSFollow is On

    Just running from lisp:
    Command: (vl-vbarun "ToggleUCSFollow.FOff")
    "ToggleUCSFollow.FOff"

    Running the UF0 command:
    Command:
    UF0
    Command: uf0

    Command: move

    Select objects:
     
    Allen Johnson, May 26, 2004
    #1
  2. Call AcadApplication.Update after the call to Prompt()
     
    Tony Tanzillo, May 26, 2004
    #2
  3. It only appears to work when cmdecho is set, see screen copy below:

    Command: cmdecho

    Enter new value for CMDECHO <0>: 1

    Command: _.-VBARUN
    Macro name: ToggleUCSFollow.FOff
    UCSFollow is Off

    Command:
    Command:
    Command: _.-VBARUN
    Macro name: ToggleUCSFollow.FOn
    UCSFollow is On

    Command:
    Command:
    Command: cmdecho

    Enter new value for CMDECHO <1>: 0

    Command:
    Command:
    Command:
    Command: cmdecho

    Enter new value for CMDECHO <0>: 1

    Command: _.-VBARUN
    Macro name: ToggleUCSFollow.FOn
    UCSFollow is On

    Command:
    Command:
    Command: _.-VBARUN
    Macro name: ToggleUCSFollow.FOff
    UCSFollow is Off

    Command:
    Command:
     
    Allen Johnson, May 26, 2004
    #3
  4. I've had similar problems, the prompts show up fine when you call it straight from the IDE or using vbarun, but when called from a lisp you get garbage.Try using this technique.

    (defun c:test()
    (vla-runmacro
    (vlax-get-acad-object) "c:/test.dvb!module.macro")
    (princ)
    )

    Hope that helps.
    Matthew Corbin
     
    Matthew.Corbin, May 27, 2004
    #4
  5. Thanks!
    But where is (vla-runmacro ..) documented? Or is it? I can't find it in
    Developer Documentation.
     
    Allen Johnson, May 27, 2004
    #5
  6. The vla- functions come from the ActiveX interface, and therefore are
    documented in the ActiveX and VBA Reference. IOW, that function is using the
    RunMacro method of the Application object.

    --
    R. Robert Bell


    Thanks!
    But where is (vla-runmacro ..) documented? Or is it? I can't find it in
    Developer Documentation.
     
    R. Robert Bell, May 27, 2004
    #6
  7. Using the RunMacro method from LISP will work, but you need
    to remember that you can't hide a VB dialog to get input from
    the Command line in that case, so if there's any need for it,
    this is not the way to go.

    Perhaps this might work:

    Public Sub Prompt(Msg As String)
    Dim OldCmdEcho As Short
    With ThisDrawing
    OldCmdEcho = .GetVariable("CMDECHO")
    .SetVariable "CMDECHO", 1
    .Utility.Prompt Msg
    .SetVariable "CMDECHO" OldCmdEcho
    End With
    End Sub
     
    Tony Tanzillo, May 28, 2004
    #7
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.