leonucadomi Posted November 2, 2022 Posted November 2, 2022 hello all: How can I execute a routine when opening an autocad file? I don't have access to modify files in C : Quote
leonucadomi Posted November 2, 2022 Author Posted November 2, 2022 I mean open an autocad file and that an lsp is executed automatically no need to call routine. Quote
resullins Posted November 2, 2022 Posted November 2, 2022 59 minutes ago, leonucadomi said: I mean open an autocad file and that an lsp is executed automatically no need to call routine. Put it in your acaddoc.lsp file. That file runs automatically when you open a drawing. Quote
Steven P Posted November 2, 2022 Posted November 2, 2022 2 hours ago, leonucadomi said: I don't have access to modify files in C : Would that be a problem though to modify the accaddoc.lsp ? If you can't modify files on the C drive, I am guessing that you have some storage... somewhere.... where you can save files outside of any projects you are working on, you can save a LISP file there and go through the AutoCAD start-up suit in appload to load this file whenever you open a new file. That's the trickiest part! All you need is the file to contain your LISP, and at the end of the file just put the line (c:MyLISP) - and that will run MyLISP when that file has loaded into memory. 2 Quote
leonucadomi Posted November 2, 2022 Author Posted November 2, 2022 it runs perfectly STEVEN P, JUST DON'T KNOW WHY THE AUTOCAD HELP WINDOW OPENS Quote
tombu Posted November 2, 2022 Posted November 2, 2022 18 minutes ago, leonucadomi said: it runs perfectly STEVEN P, JUST DON'T KNOW WHY THE AUTOCAD HELP WINDOW OPENS Need more information, did you put the code in acaddoc.lsp or in the startup suite? Seeing what code you added is the only way to really debug what happened. 1 Quote
leonucadomi Posted November 2, 2022 Author Posted November 2, 2022 of course... (defun c:pur ( /) (command "_purge" "A" "*" "N") (princ) ) (c:pur) it runs perfectly... but only that it opens the autocad help window in each execution Quote
tombu Posted November 2, 2022 Posted November 2, 2022 Pasting your code in my command line executed perfectly! In acaddoc.lsp you would only need the line (command "_purge" "A" "*" "N") Did you put the code in acaddoc.lsp or in the startup suite? 1 Quote
Steven P Posted November 2, 2022 Posted November 2, 2022 helps if you give all the information to start with..... By default the 'last command' in AutoCAD when you open a drawing is Help - try it, open something and press enter - help opens. Do another command and enter will repeat the 'last command', I guess they needed to put something there. Is that snippet all that is in your file? might be something else in there affecting things 2 1 Quote
tombu Posted November 2, 2022 Posted November 2, 2022 6 minutes ago, leonucadomi said: startup suite Never used it but it seems like you added an Enter (carriage return) that's activating help. Edit startup suite and if there's a blank line use Backspace to remove it. 1 Quote
resullins Posted November 2, 2022 Posted November 2, 2022 36 minutes ago, tombu said: Never used it but it seems like you added an Enter (carriage return) that's activating help. Edit startup suite and if there's a blank line use Backspace to remove it. Yes, that's entirely possible. Open a drawing, hit F2, and look at what commands have been run before you do anything else. That should clue you in. 2 Quote
leonucadomi Posted November 2, 2022 Author Posted November 2, 2022 thanks for the help it was exactly that Enter (carriage return). 1 Quote
Dadgad Posted November 3, 2022 Posted November 3, 2022 Late to the party, haven't read the whole thread, but I would just add it to my Startup Suite. 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.