Share

AcDbLayerStateManager::restoreLayerState

C++

Acad::ErrorStatus restoreLayerState(
    const ACHAR * sName, 
    const AcDbObjectId& idVp, 
    int nRestoreFlags = 0, 
    const LayerStateMask* pClientMask = NULL
);

Description

Restores the layer state sName and the VPLAYER settings for the viewport specified. Also restores attributes specified in pClientMask.

nUndefOff may be used to turn off or freeze undefined layers in the layer state. It can be set to one of the following values:

Name Value Description
kUndefDoNothing 0 Take no action.
kUndefTurnOff 1 Turn layers off.
kUndefFreeze 2 Freeze layers.

A wide range of return values is possible, as described in the following table:

Return Value Description
Acad::eOk Successful restore.
Acad::eUndefinedLineType A linetype not in the database was found in the layer state (warning).
Acad::eBadPlotStyleName A plotstyle not in the database was found in the layer state (warning).
Acad::eInvalidLayer The restore attempted to updated current layer's frozen state (warning).
Acad::eNotInitializedYet The database or transaction manager is null.
Acad::eKeyNotFound The passed-in layer state name is not found in the layer state dictionary.
Acad::eInvalidInput The viewport data is not available.

Other possible Acad::ErrorStatus values unequal to Acad::eOk can come from internal calls to:

  • AcDbDatabase::getSymbolTable() while getting the layer table
  • AcDbLayerTable::getAt() while opening an existing layer for read
  • acdbGetObjectId() while getting a layer's object ID
  • acdbOpenObject() while opening an existing layer for read
  • AcDbLayerTableRecord::setIsFrozen() while setting or resetting the frozen state of a layer
  • AcDbLayerTableRecord::setIsPlottable() while setting or resetting the plottable state of a layer
  • AcDbLayerTableRecord::setLineWeight() while setting a layer's lineweight

Parameters

Parameters Description
sName Input name of layer state to make current
idVp Input object ID of the viewport whose VPLAYER setting is to be updated with the viewport data stored
nRestoreFlags Input value that indicates whether to handle undefined layers
pClientMask Input layer attribute mask

Links

AcDbLayerStateManager

Was this information helpful?