Details
How to delete layer ?
Solution
Layer have delete method to delete the layer. User can use layer.Delete() method.
Example:
Imports System
Imports System.Runtime.InteropServices
Layer Class Program
Shared Sub Main(ByVal args() As String)
Dim application As SolidEdgeFramework.Application = Nothing
Dim draftDocument As SolidEdgeDraft.DraftDocument = Nothing
Dim sheet As SolidEdgeDraft.Sheet = Nothing
Dim layers As SolidEdgeFramework.Layers = Nothing
Dim layer As SolidEdgeFramework.Layer = Nothing
Dim attributeSets As SolidEdgeFramework.AttributeSets = Nothing
Try
' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
OleMessageFilter.Register()
' Attempt to connect to a running instance of Solid Edge.
application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
draftDocument = TryCast(application.ActiveDocument, SolidEdgeDraft.DraftDocument)
If draftDocument IsNot Nothing Then
sheet = draftDocument.ActiveSheet
layers = sheet.Layers
layer = layers.Add("Test")
layer.Delete()
End If
Catch ex As System.Exception
Console.WriteLine(ex)
Finally
OleMessageFilter.Unregister()
End Try
End Sub
End Class
Hardware/Software Configuration
Platform: AMD64
OS: windows
OS Version: 764
Product: SOLID_EDGE
Application: AUTOMATION
Version: V220MP10
Function: API_DOCUMENT
Ref: 002-8016516