Jump to content

Lisp to Run a command Automatically when opened the file


acad1985

Recommended Posts

(defun PurgeMe ()
 (if (= (length (vl-remove-if '(lambda(x)(or (< x 48)(> x 57)))
                  (vl-string->list (vl-filename-base (getvar 'DWGNAME))))) 7)
   (progn
     ; purge everything
     (vla-purgeall (vla-get-activedocument (vlax-get-acad-object)))
     ; maybe do a zoom extents
     (vla-ZoomExtents (vlax-get-acad-object))
     ; save drawing
     (command ".qsave")
   )
 )
 (princ)
)

;; Auto-run on start up of drawing names that their names are consist of digits only.
(PurgeMe)

Link to comment
Share on other sites

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • acad1985

    7

  • rlx

    6

  • Tharwat

    5

  • BIGAL

    2

Top Posters In This Topic

Excellent Rlx. You saved me.

Thank you so much for your code.. this is working as what i want.

 

Thank you so much all of you for your effort on this.:D

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