Get SelectionFilter by block Name

It is very common that you will need to create selection filters for different types of blocks. Why repeat yourself?

 

There is a very simple utility that I wrote that is amazingly handy for solving this very issue. Best part is that it accepts wildcards, so you can search for block references which, for example, start with Fire by passing in “FIRE*” as the argument:

public static SelectionFilter GetSSFilterBlockReferenceByName(string name)
{
TypedValue[] filterlist = new TypedValue[2];
filterlist[0] = new TypedValue(0, “INSERT”);
filterlist[1] = new TypedValue(2, name);
SelectionFilter filter = new SelectionFilter(filterlist);
return filter;
}

So simple!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *