Share

AcDbLayerStateManager::importLayerState

C++

Acad::ErrorStatus importLayerState(
    const ACHAR * sFilename
);

Description

importLayerState() reads the passed-in filename (saved by a previous export) and extracts layer states to import. If an import file layer state has the same name as a layer state already existing in the drawing, the imported layer state is ignored. If an import file layer state name is not found in the drawing, it is created in the drawing. If any newly-created layer states refer to layers which are nonexistent in the drawing, the layers are created using default settings.

Return Value Description
Acad::eOk Successful import
Acad::eUndefinedLineType A linetype not in the database was found in the import file (warning)
Acad::eBadPlotStyleName A plotstyle not in the database was found in the import file (warning)
Acad::eInvalidDxfCode The file header was not formed correctly
Acad::eInvalidDxfSectionName The layer state header was not formed correctly
Acad::eNotInitializedYet The database, transaction manager, or layer table is Null
Acad::eKeyNotFound The object ID of the layer state dictionary is Null
Acad::eNullObjectId The layer state dictionary ID is Null
Acad::eNoFileName The passed-in filename is Null or zero bytes
Acad::eCantOpenFile The passed-in filename cannot be opened for reading
Acad::eEndOfFile Information (a DXF-type data pair) was expected to be read from the file but was not available
Acad::eOutOfMemory Returned if a transaction cannot be created, if the Xrecord for a new layer state cannot be created, or if a new layer table record cannot be created when creating missing layers

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

  • AcDbDatabase::getSymbolTable() while getting the layer table
  • AcDbDictionary::setAt() while setting the new state in the extension dictionary
  • acdbOpenObject() while opening the layer states dictionary

Parameters

Parameters Description
sFilename Input file to extract layer states from

Links

AcDbLayerStateManager

Was this information helpful?