Dennis, thank you for your patience
LayerTranslationMappings are stored in XDATA of each layer in DWS, DWS is same as DWG with different extension, readDWG API you can change Layer properties.(Thanks to lee from ACAD Documentation team for the tip)
The mappings can retrieved as following.
For the attached DWS, following is the output
LAYER TRANSLATION MAPPING:
A:1
B:2
C:3
public static void tstreadDws()
{
// save old database
Database oldDb = HostApplicationServices.WorkingDatabase;
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
// when using ReadDwgFile, never specify True to buildDefaultDwg
// also, set noDocument=True because this drawing has no
// AutoCAD Document associated with it
using (Database db = new Database(false, true))
{
db.ReadDwgFile("D:\\Temp\\MyStandard.dws", FileOpenMode.OpenForReadAndWriteNoShare, true, "");
// closing the input makes sure the whole dwg is read from disk
// it also closes the file so you can SaveAs the same name
db.CloseInput(true);
string appName = "ACLAYTRANS";
string msg = "LAYER TRANSLATION MAPPING:\n";
// ok time to set the working database
HostApplicationServices.WorkingDatabase = db;
using (Transaction t = db.TransactionManager.StartTransaction())
{
LayerTable lt = t.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
foreach(ObjectId oId in lt)
{
LayerTableRecord ltr = t.GetObject(oId, OpenMode.ForRead) as LayerTableRecord;
ResultBuffer rb = ltr.GetXDataForApplication(appName);
if (rb != null)
{
string layerName = ltr.Name;
// Get the values in the xdata
foreach (TypedValue typeVal in rb)
{
if(typeVal.TypeCode == 1000)
{
msg = msg + layerName + ":" + typeVal.Value +"\n";
}
}
}
}
t.Commit();
}
ed.WriteMessage(msg);
// reset it back ASAP
HostApplicationServices.WorkingDatabase = oldDb;
}
}