Selecting entites by R,G,B colour wit use of scrpit

I need to select entity by colour. I am using this typ of command:

(sssetfirst nil (ssget "_X" (list (cons 62 5)))), -where 5 is index colour number,

but I have some objects in drawing with RGB:250,200,120

My question is how can I change this command to select this colour?

I don't want to use quick select function but only command line.

Comments

  • Wiebe van der Worp
    edited November 2018

    (ssget "_X" '((420 . 6579300)))
    Selects RGB value 100,100,100

    How do you get the integer for true colour?
    With RGB values ranging in 8 bits, 2^8, from 0 up to 255, the following is true:
    RGB = (2 ^ 8) ^ 2 * R + (2 ^ 8) ^ 1 * G + (2 ^ 8) ^ 0 * B
    or
    RGB = 65536 * R + 256 * G + B

    So your 24 bit value is 65536 * 250 + 256 * 200 + 120 = 16435320

This discussion has been closed.