![]() |
【转帖】color conversion problem dd 1.14.01
color conversion problem dd 1.14.01
color conversion problem dd 1.14.01 hi i'm using dwgdirect libraries 1.14.01 in my application. when i write a dwg/dxf file containing entities with different colours (set using oddbentity::setcolour), it seems all ok, and intellicad reads all the entities, each with its colour. but when i try to read this file with my application, i get back for all the entities the same colour of the first entity found in the database. when i was using dd 1.13 in my application (that hasn't been changed) this problem didn't happen. is it a bug of dd 1.14.01? thanks in advance could you post a sample file and a piece of your code extracting the color of entities? sergey slezkin samples for color conversion attached you'll find the sample code and the colors.dwg file written using the writeentity function. when reading the file i use the getentitycolor, that returns the same color for all the lines of the drawing. thanks attached files (4.8 kb, 10 views) i would try to set unsigned char red = 255; unsigned char green = 0; unsigned char blue = 0; since intellicad displays your file with correct colors the problem is not in your writing code but in your reading code. so i asked for code sample which gets color from entity. btw, odamfcapp sample displays your entities with different colors. sergey slezkin when i read colors.dwg i have same problem. some color line are read like "isbyaci()" with colorindex=9 (same layer's number?!?) and some like "isbycolor()" but when i extract rgb obtain r,g,b=192,192,192. can the problem to be linked at the file's version (ac1015)? i tried with unsigned char, but nothing changed. i recovered a backup of my application that used dd version 13 and i wrote the same file with both the old (colors_ver_13.dwg using dd version 13) and the new (colors_ver_14.dwg using dd version 14) application. when i read the colors_version_13.dwg file, my getentitycolor function (whose sample code was reported in sample.zip in the previous post) returns the correct colors. note: my getentitycolor function'code hasn't been changed. i opened both files with odamfcapp, and i noticed that in colors_ver_14.dwg, starting from the second acdbline, a hardpointer 70:acdbcolor appears that neither in the first acdbline in colors_ver_14.dwg, nor in all the acdblines in colors_ver_13.dwg appears. best regards attached files (8.3 kb, 5 views) can you try to export in dwg format 2005 (ac1015) ? i think in this format read/write is ok. i think there is a problem when we read file older than 2005 and they are create with: color.setcolormethod(odcmentitycolor::kbycolor); color.setrgb(red, green, blue); oddblineptr->setcolor(color); as you already pointed out the problem is with round-tripping rgb colors in pre-ac2004 file versions. this is dd bug. sorry. sergey slezkin as i know that the problem isn't me, i feel better!!! now i only have to anxiously wait for the bug fix. many thanks to everybody!! 1.14.02 also hi, i have just updated to the new dd version and i'm also not able to read correctly the color (rgb) of entities in r13, r14, 2000 while it works correctly in r12 and 2004. the problem seems with the dd reader, since the colors of the files read with autocad are correct. is the issue be corrected soon? the fix will be available in next release/update which is scheduled yet. sergey slezkin |
所有的时间均为北京时间。 现在的时间是 01:42 PM. |