public static SelectionSet GetBlockRefOnLayerSelectionSet(string LayerName)
{
Document thisDrawing;
SelectionSet selectionSet = null;
PromptSelectionResult selectionSetResult;
TypedValue[] typedArray = new TypedValue[2];
SelectionFilter selectionFilter;
try
{
thisDrawing = GetDocument();
Editor editor = thisDrawing.Editor;
typedArray.SetValue(new TypedValue((int)DxfCode.Start, AutoCADDrawingObjectName.BlockReference), 0);
typedArray.SetValue(new TypedValue((int)DxfCode.LayerName, LayerName), 1);
selectionFilter = new SelectionFilter(typedArray);
selectionSetResult = editor.SelectAll(selectionFilter);
if (selectionSetResult.Value != null)
{
selectionSet = selectionSetResult.Value;
}
}
catch (Exception ex)
{
MessageBox.Show("AutoCADUtility.GetBlockRefOnLayerSelectionSet : " + ex.Message, MessageHeadings.ExceptionError);
}
return selectionSet;
}