線種には、説明を付けられます。これは、線種を ASCII 文字で表現したものです。AsciiDescription プロパティを使用すると、線種の説明を割り当てたり変更することができます。
線種の説明には最大 47 文字入力できます。説明には、コメントまたは線種パターンを簡潔に示す一連のアンダースコア(_)、ドット(.)、ダッシュ(-)、スペースを入力できます。
次の例では、現在の線種の説明を変更します。
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();
}
}
ThisDrawing.ActiveLinetype.Description = "Exterior Wall"