Closed MJyee closed 9 months ago
You were very close. Please see below. I use ? as value can be null initially
public class Max2FacesSelection : ISelectionCustomFilter
{
public void Filter(IControl selBox, IXSelObject selection, SelectionCustomFilterArguments args)
{
int? sel_count =((System.Collections.IList)selBox.GetValue())?.Count;
if (sel_count == 2)
{
args.Reason = "Max 2 Selections Allowed";
args.Filter = false;
}
else
args.Filter = true;
}
}
thanks for the help. that solved the initial issue but now when i try running it the count remains 0 even though i have faces selected in the selection box.
is it due to some failed cast ?
Strange, please make sure this is a correct selection box (I can see you have more than one, perhaps it is just a filter for another box)? It works OK for my test (with beta version of xCAD). Note, that it shows the previous value, e.g. the current filtering object is not yet in the list (e.g. when you select first object, the sel_count will be null or 0, second 1, etc.)
Ok after updating to Pre-Release 4627 it is now working, i was originally using the stable 0.7.12 thanks for your help
hi, is there a way to limit the number of selections in a selection box to an example 2 ? i tried using the custom selection filters to cast the selbox to propertymanagerpageselectionbox to check its count property but it returns a fail cast.
my selection box is define like this