Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

New to Autolisp - Need Help

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
gcsjlewis
382 Views, 5 Replies

New to Autolisp - Need Help

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?

5 REPLIES 5
Message 2 of 6
marko_ribar
in reply to: gcsjlewis

Maybe, you should put between these 2 calls for lisps line :

(command "\\")

 

"\\" signs pause...


M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 3 of 6
gcsjlewis
in reply to: marko_ribar

Ok, I tried that, but the next part of my code, the (AERESEQUENCE) Doesn't trigger Jason Lewis | CAD Technician General Control Systems, Inc. a PPL Energy Service Company Tel: 518.270.8045 ext. 327 | Fax: 518.270.8042 Direct: 518.279-7544 60 Cohoes Ave, Green Island N.Y. 12183 www.gcontrol.netP Please consider the environment before printing this email ________________________________ The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
Message 4 of 6
hmsilva
in reply to: gcsjlewis

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

EESignature

Message 5 of 6
gcsjlewis
in reply to: hmsilva

It didn't work but thanks anyway. I got it figured out here's what I have: (DEFUN C:bm () (C:AEREBUILDDB ) "\\" ;;Rebuilds DataBase ~~>Same as Ctrl+Alt+R (command "Zoom" "Extents") ;;Shows All in Model Space (C:AERESEQUENCE) ;;Resequences Item Numbers~~>Same as Ctrl+Alt+w (command "layout" "set" "layout1" "zoom" "all" "_qsave") ;;Switches to layout,Zooms All & Saves (c:aepanelreport) "\\") ;;Panel Report~~>Same as Ctrl+Alt+E As you can see it is a lot of basic commands that I am trying to throw into one command. I do have another question though. What would I put into my code to accept the dialog boxes default settings. I tried the "" command at different points in the code but it didn't work. Jason Lewis | CAD Technician General Control Systems, Inc. a PPL Energy Service Company Tel: 518.270.8045 ext. 327 | Fax: 518.270.8042 Direct: 518.279-7544 60 Cohoes Ave, Green Island N.Y. 12183 www.gcontrol.netP Please consider the environment before printing this email ________________________________ The information contained in this message is intended only for the personal and confidential use of the recipient(s) named above. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately, and delete the original message.
Message 6 of 6
BlackBox_
in reply to: gcsjlewis

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."

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost