Share

AcDbObject::assertWriteEnabled

C++

void assertWriteEnabled(
    Adesk::Boolean autoUndo = true, 
    Adesk::Boolean recordModified = true
);

Description

This function is used only inside of member functions of classes derived from AcDbObject. It should only be used inside of member functions that modify the object's data (for example, dxfInFields()). When used, it should be the first function called inside the member function. Its purpose is to make sure that the object is indeed open for write (if it is not, then AutoCAD terminates); to trigger an immediate sending of "openedForModify" notification; to set up the notification mechanism so that "modified" and "modifiedGraphics" (if the object is derived from AcDbEntity) are sent at the appropriate times; and to ensure that graphics get updated if the object is derived from AcDbEntity.

If this function is called on a database resident object, "openedForModify" will be sent if the object is not newly created, and "modified", and "modifiedGraphics" (if appropriate) notifications will be sent when the object is next closed.

If recordModified is false, then the autoUndo argument is ignored, and the undo filer is not initialized, no undo recording will take place, but notifications will be sent.

If autoUndo and recordModified are both true, then automatic undo recording will be performed and notifications will be sent.

If autoUndo is false and recordModified is true, then there will not be any automatic undo recording, but the undo filer is initialized and the object must manually write out partial Undo records and must implement its applyPartialUndo() method. Notifications will be sent.

If this function is called while the object is not open AcDb::kForWrite, AutoCAD terminates (allowing the user to save changes).

Parameters

Parameters Description
autoUndo Input Boolean indicating if automatic undo recording should be done or not
recordModified Input Boolean indicating if automatic undo recording should be done or not

Links

AcDbObject

Was this information helpful?