In COM, you need to create a Find condition InwOpFindSpec and assign it to the new selectionset by InwOpSelectionSet2.ImplicitFindSpec. Following is a demo code:
void AddSearchSelectionSet() { // get state object ComApi.InwOpState oState = ComBridge.State; // new a selection set ComApi.InwOpSelectionSet2 oNewSelSet = (ComApi.InwOpSelectionSet2)(object) oState.ObjectFactory( ComApi.nwEObjectType.eObjectType_nwOpSelectionSet); oNewSelSet.name = "MySet"; // create the find condition ComApi.InwOpFindSpec nwFindSpec = (ComApi.InwOpFindSpec)(object) oState.ObjectFactory( ComApi.nwEObjectType.eObjectType_nwOpFindSpec); ComApi.InwOpFindCondition nwFindCondition = (ComApi.InwOpFindCondition)(object) oState.ObjectFactory( ComApi.nwEObjectType.eObjectType_nwOpFindCondition); nwFindCondition.SetAttributeNames("", "Entity Handle"); nwFindCondition.SetPropertyNames("", "Value"); nwFindCondition.Condition = ComApi.nwEFindCondition.eFind_EQUAL; nwFindCondition.value = "187E2"; nwFindSpec.selection = null; nwFindSpec.SearchMode = ComApi.nwESearchMode.eSearchMode_ALL_PATHS; nwFindSpec.Conditions().Add(nwFindCondition); // set the find condition to the selectionset oNewSelSet.ImplicitFindSpec = nwFindSpec; // add the selectionset to the collection oState.SelectionSets().Add(oNewSelSet); }

Leave a Reply