TheSwamp

Code Red => VB(A) => Topic started by: Matersammichman on June 07, 2006, 01:18:00 PM

Title: Named Layer Filters
Post by: Matersammichman on June 07, 2006, 01:18:00 PM
Two questions:
1. Anyone have code to purge Named Layer Filters?
2. What's the difference between Property Filters, Group Filters, and Standard Filters?
Title: Re: Named Layer Filters
Post by: Bob Wahr on June 07, 2006, 01:24:16 PM
1)  This was quick and dirty some time back.  As I remember it worked fine.
Code: [Select]
Option Explicit
'Private Sub AcadDocument_BeginSave(ByVal FileName As String)
Sub purge_em()
Dim strSubName As String
Dim objDictionary As AcadDictionary
Dim objFilter As AcadObject

On Error GoTo Err_Ctrl

strSubName = "PurgeFilter.DVB"

Set objDictionary = ThisDrawing.Layers.GetExtensionDictionary("ACAD_LAYERFILTERS")
For Each objFilter In objDictionary
  objFilter.Delete
Next

If Left(ThisDrawing.GetVariable("ACADVER"), 2) = "16" Then
  Set objDictionary = ThisDrawing.Layers.GetExtensionDictionary("ACLYDICTIONARY")
  For Each objFilter In objDictionary
    objFilter.Delete
  Next objFilter
End If
Exit_Here:
  Exit Sub
 
Err_Ctrl:
  Select Case Err.Number
    Case -2145386476
      Err.Clear
      Resume Next
    Case Else
      MsgBox "An Error occurred in " & strSubName & "." & vbCr & vbCr _
        & "Error number: " & Err.Number & vbCr & Err.Description & vbCr & vbCr _
        & "DUM DIGga DUM DIGga DIGga DIGga DUM", vbCritical, _
        "Error in " & strSubName
      GoTo Exit_Here
  End Select
     
End Sub
2)
Quote
Layer property filters: Includes layers that have names or other properties in common. For example, you can define a filter that includes all layers that are red and whose names include the letters mech.
Layer group filters: Includes the layers that are put into the filter when you define it, regardless of their names or properties.
Title: Re: Named Layer Filters
Post by: Maverick® on June 07, 2006, 02:11:02 PM
Quote
& "DUM DIGga DUM DIGga DIGga DIGga DUM"

 :-D :-D
Title: Re: Named Layer Filters
Post by: Bryco on June 07, 2006, 02:32:41 PM
There's Maverick getting all vbCritical.