DeleteLayerState メソッドは、図面から保存されている画層状態を削除します。次のコードは、ColorLinetype という名前で保存されている画層状態を削除します。
Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices <CommandMethod("RemoveLayerState")> _ Public Sub RemoveLayerState() '' Get the current document Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acLyrStMan As LayerStateManager acLyrStMan = acDoc.Database.LayerStateManager Dim sLyrStName As String = "ColorLinetype" If acLyrStMan.HasLayerState(sLyrStName) = True Then acLyrStMan.DeleteLayerState(sLyrStName) End If End Sub
using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; [CommandMethod("RemoveLayerState")] public static void RemoveLayerState() { // Get the current document Document acDoc = Application.DocumentManager.MdiActiveDocument; LayerStateManager acLyrStMan; acLyrStMan = acDoc.Database.LayerStateManager; string sLyrStName = "ColorLinetype"; if (acLyrStMan.HasLayerState(sLyrStName) == true) { acLyrStMan.DeleteLayerState(sLyrStName); } }
Sub RemoveLayerState() Dim oLSM As AcadLayerStateManager Set oLSM = ThisDrawing.Application. _ GetInterfaceObject("AutoCAD.AcadLayerStateManager.20") oLSM.SetDatabase ThisDrawing.Database oLSM.Delete "ColorLinetype" End Sub