Linetypes can have a description associated with them. The description provides an ASCII representation of the linetype. You can assign or change a linetype description by using the AsciiDescription property.
A linetype description can have up to 47 characters. The description can be a comment or a series of underscores, dots, dashes, and spaces to show a simple representation of the linetype pattern.
Change the description of a linetype
The following example changes the description of the current linetype.
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
<CommandMethod("ChangeLinetypeDescription")> _
Public Sub ChangeLinetypeDescription()
'' Get the current document and database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Open the Linetype table record of the current linetype for write
Dim acLineTypTblRec As LinetypeTableRecord
acLineTypTblRec = acTrans.GetObject(acCurDb.Celtype, _
OpenMode.ForWrite)
'' Change the description of the current linetype
acLineTypTblRec.AsciiDescription = "Exterior Wall"
'' Save the changes and dispose of the transaction
acTrans.Commit()
End Using
End Sub
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
[CommandMethod("ChangeLinetypeDescription")]
public static void ChangeLinetypeDescription()
{
// 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 record of the current linetype for write
LinetypeTableRecord acLineTypTblRec;
acLineTypTblRec = acTrans.GetObject(acCurDb.Celtype,
OpenMode.ForWrite) as LinetypeTableRecord;
// Change the description of the current linetype
acLineTypTblRec.AsciiDescription = "Exterior Wall";
// Save the changes and dispose of the transaction
acTrans.Commit();
}
}