This example sets a linetype current through the Database object with the Celtype property.
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
[CommandMethod("SetLinetypeCurrent")]
public static void SetLinetypeCurrent()
{
// Get the current document and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
// Start a transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// Open the Linetype table for read
LinetypeTable acLineTypTbl;
acLineTypTbl = acTrans.GetObject(acCurDb.LinetypeTableId,
OpenMode.ForRead) as LinetypeTable;
string sLineTypName = "Center";
if (acLineTypTbl.Has(sLineTypName) == true)
{
// Set the linetype Center current
acCurDb.Celtype = acLineTypTbl[sLineTypName];
// Save the changes
acTrans.Commit();
}
// Dispose of the transaction
}
}