I have a problem with the function mdlScanCriteria_setXAttributeTest mentioned by Yongan.Fu 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
Jean-Pierre Hundhausen said:getting all Elements with a specific XAttributeID would be faster
I don't see mdlScanCriteria_setXAttributeTest in the CONNECT public API. However, I see mdlXML_addXMLFragmentXxx in header file ..\SDK\include\Mstn\MdlApi\mdlxml.fdf. I don't know if that's relevant.
mdlScanCriteria_setXAttributeTest
mdlXML_addXMLFragmentXxx
..\SDK\include\Mstn\MdlApi\mdlxml.fdf
Regards, Jon Summers LA Solutions
Jon Summers said:I don't see mdlScanCriteria_setXAttributeTest in the CONNECT public API.
Because it's an undocumented function. That's why I linked the post.
Jon Summers said:However, I see mdlXML_addXMLFragmentXxx in header file ..\SDK\include\Mstn\MdlApi\mdlxml.fdf. I don't know if that's relevant.
As it looks, it's not for XAttributes, more for Linkage Data.
Mit freundlichen Grüßen / Best regardsJean-Pierre Hundhausen
| AB_DATE Engineering Software | ab-date.de |