[Connect U13] [C# | C++] mdlScanCriteria_setXAttributeTest does not look into Cells

I have a problem with the function mdlScanCriteria_setXAttributeTest mentioned by in this post:
https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/115328/v8i-c-finding-xattribute-data-in-a-model-file/353836#353836

When setting a XAttribute as a Filter, this function does not look into Cells. Same for ParametricCells but there I do not get any Information's no matter if scanning or looking directly into it, but this as a side note. Other Elements are found with that function and when not using mdlScanCriteria_setXAttributeTest I get all Elements inside a Cell (ParametricCells still doesn't work). The same code does work in V8i.

The C# Code:

BCOM.ElementScanCriteria scanCri = new BCOM.ElementScanCriteriaClass();
         scanCri.ExcludeNonGraphical();
         mdlScanCriteria_setReturnType(scanCri.MdlScanCriteriaP(), 1 , 0 /* FALSE */, 2 /* TRUE */);
         XYZmdlScanCriteria_setXAttributeTest(scanCri.MdlScanCriteriaP(), 42 , 42);

         BCOM.ElementEnumerator num = currentModelRef.Scan(scanCri);
         BCOM.Element[] arrElemente = num.BuildArrayFromContents();

XYZmdlScanCriteria_setXAttributeTest is Wrapped and in C++, the XAttributeID gets build. Both 42s are only used for the ID and I've replaced them here.

return mdlScanCriteria_setXAttributeTest(reinterpret_cast<ScanCriteriaP>(p_ScanCriteria), &h_XAttrID, XAttributeHandle::MATCH_ANY_ID, NULL);

mdlScanCriteria_setReturnType(scanCri.MdlScanCriteriaP(), 1 , 0 /* FALSE */, 2 /* TRUE */);
gets used like this in V8i and works there. I do not know why true is a 2 but I've tried 1 also. Removing this line completely doesn't changed anything.
Just getting all Elements with a specific XAttributeID would be faster

Parents Reply Children