DCL & LISP: cannot switch ortho during insert command after dialog?

Hello everybody,

I'm trying to create a routine for inserting standard blocks. While working on this I have noticed that after displaying a dialog I cannot switch ortho mode during the insert command. To test this you need to create a block "testBlock" and create two file: testins.lsp and testins.dcl (see code below).

After loading testins.lsp you can use two commands
1.
testins: This one dislays the dialog. After pressing OK you can insert the block but you cannot switch ortho mode during the command.
2.
testins2: This function is for comparisson. It doesn't use a dialog and there is no problem switching ortho mode.

What am I doing wrong?

Thanks in advance, Roy.

 

;;; testins.lsp
(defun c:testins ( / dclFile)
(setq dclFile (load_dialog "testins.dcl"))
(new_dialog "testinsDialog" dclFile)
(action_tile "accept" "(ActionInsert)")
(action_tile "cancel" "(done_dialog)")
(start_dialog)
(unload_dialog dclFile)
(princ)
)

(defun ActionInsert ( / )
(done_dialog)
(command "_.-insert" "testBlock")
(while (> (getvar "cmdactive") 0) (command pause))
)

(defun c:testins2 ( / )
(command "_.-insert" "testBlock")
(while (> (getvar "cmdactive") 0) (command pause))
)

(princ)

// testins.dcl
testinsDialog : dialog {
ok_cancel;
}

 

Comments

  • There's a bug in the lisp function (command pause). Bricsys know about it. 

    Perhaps use (command (getpoint "\nPick insertion point:")) as a workaround for now.

  • Dan, thanks for your answer. But I think (command pause) is not the problem here. Both testins and testins2 use this and testins2 works fine. The difference seems to be the dialog. I am not that experienced when it comes to dcl-programming. Maybe the way I handle the dialog is just faulty. To further test your suggestion I have also tried 2 variant functions that do not use the pause command (see code). And the results are the same: the ortho problem occurs only with the dialog function.

    ;;; testins.lsp
    (defun c:testins ( / dclFile)
    (setq dclFile (load_dialog "testins.dcl"))
    (new_dialog "testinsDialog" dclFile)
    (action_tile "accept" "(ActionInsert)")
    (action_tile "cancel" "(done_dialog)")
    (start_dialog)
    (unload_dialog dclFile)
    (princ)
    )

    (defun ActionInsert ( / )
    (done_dialog)
    (command "_.-insert" "testBlock" "_scale" 1 (getpoint "\nInsertion Point: ") (getpoint))
    )

    (defun c:testins2 ( / )
    (command "_.-insert" "testBlock" "_scale" 1 (getpoint "\nInsertion Point: ") (getpoint))
    )
  • Hi Roy,

    Did you try (command (getpoint)), not just (getpoint)?

    It maybe that we are using different versions.  I'm using Bricscad Pro v10.3.5 beta and both the following routines work well for me:

    (defun ActionInsert ( / )
      (done_dialog)
      (command "_.-insert" "testBlock")
      (while (> (getvar "cmdactive") 0) (command (getpoint "\nPick point:")))
    )

    (defun c:testins2 ( / )
      (command "_.-insert" "testBlock")
      (while (> (getvar "cmdactive") 0) (command (getpoint "\nPick point:")))
    )

     

  • Dan, I don't have access to beta-versions so I am using 10.2.14 (build 17927). And for that version the code in your last post has the same ortho problem for the function with dialog. Thanks again for trying to help.

  • I've found a workaround. Instead of calling the insert function from the action_tile, I now only set a variable and call the function later. This confirms my suspicion that the handling of the dialog is an issue here.

    ;;; testins.lsp
    (defun c:testins ( / dclFile doAction)
    (setq dclFile (load_dialog "testins.dcl"))
    (new_dialog "testinsDialog" dclFile)
    (action_tile "accept" "(done_dialog)(setq doAction 'T)")
    (action_tile "cancel" "(done_dialog)")
    (start_dialog)
    (unload_dialog dclFile)
    (if doAction (ActionInsert))
    (princ)
    )

    (defun ActionInsert ( / )
    (command "_.-insert" "testBlock")
    (while (> (getvar "cmdactive") 0) (command pause))
    )
This discussion has been closed.