Jump to content

Recommended Posts

Posted

Hi all, is it possible to changed the xref colors based on the filename prefix?

AR for archi set to 10, ME for mech color 15 etc...

Posted (edited)

No you have to open xref and change it there. Or bind it to the drawing thus defeating the xref.

If things are set to bylayer in the xref its possible.

Edited by mhupp
Posted (edited)

Test this out see if the commented entmod works. comment out the command line below to test.

 

This first lists all xref layers. then checks them for AH or ME in their name.

 

(defun C:color-xref (/ lay name match c)
  (vl-load-com)
  (vlax-for lay (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
    (if (wcmatch (setq name (vla-get-name lay)) "*|*")
      (setq match (cons name match))
    )
  )
  (setvar 'cmdecho 0)
  (foreach lay match
    (cond
      ((wcmatch lay "*AH*|*")
        (setq ent (entget (tblobjname "layer" lay)))
        (entmod (subst (cons 62 10) (assoc 62 ent) ent))
      )
      ((wcmatch lay "*ME*|*")
        (setq ent (entget (tblobjname "layer" lay)))
        (entmod (subst (cons 62 15) (assoc 62 ent) ent))
      )
    )
  )
  (setvar 'cmdecho 1)
  (princ)
)

 

Edited by mhupp
  • Like 2
Posted

thanks a lot. tried this and it's working flawlessly.

I will just need to add more xref names and colors inside the cond

 

 

Posted

mhupp ok for Bricscad

 

(setq lay "DEFAULT")
(setq ent (entget (tblobjname "layer" lay)))
(entmod (subst (cons 62 30) (assoc 62 ent) ent))

 

  • Like 2

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