高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】cannot open a dwg file in autocad - random problem
cannot open a dwg file in autocad - random problem
cannot open a dwg file in autocad - random problem
hi,
i often encounter the following error when opening a file generated by dd in autocad :
fatal error: unhandled access violation reading 0x002c exception at 2ch.
the bug happens randomly, undepending of the entities written in the file.
in the same time, i have no problem opening those files with dd. i use an old version of the dd because of the color problem, but it seems to also have happened with the new version (1.14.02).
it would be kind if you could like at the bogus file generated, which contains only one line.
thanks,
mst
attached files
almost all layers in your drawing (except layer 0) have bylayer color which is invalid for layer table record.
this causes autocad crash. autocad 2000 recover fixes this problem.
dwgdirect recover fixes it too.
sergey slezkin
thanks for your answer but i'm still not able to fix it because the problem still seems coming from dd. below the code which is used to set layers' color :
playtblrec = oddblayertablerecord::createobject();
layername = transstr.c_str();
playtblrec->setname(layername);
dvppix::color* pcolor = (*levelitr).getcolor();
static bool test = false;
if(pcolor && test)
{
odcmcolor color;
int rgbcolor[3];
pcolor->getcolor(rgbcolor, 255);
color.setrgb((oduint8)rgbcolor[0],
(oduint8)rgbcolor[1],
(oduint8)rgbcolor[2]);
}
else
{
color.setcolorindex(0);
}
playtblrec->setcolor(color);
i've added a boolean variable "test" for testing two different color setting code snippets. if test is set to "truth", all the layers' color use the rgb function (pcolor is never 0). in that case, the generated file is corrupted (autocad2000 cannot open it.) even if i try to recover it, autocad2000 sends an error message saying the recovered drawing is not valid.
if a set "test" to false, autocad2000 has no problem opening the generated file.
in any case, dd is able to open the generated files.
thanks,
mst
attached files (21.6 kb, 3 views)
(21.6 kb, 2 views)
which dd version do you use? dd recover (at least in 1.14) fixes the problem.
sergey slezkin
i'm using version 1.12.01. i had to roll back because of the color problem with the newest version.
when you wrote that dd recover (1.14) fixes this problem, you meant that it fixes it during the writing process, so i would have no problem opening the generated file in autocad2000 with this version?
if so, do you think setting the color index to 0 (as in my code snippet) for any layer would effectively patch the problem?
thanks,
mst
dd fixes the problem if you load the file with recoverfile() or call audit().
setrgb() sets color method to kbycolor and in your files color method is kbylayer.
i can't imagine how you created such file. it should work in early versions too.
sergey slezkin
i found the problem and it wasn't in dd.
thanks for your help!
|