[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Change Entity Colors
Tip# 3645 By Tommy Shumpert On 15-May-2011
Rated By 4 users Downloaded : 947
Categories : Object Properties, LISP Code Modules
Software type : AutoCAD 2012
Rename File To : okc.lsp
Use numbered functions that correspond to colors.

Tommy Shumpert shares a unique routine with us that defines functions for the numbers 1–255 for the purpose of changing the color of selected entities. Since this LISP code creates other functions, you should include it in your startup file named acaddoc.LSP. Once you do, these numbered functions are ready to go. To use these functions, enter a color number at the Command prompt and press Enter. For example, let's say you enter 5 at the Command prompt and select some entities; their color will be changed to blue. The same holds true for any color number from 1 to 255.    


Average Rating:

User comments
Comment by Anderson,Jim
Posted on 2011-05-17 04:29:43
Very clever routine, apart from encouraging bad practice (changing properties by object rather than by layer)!
Comment by ,
Posted on 2011-05-17 11:11:32
What would make this even better is if you could assign a number to make the object bylayer and byblock, other than that a nice routine
Comment by Cooper,Kent
Posted on 2012-09-13 15:51:37
I just ran across this. Attached is an altered version that does what comment 2 requested. 0 = ByBlock, 256 = ByLayer.
Comment by Cooper,Kent
Posted on 2013-09-17 11:23:06
And here's an enhanced version: each command that it defines now prompts indicating the color (including the text name for those that have them), forbids selection of objects on locked Layers, proceeds only with valid selection, suppresses command echoing, and reports how many objects it assigned the color to.
Comment by Cooper,Kent
Posted on 2014-05-19 13:28:02
See the further-developed version of ColorCommandNames.lsp now in its own Tip #4311, "Color Command Names"