put_ActiveDocument or get_ActiveDocument bug?

put_ActiveDocument or get_ActiveDocument bug?

daniel_cadext
Advisor Advisor
401 Views
1 Reply
Message 1 of 2

put_ActiveDocument or get_ActiveDocument bug?

daniel_cadext
Advisor
Advisor

should be true right? It's true on alt platforms

 

bool PyAcadApplicationImpl::runTest(const AcDbObjectId& id)
{
    CComQIPtr<IAcadApplication> acad(acedGetIDispatch(TRUE));
    if (acad)
    {
        CComQIPtr<IAcadDocuments> docs;
        if (auto hr = acad->get_Documents(&docs); hr != S_OK)
            return false;

        VARIANT vtempty;
        VariantInit(&vtempty);
        CComQIPtr<IAcadDocument> doc1;
        if (auto hr = docs->Add(vtempty, &doc1); hr != S_OK)
            return false;

        CComQIPtr<IAcadDocument> doc2;
        if (auto hr = docs->Add(vtempty, &doc2); hr != S_OK)
            return false;

        if (auto hr = acad->put_ActiveDocument(doc2); hr != S_OK)
            return false;

        CComQIPtr<IAcadDocument> doc3;
        if (auto hr = acad->get_ActiveDocument(&doc3); hr != S_OK)
            return false;

        acutPrintf(_T("\nDocs are equal %ls"), doc2 == doc3 ? _T("TRUE") : _T("FALSE"));
    }
    return true;
}

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Accepted solutions (1)
402 Views
1 Reply
Reply (1)
Message 2 of 2

daniel_cadext
Advisor
Advisor
Accepted solution

never mind, works in ACRX_CMD_SESSION

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