JerryFiedler Posted January 8, 2010 Posted January 8, 2010 Hi, I am writing a lisp routine that needs to invoke the bhatch command. The routine does, in fact, execute bhatch but only through the command line, as if the user had entered -bhatch. I cannot figure out why I do not get the dialog box. On a similar note, when my lisp routine invokes mtext the edit box is not displayed. Here again everything seems to be done in the command line. I will appreciate any comments. I may be leaving some very elementary item out of the code. Although I programed in many languages from FORTRAN in the 1960's to object based VBA this is my first full effort at AutoLisp. Regards, Jerry Quote
CarlB Posted January 8, 2010 Posted January 8, 2010 Usually in lisps it is desired to NOT have dialog boxes so the routine can continue & supply information to the command. Some commands run from lisp won't by default bring up the dialog box. you mention "-bhatch"; that hyphen insures there won't be a DB. try "bhatch" or "hatch". To bring up the DB, if in "command line" mode, the tilde is used, as in: (command "hatch" "`") Quote
JerryFiedler Posted January 8, 2010 Author Posted January 8, 2010 CarlB, My routine takes an AutoCAD command, sets a specific layer (one for dimensions, one for text, etc.) and then executes the command. This whole thing comes about because in our engineering office the engineers have LT and the designer/drafters have full AutoCAD. With their setup there is a VBA "BeginCommand" that handles all of this nicely. The LT setup, since it cannot use VBA, has the layer switched just before the command is executed. However when the command is finished running you are left on the switched layer, that is, you are no longer on the original layer. This sounds trivial but it is a pain in the neck. My program works but for mtext I cannot get the edit box and for bhatch I cannot get the dialog box. The toolbar button would have, as an example for dimlinear, ^C^C(if(null c:LT_Switch)(load "LT_Switch"));(c:LT_Switch "dimlinear");. This passes the command to my LT_Switch routine. I have attached the routine in case you or anyone else is interested. Thanks, Jerry Quote
JerryFiedler Posted January 8, 2010 Author Posted January 8, 2010 Here's the attachment LT_Switch.lsp Quote
CarlB Posted January 8, 2010 Posted January 8, 2010 I think you need to test for a few command names which don't issue a dialog box, and send a "tilde". Such as: ( T (while (command CommandName (if (member Commandname '("bhatch" "-bhatch" "mtext" "hatch")) (command "~");;to bring up D.B. (while (= (logand 1 (getvar "cmdactive")) 1) (command pause))))) I'm not sure that first 'while' is needed but apparently you have it working.... Good luck! Quote
wizman Posted January 8, 2010 Posted January 8, 2010 Also to bring up dialog boxes, you may use initdia: like: (initdia) (command "_plot") or use vla-sendcommand to force db's Quote
JerryFiedler Posted January 9, 2010 Author Posted January 9, 2010 Thank you both, CarlB and wizman, I appreciate your help. I am just learning lisp and I am experiencing a steep learning curve which probably explains why I have an unnecessary nested "while". I will clean up the code and give both your methods a shot. Regards, Jerry Quote
wizman Posted January 9, 2010 Posted January 9, 2010 Thank you both, CarlB and wizman, I appreciate your help. I am just learning lisp and I am experiencing a steep learning curve which probably explains why I have an unnecessary nested "while". I will clean up the code and give both your methods a shot. Regards, Jerry Cheers Jerry, Enjoy Lisping..'-) Quote
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.