Results 1 to 2 of 2

Thread: Invoke the Colour Index to change a selected object's layer colour

  1. #1
    Join Date
    Brisbane, Queensland, Australia
    Login to Give a bone

    Question Invoke the Colour Index to change a selected object's layer colour


    I have unsuccessfully searched the AutoLISP sub-forum for a routine to help deal with a few received dwg files generated in Archicad. At least I think it's Archicad. All the layers are white, with every object even having a colour override of 'white'. Pure pain.

    My first point of call has been to use setbylayer (changing only colour properties) to rid myself of all object's colour overrides.

    As the layer names in this non-Autodesk dwg file are insanely vague, I would like to be able to change all of the layer's colours to specific colours that will suit my .ctb file. I would like to simply select objects and have the routine invoke the Colour Index Table so I can choose a new colour for the selected object's layer.

    I do not wish to create colour overrides of any object (it's a pet hate). I wish to only change a layer's colour by selecting an object first.

    For example, if I pick on one of the gridlines, the lisp routine will have the Colour Index dialog box come up so I can manually change the gridline layer's colour to, say, 250. Then, by repeating the command and selecting a line that is an outline of a concrete column, I can change the coloumn's layer colour to, say, 100.

    If a lisp routine like this exists, could you please direct me to where it has been posted..

    Thank you.


  2. #2
    All AUGI, all the time
    Join Date
    Login to Give a bone

    Default Re: Invoke the Colour Index to change a selected object's layer colour


    Something like this?
    (defun c:test (/ sel lay int ent lst get)
      (if (and (setq int -1 sel (ssget "_:L" '((0 . "~VIEWPORT"))))
               (setq *clr* (acad_colordlg (if *clr* *clr* 1)))
        (while (setq ent (ssname sel (setq int (1+ int))))
          (or (member (setq lay (cdr (assoc 8 (entget ent)))) lst)
                (setq lst (cons lay lst))
                    (cons 62 *clr*)
                    (assoc 62 (setq get (entget (tblobjname "LAYER" lay))))

Similar Threads

  1. Change all Objects of one colour to another colour
    By tburke in forum AutoCAD General
    Replies: 15
    Last Post: 2016-03-04, 01:53 PM
  2. Replies: 1
    Last Post: 2016-01-31, 03:08 AM
  3. Replies: 4
    Last Post: 2012-08-15, 04:59 PM
  4. change layer colour
    By sight025025875459 in forum AutoLISP
    Replies: 3
    Last Post: 2011-05-20, 07:32 AM
  5. Change layer colour macro
    By Maurice.148748 in forum AutoCAD Customization
    Replies: 35
    Last Post: 2007-12-03, 02:05 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