I am trying to write a lisp that will run a command, then when that command finishes the next command runs. Currently the way I have it set up, it tries to run both commands at the same time. Heres my code:
(DEFUN C:bm () (C:AEREBUILDDB) ;;Rebuilds DataBase ~~>Same as Ctrl+Alt+R
(C:AEresequence) ) ;;Resequences Item Numbers~~>Same as Ctrl+Alt+W
I use Autocad electrical, so if you are wondering AEREBUILDDB & AERESEQUENCE are "predefined" lisp's in autocad. What I want Is to have the dialog box come up for AEREBUILDDB put in my determined info, hit enter and then have AERESEQUENCE come up and do the same, but right now both dialog boxes come up virtually at the same time. Any Ideas?
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
Maybe, you should put between these 2 calls for lisps line :
(command "\\")
"\\" signs pause...
M.R.
manamalewis,
I do not have Autocad electrical, but try
(defun c:bm () (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "AErebuilddb") (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "AEresequence") (princ) )
Henrique
Unfortunately, this sounds like the old issue we used to have in Land Desktop when attempting to automate.
You're calling these built-in commands via the (c:CommandName) syntax, which essentially calls the .NET, or ARX code-behind, and especially when dealing with LISP calls to commands involving dialogs, this simply isn't going to work.
Your best bet (IMO), is to look into the COM API... You'll need some error handling to release any external database objects needed to perform the necessary task(s) via COM, but that's what i used to have to do for Land Desktop.
You *might* be able to use a Command reactor to fire the secondary command when the CommandCancelled, CommandEnded, or CommandFailed Event is raised, but that's just speculation on my part.
"How we think determines what we do, and what we do determines what we get."