If it's a new database created from scratch, then I suspect
that it doesn't have the 'default' filters that AutoCAD adds
(e.g., "All Layers", "All Used Layers"), and that's the problem.
Those are special layer filters, and I've never tried adding
them to a new database.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com
Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm
wrote in message news:6147508@discussion.autodesk.com...
Not sure if we understand each other correctly. I want to set the ACTIVE or
CURRENT Layerfilter of a new drawingdatabase. So once I open the drawing,
this Layerfilter is active and filters out all unwanted layers. Also
myDB.LayerFilters.Root.Name = "Filter1" is not wokring because it wouldn't
do anything, but it is not working because it says: eNotApplicable.
Basically I understand you relate upon the fact, that the LayerFilters need
to be casted, changed and casted back again.That's what I read on Keans
blog, and I used some of his code as well to create this: Public Function
mkLayerFilter(ByVal myDB As Database, ByVal filterName As String, ByVal
filterData As String) As Boolean Try ' Read Layerfilters Dim lft As
LayerFilterTree = myDB.LayerFilters Dim lfc As LayerFilterCollection =
lft.Root.NestedFilters ' Add Layerfilter Dim lf1 As New LayerFilter()
lf1.Name = filterName lf1.FilterExpression = filterData lfc.Add(lf1) ' Write
Layerfilters 'lft.Root.Name = filterName 'eNotApplicable myDB.LayerFilters =
lft 'myDB.LayerFilters.Root.Name = filterName 'eNotApplicable
'myDB.LayerFilters = myDB.LayerFilters Catch ex As Exception
MsgBox("Exception: {0}", ex.Message) End Try End Function But neither nor is
working...