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.
线型可以具有与其关联的说明,用于提供线型的 ASCII 表示。用户可以使用 AsciiDescription 属性来指定或修改线型的说明。
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.
线型说明最多可以包含 47 个字符。说明可以是一个注释,也可以使用一系列下划线、点、虚线和空格简单地表示出线型图案。
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();
}
}