Jump to content

LISP Routine to change colour of all selected objects (except blocks)...?


lamensterms

Recommended Posts

Hey guys,

 

Just wondering if anyone could please advise me if they're aware of such a routine?

 

I am looking for a tool to change the colours of all selected objects. I am currently using routines such as:

 

(defun c:c2 () (ssget) (command "chprop" "p" "" "c" "2" "")(princ))

 

Which will easily change the colours of lines, plines, arcs, circles, text, etc. But I would also like to include objects which do not have such basic colour properties. For example, I would like to be able to change the text, dimension and extension line colours in the same routine as I would change a line colour.

 

Does anyone know of a routine capable of such a task?

 

I have just started writing some code to achieve this, but thought I would ask if anyone knows of an existing routine first.

 

Thanks a lot for any help.

Link to comment
Share on other sites

Hi ,

 

The title of your thread is different than the content of it !.

 

Anyway try this to change the color of the Aligned & rotated dimensions .

 

(defun c:test (/ ss)
 (if (and (setq *clr* (acad_colordlg
                        (cond (*clr*)
                              (t (setq *clr* 256))
                        )
                      )
          )
          (princ "\n Select Dimension to change their color :")
          (setq ss (ssget "_:L" '((0 . "*DIMENSION"))))
     )
   ((lambda (x / sn)
      (while (setq sn (ssname ss (setq x (1+ x))))
        (if (vl-remove-if-not
              '(lambda (o) (and (eq (car o) 100) (wcmatch (cdr o) "AcDbAlignedDimension,AcDbRotatedDimension")))
              (entget sn)
            )
          (mapcar '(lambda (e)
                     (vla-put-textcolor e *clr*)
                     (vla-put-extensionlinecolor e *clr*)
                     (vla-put-DimensionLineColor e *clr*)
                   )
                  (list (vlax-ename->vla-object sn))
          )
        )
      )
    )
     -1
   )
 )
 (princ)
)
(vl-load-com)

Link to comment
Share on other sites

Thanks for the reply Tharwat,

 

I look forward to testing your routine when I get to work tomorrow. Sorry about the threat title. I would like to be able to create a routine to change colours of all objects, but dimensions are the priority at the moment.

Link to comment
Share on other sites

For dimensions I would recommend to override the color of elements only if is already overridden; other adjust it by associated style.

Link to comment
Share on other sites

Thanks for the reply Tharwat,

 

I look forward to testing your routine when I get to work tomorrow. Sorry about the threat title. I would like to be able to create a routine to change colours of all objects, but dimensions are the priority at the moment.

 

You're welcome and hope it would suit your needs .

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