更改线型说明 (.NET)
线型可以具有与之关联的描述。描述提供线型的 ASCII 表示形式。您可以使用属性分配或更改线型说明。AsciiDescription 线型描述最多可以包含 47 个字符。描述可以是注释,也可以是一系列下划线、点、破折号和空格,以显示线型模式的简单表示形式。 更改线型的描述以下示例更改当前线型的描述。 VB.NETImports 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 C#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(); } } VBA/ActiveX 代码参考ThisDrawing.ActiveLinetype.Description = "Exterior Wall" 相关概念父主题: |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-15 12:39
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.