[CommandMethod("Test", CommandFlags.UsePickSet)]publicstaticvoidTest(){try{using(Transactiontr=ActiveUtil.TransactionManager.StartTransaction()){vartypeValues=newList<TypedValue>();typeValues.Add(newTypedValue((int)DxfCode.Start,"CIRCLE"));SelectionFilterfilter=newSelectionFilter(typeValues.ToArray());//Use Select all to Select all objects with selection Criteria//PromptSelectionResult selectionResult = ActiveUtil.Editor.SelectAll(filter);//Use get selection to only select from selected objectsPromptSelectionResultselectionResult=ActiveUtil.Editor.GetSelection(filter);if(selectionResult.Status==PromptStatus.OK){SelectionSetss=selectionResult.Value;ActiveUtil.Editor.WriteLine("Number of circles with 1m radius selected: "+ss.Count);}tr.Commit();}}catch(System.Exceptionex){Application.ShowAlertDialog($"Something went wrong error:{ex.Message}");}}
Selection filter with multiple criteria
[CommandMethod("Test", CommandFlags.UsePickSet)]publicstaticvoidTest(){try{using(Transactiontr=ActiveUtil.TransactionManager.StartTransaction()){vartypeValues=newList<TypedValue>();typeValues.Add(newTypedValue((int)DxfCode.Start,"CIRCLE"));typeValues.Add(newTypedValue((int)DxfCode.Operator,">="));typeValues.Add(newTypedValue((int)DxfCode.Real,5));SelectionFilterfilter=newSelectionFilter(typeValues.ToArray());//Use Select all to Select all objects with selection CriteriaPromptSelectionResultselectionResult=ActiveUtil.Editor.SelectAll(filter);//Use get selection to only select from selected objects//PromptSelectionResult selectionResult = ActiveUtil.Editor.GetSelection(filter);if(selectionResult.Status==PromptStatus.OK){SelectionSetss=selectionResult.Value;ActiveUtil.Editor.WriteLine("Number of circles with 1m radius selected: "+ss.Count);}tr.Commit();}}catch(System.Exceptionex){Application.ShowAlertDialog($"Something went wrong error:{ex.Message}");}}