inserting images into dxf/dwg
inserting images into dxf/dwg
hi,
i'd like to insert images into dxf file. i saw examples and i think that did everything like there, but when i open the dxf file in autocad images are't displayed . my code is similar to this:
code:
oddbobjectid imagedictid = oddbrasterimagedef::createimagedictionary(m_pdxfdatabase);
oddbdictionaryptr pimagedict = imagedictid.safeopenobject(oddb::kforwrite);
odstring key = "asdasd";
oddbobjectid imagedefid = pimagedict->getat(key);
if (imagedefid.isnull())
{
odrxmoduleptr pmodule = :

drxdynamiclinker()->loadmodule("rxrasterservices.drx");
odgirasterimageptr prasterimage = ((odrxrasterservicesptr)pmodule)->loadrasterimage(m_imagename);
oddbrasterimagedefptr pimagedef = oddbrasterimagedef::createobject();
imagedefid = pimagedict->setat(key, pimagedef);
pimagedef->setsourcefilename(m_imagename);
pimagedef->setimage(prasterimage);
if(!prasterimage.isnull())
{
nheight = prasterimage->pixelheight();
nwidth = prasterimage->pixelwidth();
}
oddbrastervariablesptr prvars = oddbrastervariables:

penrastervariables(m_pdxfdatabase, oddb::kforwrite);
if (odgirasterimage::knone == prvars->userscale())
{
prvars->setuserscale(odgirasterimage::kmillimeter);
prvars->setimageframe(oddbrastervariables::kimageframeabove);
prvars->setimagequality(oddbrastervariables::kimagequalityhigh);
}
}
oddbrasterimageptr pdbraster = oddbrasterimage::createobject();
blockrecord->appendoddbentity(pdbraster);
pdbraster->setimagedefid(imagedefid);
odgepoint3d pt(ptx, pty, 0.0);
pdbraster->setorientation(pt, odgevector3d(50, 0, 0), odgevector3d(0, 50, 0));
pdbraster->setdisplayopt(oddbrasterimage::kshow, true);
pdbraster->setdisplayopt(oddbrasterimage::kshowunaligned, true);
the image is loaded. its width and height is correct. the image file is placed in the same directory where the dxf file is.
should i do something more ?
thanks
marcin
attached images
you saved absolute path to the image file: "c:\image33.bmp"
autocad fails to find it in this location. if file path is changed to "image33.bmp" it shows the image having found the file in the same folder as dwg.
sergey slezkin