Rhinocommon "Not" statement in geometry filter

Hi @dale , Is it possible to put “not” statement in geometry filter? I want to create filter for brep objects but not the instance reference ones. Something like:

getObject.GeometryFilter = ObjectType.Brep & !ObjectType.InstanceReference;

Dear @tahirhan
the Objecttype is a binary mask,
if you set it to none you have a long list of 0s (“all switches off”),
if you set it to “anyObject” you have a long list of 1s (“all switches off”)
each digit represents one type of object = one digit = one switch.
each object only has one objecttype.

you should combine Objecttypes with “logical OR” symbol |

you don t need to exclude objecttypes.
why does this not work for you ?

getObject.GeometryFilter = ObjectType.Brep;

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_DocObjects_ObjectType.htm

Edit:
if you really need complex filter you have to use custom geometry filter:

1 Like

Hi @Tom_P, thanks for the answer. After looking into options for GetObject I managed to solve the issue with code block beloved:

GetObject getObj = new GetObject();
getObj.SetCommandPrompt("Select 45' segment");
getObj.GeometryFilter = ObjectType.Brep;
getObj.SubObjectSelect = false;
getObj.ReferenceObjectSelect = false;
GetResult getResult = getObj.Get();
if (getResult != GetResult.Object) return Result.Failure;
ObjRef segRef = getObj.Object(0);