Thx's
You can use wildcards, the SH* was just a typo on my part. The additional code I added contained wildcards some examples are( ~*|* and AECC_* )and etc., anything you can type within the layer manager you can do within the code. I did find out that you need to remove the existing layer filters first or this code will create a second group with the same names. I am trying to figure out where I am going wrong with this new code which goes along with the add layer filters. The new code is suppose to remove all layer filters and then reinstall them with the updated settings. The main code is from
here.
This .net thing is new to me, I was given some direction at Through the Interface but not sure I have addressed all of the directions.
In my case I want to remove all of the existing filters and replace them with my own.
Can anyone help direct me where I am going wrong in the code below
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.LayerManager;
namespace LayerFilters
{ //START PUBLIC CLASS
public class Commands
{ // START COMMANDMETHOD
[CommandMethod("DLF")]
static public void DeleteLayerFilter()
{Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
LayerFilterTree lft = db.LayerFilters;
LayerFilterCollection lfc = db.LayerFilters.Root.NestedFilters;
for (int i = 0; i < lfc.Count; ++i)
{ LayerFilter lf = lfc
;
if (lf.AllowDelete)
lfc.Remove(lf) ;
db.LayerFilters = lft;
}
}
} // END COMMAND METHOD
} // END PUBLIC CLASS