Share

AcDbObject::audit

C++

Acad::ErrorStatus audit(
    AcDbAuditInfo* pAuditInfo
) override;

Description

This function is called by AutoCAD when the AUDIT command is executed. The AcDbAuditInfo object pointed to by pAuditInfo contains member functions that are used to determine what to do and also to report the results of the audit operation on the object.

When overriding this function for a custom class, if conditions are correct, this function should return Acad::eOk. If there's an internal problem, the object should call the pAuditInfo argument's fixErrors() member. If Adesk::kTrue is returned, and the object can successfully repair itself, it should do so, and return Acad::eFixedAllErrors. If the object cannot successfully repair itself, it should return Acad::eUnrecoverableErrors. If Adesk::kFalse is returned from fixErrors(), and the object has internal errors, it should leave them be, and return Acad::eLeftErrorsUnfixed.

Here is a sample audit function from the ARXLABSLAB09JBLOB.CPP file:

Acad::ErrorStatus
Jblob::audit(AcDbAuditInfo* pAuditInfo)
{
    if (mrblob <= 0.0) {
        pAuditInfo->errorsFound(1);
        if (pAuditInfo->fixErrors() == Adesk::kTrue) {
            char buff[50];
            sprintf(buff, "%f", mrblob);
            pAuditInfo->printError("JBLOB", buff, "> 0.0",
                "0.2 * line length");
            // no way to know what the radius really should be
            // so make it about 0.2 of the line length as a
            // reasonable guess so that it'll at least be visible
            // on screen.
            //
            mrblob = 0.2 * mpblob.distanceTo(mp);
            pAuditInfo->errorsFixed(1);
            return Acad::eFixedAllErrors;
        } else
            return Acad::eLeftErrorsUnfixed;
    } else
        return Acad::eOk;
}

Parameters

Parameters Description
pAuditInfo Input a pointer to an AcDbAuditInfo object

Links

AcDbViewSymbol Class

Was this information helpful?