Announcements
Autodesk Community will be read-only between April 26 and April 27 as we complete essential maintenance. We will remove this banner once completed. Thanks for your understanding

AcDbRasterImageDef 2025 bug?

daniel_cadext
Advisor

AcDbRasterImageDef 2025 bug?

daniel_cadext
Advisor
Advisor

Or has something changed?

 

 

static void ArxTemplate_doit(void)
{
    constexpr const wchar_t* itemName = L"MY_IMAGE_NAME";

    AcDbDatabase* pDb = acdbHostApplicationServices()->workingDatabase();

    AcDbObjectId imageDictId = AcDbRasterImageDef::imageDictionary(pDb);
    if (imageDictId.isNull())
    {
        if (auto es = AcDbRasterImageDef::createImageDictionary(pDb, imageDictId); es != eOk)
            acutPrintf(acadErrorStatusText(es));
    }

    AcDbObjectPointer<AcDbRasterImageDef>imageDef;
    if(auto es = imageDef.create(); es != eOk)
        acutPrintf(acadErrorStatusText(es));

    if (auto es = imageDef->setSourceFileName(L"C:\\Users\\Dan\\Pictures\\vb.jpg"); es != eOk)
        acutPrintf(acadErrorStatusText(es));

    if (auto es = imageDef->load(); es != eOk)
        acutPrintf(acadErrorStatusText(es));

    AcDbDictionaryPointer imageDict(imageDictId, AcDb::OpenMode::kForWrite);
    if (auto es = imageDict.openStatus(); es != eOk)
        acutPrintf(acadErrorStatusText(es));

    AcDbObjectId imageDefId;
    if (auto es = imageDict->setAt(itemName, imageDef, imageDefId); es != eOk)
        acutPrintf(acadErrorStatusText(es));

}

 

 

eNoClassId

 

~Dan

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Reply
Accepted solutions (1)
460 Views
3 Replies
Replies (3)

daniel_cadext
Advisor
Advisor

oops

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes

daniel_cadext
Advisor
Advisor

oops

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes

daniel_cadext
Advisor
Advisor
Accepted solution

i just needed to load the dbx

 auto acismobj = std::format(_T("acismobj{}.dbx"), acdbHostApplicationServices()->releaseMajorVersion());
 if (auto result = acrxLoadModule(acismobj.c_str(), false, false); !result)
     acutPrintf(_T("Faled to load %ls: "), acismobj);
Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes