Jump to content

Clear Button


tigger29900

Recommended Posts

Hi i was looking to create a button that sets all the unlocked layers in my drawing back to color 7 I've been trying to get it but no luck any help would be appreciated

Link to comment
Share on other sites

Since you posted in .NET, ObjectARX & VBA, I just want to verify that you do not want to use lisp/vlisp.

What is your preference?

Have you started writing any code yet towards this effort?

Link to comment
Share on other sites

I am not adept at coding VBA, but here is a LISP that should do what you need:

 

(defun c:FOO  (/ *error*)
 (vl-load-com)

 (defun *error*  (msg)
   (if acDoc
     (vla-endundomark acDoc))
   (cond ((not msg))                                                   ; Normal exit
         ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
         ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
   (princ))

 ((lambda (acDoc)
    (vla-startundomark acDoc)
    (vlax-for oLayer  (vla-get-layers acDoc)
      (if (= :vlax-false (vla-get-lock oLayer))
        (vla-put-color oLayer acWhite)))
    (*error* nil))
   (vla-get-activedocument (vlax-get-acad-object))))

Hope this helps! :beer:

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