itacad Posted June 27, 2018 Share Posted June 27, 2018 Hello, I would like to know if there is any way to run a series of commands in automatic sequence. My problem is that I want to automatically run a zoom extension after the conclusion of the command previously launched... the command in question is part of the commands of an application for autocad and it works by selecting an object...for example like erase command... I launch erase command, I select an object, I confirm and then I make the zoom. is it possible? maybe even a series of commands... Many greetings! Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 27, 2018 Share Posted June 27, 2018 Use a command reactor: (vl-load-com) (or *endcommandreactor* (setq *endcommandreactor* (vlr-command-reactor nil '((:vlr-commandended . endcmd)))) ) (defun endcmd (calling-reactor endcmdinfo) (and (wcmatch (car endcmdinfo) "ERASE") (vla-zoomextents (vlax-get-acad-object))) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 28, 2018 Share Posted June 28, 2018 Look into Macro's that's what their for. Else a script or a lisp, but you have to be careful if you stop or error some where. Replace all the input with say,lisp input checking what you have entered is valid then run the command or entmake with all the correct values. Dont do questions inside the "command" answer 1 wrong and it all falls apart. You can daisy chain lisps if you want but I would use a script. A script can be called from a lisp its just another call to a command (defun myy () (command "script" "MYYYYSCRIPT") ) Quote Link to comment Share on other sites More sharing options...
itacad Posted June 28, 2018 Author Share Posted June 28, 2018 Thanks to both, unfortunately I'm in trouble with your suggestions For ronjonp: can you please post a complete lisp? I tried to integrate your piece of code but I create errors... For BIGAL: I've never used a script, I'd like to learn, can you give me the necessary indications starting from the basics? Thank you again Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 28, 2018 Share Posted June 28, 2018 That is complete code? Load it when your drawing opens then try the ERASE command. IMO this is very distracting, but what you asked for. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 29, 2018 Share Posted June 29, 2018 Like ronjonp your request is a bit vague. But say erase & zoom extents, copy paste this to command line and type e3. (defun C:e3 ( / ss) (command "erase" (ssget) "") (command "Zoom" "extents") ) Quote Link to comment Share on other sites More sharing options...
itacad Posted July 1, 2018 Author Share Posted July 1, 2018 Thank you! It works! I made the following "corrections" (command "_.erase" (ssget) "") (command "Zoom" "e") thank you very much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.