odcmcolor::getdictionarykey()
odcmcolor::getdictionarykey()
i had assumed that the odcmcolor.getdictionarykey() function was to be used in conjuncture with the oddbdatabase::getcolordictionaryid() for adding/referencing colors to/in the dictionary. however, when i initialize a odcmcolor object with aci:
code:
odcmcolor col;
col.setcolormethod(odcmentitycolor::kbyaci);
col.setcolorindex(odcmentitycolor::kacired);
odstring sname = col.colorname();
odstring sdisplayname = col.colornamefordisplay();
odstring skey = col.getdictionarykey();
...
i am getting the following results:
sname is ""
sdisplayname is "red"
skey is "unnamed$"
the question being, is this the expected result?
1. what constitutes a named color? text in the display name?
2. why does any color with an empty name get a dictionary key of "unnamed$", whereas specifying a name "customname" in the color manually yields "unnamed$customname"?
3. should i just ignore the dictionary key result and specify my own custom keys?
4. am i missing the intention?
thanks,
elliott edwards
yes, it is expected result.
1. named color are used to store information about colors in "color books" (was introduced in autocad 2004). color books are just a method for naming definite colors somehow. method odcmcolor::setnames() lets set up
a) color name inside book
b) color book name.
2. dictionary key is composed this manner: "color book name"$"color name". by default color book name is "unnamed" and color name is empty.
odcmcolor::colornamefordisplay() returns string that should be displayed in editor (e.g. displayed in autocad, in color combo box). if color name is not empty, it returns color name. else it returns "bylayer" and "byblock" for bylayer and byblock colors, "r,g,b" for rgb colors, 7 strings ("red", "yellow", etc) for 7 main color indices, and just index in remaining case.
3. no, you shouldn't. odcmcolor::getdictionarykey() works just like acad.
4. probably yes, but i hope my reply will help

sincerely yours,
george udov
book names.
ah. the book names were the missing piece in the generation of the key for me then. you were right i was missing the intention.
thanks,
elliott edwards