Jump to content

Lisp for Run/Execute the custom Command aautomatically


acad1985

Recommended Posts

Hi Everyone,

I have a Lisp file to Turnoff unwanted Layers.

I want to run this lisp automatically, when i open the Drawing file.

Actually in my office i don't have a access for C Drive, so that i can't add this into acaddoc.lsp.

 

Please anyone help me out to do this.

 

 

(defun c:unoff (/ layers)
 (command "._-layer" "_f" "*Electric*" "")
(command "._-layer" "_off" "*Electric*" "")
 (princ)
)

 

 

Thanks in advance

Link to comment
Share on other sites

Create an acaddoc.lsp file in the same directory as your drawings with the following content:

(defun c:unoff nil
   (command "_.-layer" "_f" "*Electric*" "_off" "*Electric*" "")
   (princ)
)
(if (= 'list (type s::startup))
   (setq s::startup (append s::startup '((c:unoff))))
   (defun-q s::startup nil (c:unoff))
)
(princ)

Link to comment
Share on other sites

Hello Lee,

Thank you so much for your code.

Its working Perfectly.

But in my case, i have saved the drawing file to different folders/Path, so can i save this lisp file to one common folder and run from that folder?

Or else we need to place create all the Drawing Directory?

Please let me Know.

 

 

Thanks

Link to comment
Share on other sites

If you can't access the content of existing support paths as you seem to imply from your first post, add a new trusted support path to your AutoCAD environment and save it there.

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