Share

AcDbObject::subOpen

C++

virtual ACDBCORE2D_PORT Acad::ErrorStatus subOpen(
    AcDb::OpenMode mode
);

Description

Called whenever the object is about to be opened, but before it has actually been opened. The default implementation is to return Acad::eOk. However, when overridden in custom classes, it provides a hook into the open operation. If it returns anything other than Acad::eOk, then the open operation is immediately terminated.

When overriding this function, a sequence of steps is required:

  1. Check to be sure everything is correct with the AcDbObject's state. If not, then immediately return a value other than Acad::eOk, which terminates the open operation.
  2. Call the parent class's subOpen(). If this returns Acad::eOk, then continue; otherwise immediately return whatever the parent class's subOpen() returned.
  3. Do any operations desired before the open operation continues.
  4. Return Acad::eOk to allow the open operation to continue normally.
Note

When implementing your own subOpen(), it is best not to change any of the object's state at all. But, if you must, then it is best to make such changes after invoking the parent class's subOpen(), just in case it returns an error code other than Acad::eOk. If you must change state before invoking the parent class's subOpen(), then be prepared to reverse the changes if the parent class returns a status other than Acad::eOk.

Parameters

Parameters Description
mode Passed in mode that the object is being opened in

Links

AcDbObject

Was this information helpful?