几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】oddbrasterimagedefsetsourcefilename not working (http://www.dimcax.com/hust/showthread.php?t=17596)

yang686526 2009-05-06 08:07 PM

【转帖】oddbrasterimagedefsetsourcefilename not working
 
oddbrasterimagedef::setsourcefilename not working?
oddbrasterimagedef::setsourcefilename not working?
hi,
i load database from file and then:
code:
oddbdictionaryptr pimgdict = imagedictid.openobject(oddb::kforwrite);
oddbdictionaryiteratorptr piter = pimgdict->newiterator();
while (!piter->done())
{
oddbrasterimagedefptr pimgdef = piter->objectid().safeopenobject(oddb::kforwrite);
pimgdef->setsourcefilename("aaa");
odstring strtest = pimgdef->sourcefilename();
piter->next();
}
strtest is "aaa" but when i save the database to a file image path is not changed. what should i do to make paths change?
i've tried
code:
pimgdef->upgradeopen();
pimgdef->setsourcefilename("aaa");
odstring strtest = pimgdef->sourcefilename();
pimgdef->downgradeopen();
and
code:
pimgdef->setsourcefilename("aaa");
odstring strtest = pimgdef->sourcefilename();
pimgdef->load();
but still images paths in drawing file do not change.
tia
regards,
micha? ?liwka
i can't reproduce it in odamfcapp.
your code works.
are you sure you save the database to the same file and the save realy happens? was file time stamp updated?
sergey slezkin
i save database to other file. timestamp is new.
this is the code i tried in odamfcapp 2.2
code:
oddbdictionaryptr pimgdict = oddbrasterimagedef::imagedictionary(pdb).openobject(oddb::kforwrite);
oddbdictionaryiteratorptr piter = pimgdict->newiterator();
while (!piter->done())
{
oddbrasterimagedefptr pimgdef = piter->objectid().safeopenobject(oddb::kforwrite);
pimgdef->setsourcefilename("aaa");
odstring strtest = pimgdef->sourcefilename();
piter->next();
}
return;
(only the first line of your code was changed)
which dd version do you use?
sergey slezkin
oh, i'm sorry, i didn't say that i'm using 1.14.02.
i'm sorry, i'm using 2.2 in this app


所有的时间均为北京时间。 现在的时间是 01:11 AM.