Author Topic: True Color in Layer Creator  (Read 1517 times)

0 Members and 1 Guest are viewing this topic.

ArchD

  • Guest
True Color in Layer Creator
« on: March 28, 2018, 04:48:32 PM »
I'm using Tim Spangler's Layer Creator and was wondering if there is a way to create a layer with true color instead of 1-255? The readme says that it must be an integer, but was hoping that maybe there was an update or work around. If anyone can help, I would greatly appreciate it.

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: True Color in Layer Creator
« Reply #1 on: March 28, 2018, 05:55:45 PM »
Here's an example demonstrating how to create a layer with a True Colour from supplied RGB values:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:truecolourlayer ( )
  2.     (entmake
  3.         (list
  4.            '(000 . "LAYER")
  5.            '(100 . "AcDbSymbolTableRecord")
  6.            '(100 . "AcDbLayerTableRecord")
  7.            '(070 . 0)
  8.            '(002 . "My True Colour Layer")
  9.             (cons 420 (LM:RGB->True 188 97 78))
  10.         )
  11.     )
  12.     (princ)
  13. )
  14.  
  15. ;; RGB -> True  -  Lee Mac
  16. ;; Args: r,g,b - [int] Red, Green, Blue values
  17.  
  18. (defun LM:RGB->True ( r g b )
  19.     (logior (lsh (fix r) 16) (lsh (fix g) 8) (fix b))
  20. )
  21.  

Though I doubt it'll be a simple modification to Tim's program to implement this, and unfortunately I don't have the time to review several thousand lines of code.  :uglystupid2: