Results 1 to 7 of 7

Thread: Change Layer Color of selected layer in a Block or Xref

  1. #1
    I could stop if I wanted to
    Join Date
    2001-11
    Posts
    236
    Login to Give a bone
    0

    Default Change Layer Color of selected layer in a Block or Xref

    Currently I can use the Express Tool to freeze a layer in a block or an xref with the command "LAYFRZ". I was would like to be able to change the color of a selected layer in a block or xref to a specified color. I would like an automation since I always change some layers in an xref to color 59. Instead of checking what layer name it is by opening the layer or using the Express Tool function "LIST XREF / BLOCK PROPERTIRES", I would like to just pick the layer and have it change it's color to color 59 (or any color I chose to save with the lisp routine).

    Would someone have a lisp that might be able to do this. I have been searching on the web on such lisp, but keep finding similar.
    Thanks

    I am using AutoCAD 2006 & Windows XP SP2

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Exclamation Re: Change Layer Color of selected layer in a Block or Xref

    The Layer Properties command in ToolPac can do it. I use this all the time.
    Attached Images Attached Images
    R.K. McSwain | CAD Panacea |

  3. #3
    I could stop if I wanted to
    Join Date
    2001-11
    Posts
    236
    Login to Give a bone
    0

    Default Re: Change Layer Color of selected layer in a Block or Xref

    Could someone please tell me where the function LAYFRZ lisp is located? It is an Express Tools function. Is this embedded into another grouped lisp? Thanks.

  4. #4
    I could stop if I wanted to
    Join Date
    2001-10
    Location
    Defragging the internets.
    Posts
    350
    Login to Give a bone
    0

    Default Re: Change Layer Color of selected layer in a Block or Xref

    It is now part of acad and the toolbar is called "Layers II". It will be a little hard to get used to because autodesk decided to change the icons.


    Chris
    Last edited by framedNlv; 2007-05-30 at 05:29 PM.

  5. #5
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Change Layer Color of selected layer in a Block or Xref

    Code:
    (defun c:ChangeLayerColor (/ Sel EntList DataList cnt Num ClrNum EntData)
    
    (if (setq Sel (nentsel "\n Select object to change layers color: "))
     (progn
      (if (> (length Sel) 2)
       (setq EntList (cons (car Sel) (last Sel)))
       (setq EntList (cons (car Sel) EntList))
      )
      (setq DataList
       (mapcar
        '(lambda (x / EntData)
         (setq EntData (entget x))
         (cons (cdr (assoc 0 EntData)) (cdr (assoc 8 EntData)))
        )
        EntList
       )
      )
      (setq cnt 0)
      (textscr)
      (prompt "\n Select number of layer to change color: ")
      (foreach lst DataList
       (prompt (strcat "\n " (itoa cnt) " - " (cdr lst) " - Object [ " (car lst) " ]"))
       (setq cnt (1+ cnt))
      )
      (while
       (and
        (not (setq Num (getint (strcat "\n Select number between 0 - " (itoa (1- cnt)) ": "))))
        (not (< 0 Num (1- cnt)))
       )
      )
      (graphscr)
      (if (and Num (setq ClrNum (acad_colordlg 0)))
       (progn
        (setq EntData (entget (tblobjname "Layer" (cdr (nth Num DataList)))))
        (entmod
         (subst
          (cons 62 ClrNum)
          (assoc 62 EntData)
          EntData
         )
        )
        (command "_.Regen")
       )
      )
     )
    )
    (princ)
    )

  6. #6
    I could stop if I wanted to
    Join Date
    2001-11
    Posts
    236
    Login to Give a bone
    0

    Thumbs up Re: Change Layer Color of selected layer in a Block or Xref

    Thank You!
    Thank You!
    Thank You!

  7. #7
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Change Layer Color of selected layer in a Block or Xref

    Quote Originally Posted by omorah
    Thank You!
    Thank You!
    Thank You!
    You're welcome.

Similar Threads

  1. Replies: 4
    Last Post: 2015-02-16, 07:53 PM
  2. Change XREF layer color
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 6
    Last Post: 2013-02-08, 09:11 AM
  3. Xref layer color change
    By jsnow in forum AutoCAD General
    Replies: 8
    Last Post: 2009-03-05, 10:16 AM
  4. Replies: 8
    Last Post: 2006-01-13, 06:55 PM
  5. Is it possible to change the layer color of an Xref file?
    By jeff.garr in forum AutoCAD General
    Replies: 3
    Last Post: 2005-11-14, 05:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •