Jump to content

Recommended Posts

Posted

Hello, I'm looking for a simple colour change for multiple objects. This is sort of what I want to do, I just do not have an understanding of the lisp language.

 

If Colour = X then change to Y

 

X and Y both being defined values.

 

Thanks,

Posted

You can always use QSELECT, fiter objects by color value... => Objects are selected and from drop down menu of colors change color to selected objects, or when selected press ctrl+1 (properties) and from property pallete change to desired color...

 

M.R.

Posted
Hello, I'm looking for a simple colour change for multiple objects. This is sort of what I want to do, I just do not have an understanding of the lisp language.

 

If Colour = X then change to Y

 

X and Y both being defined values.

 

Color of what? Layers, objects or maybe in plot styles? And what do you mean by 'colors are defined values'? Where?

Posted

I want to be able to define X and Y, its for multiple objects, no plots styles only lines/points/wireframes.

Posted

For fun...

 

(defun c:CREP () (c:ColorReplace))
(defun c:ColorReplace  (/ *error*)
 (vl-load-com)
 (princ "\rCOLORREPLACE ")

 (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 / color ss)
    
    (vla-startundomark acDoc)
    
    (if (= "BYLAYER" (setq color (getvar 'cecolor)))
      (setq color 1)
      (setq color (atoi color)))

    (if (and (princ "\nSelect color to be replaced: ")
               (setq color (acad_colordlg color nil))
               (setq ss (ssget "_:L" (list (cons 62 color))))
               (princ "\nSelect replacement color: ")
               (setq color (acad_colordlg color nil)))
      
        (progn
          (vlax-for x (setq ss (vla-get-activeselectionset acDoc))
            (vl-catch-all-apply 'vla-put-color (list x color)))
          (vla-delete ss)
          (*error* nil))
      
        (cond (ss (*error* "Replacement color not specified"))
              ((*error* "Nothing selected"))))
    
   (vla-get-activedocument (vlax-get-acad-object))))

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