I have noticed that if an existing drawing has a textstyle named Standard and it has been modified (font aerial instead of default txt)
and then you clone it out to a NEW database and save to new file
The new file contains AutoCADs default "Standard" textstyle not the Modified "Standard" textstyle you cloned out.
To see what I mean, try this.
Open a drawing change the "Standard" text style to have any font but "txt".
Now clone it out to a NEW db and save.
Open the drawing and the "Standard" text style will have font "txt"
How can I clone out the standard with the correct overides!
(I have noticed that this happens with table styles as well)
Here is the code I used:
public void CloneTextStyle()
{
using (Database dbCur = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database)
{
using (Transaction trCur = dbCur.TransactionManager.StartTransaction())
{
TextStyleTable tst = (TextStyleTable)trCur.GetObject(dbCur.TextStyleTableId, OpenMode.ForRead);
TextStyleTableRecord tstr = (TextStyleTableRecord)trCur.GetObject(tst["Standard"], OpenMode.ForRead);
ObjectIdCollection idColl = new ObjectIdCollection();
idColl.Add(tstr.ObjectId);
using (Database dbNew = new Database(true, true))
{
using (Transaction trNew = dbNew.TransactionManager.StartTransaction())
{
dbNew.WblockCloneObjects(idColl, dbNew.TextStyleTableId, new IdMapping(), DuplicateRecordCloning.Replace, false);
trNew.Commit();
}
dbNew.SaveAs(@"c:\test.dwg", DwgVersion.Current);
}
}
}
}