danuvi
Mechanical
- Jul 15, 2015
- 2
I need to delete all objects on layer 201 in the work-active drafting sheet. I have found a good journal to begin with (It delets everything on layer 201 in the whole part). The problem is, if I have multiple drafting sheets it deletes the objects on layer 201 everywhere. I have completely no idea how to solve this problem. I hope someone could help me with this.
Code:
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
If displayPart Is Nothing Then
Exit Sub
End If
Dim notifyOnDelete1 As Boolean
notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
theSession.UpdateManager.ClearErrorList()
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(workPart.Layers.GetAllObjectsOnLayer(201))
End Sub