Jump to content

run routine when opening file in autocad...


leonucadomi

Recommended Posts

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. 

 

image.thumb.png.8d485b5c371398b5f1c5a9312fcb267d.png

Link to comment
Share on other sites

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.

  • Like 2
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

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

 

 

  • Like 2
  • Agree 1
Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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. 

 

  • Like 2
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...