[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
  • It's been a few days and no Ideas? do you have an idea?

    Mit freundlichen Grüßen / Best regards
    Jean-Pierre Hundhausen

    |  AB_DATE Engineering  Software   |  ab-date.de  |

  • Hi and ,

    had brought this thread to my attention this morning to try and review and provide any feedback possible.

    From our meeting and review of this issue I find two fundamental questions/paths to pursue.

    1. Can the unpublished function mdlScanCriteria_setXAttributeTest continue to be used in CONNECT successfully as it was in V8i?
    2. Is there a new updated API available in CONNECT to recommended to replace mdlScanCriteria_setXAttributeTest?

    Fortunately I am seeing options for both; however there is the direct getting up and running with the old approach (recommended for now) and the find and recommend a new replacement CONNECT API (requires some additional exploration/investigation in order to recommend).

    So, for #1.  In our review we searched and found a few prior posts (this thread and Volker) leading to the progression to this thread and can state a couple points with a recommendation (if not current in your code):

    • 's prototype recommendation of an unpublished function for V8i - pay close attention to the last parameter type.
    • Is this unpublished function still (internally) available in CONNECT? Yes.
    • Is this unpublished function (actively) used in CONNECT? Yes. PrintFoundation and AnimCore.
    • The above also hints/answers: Does it work and Can it be used w/o crashing(?). Yes.

    From the code snip provided in this thread above (thank you), Given if all the other scancriteria is configured properly, then we have to question if the function prototype is correct - specifically the last parameter's: data type and how the value is passed.  can you confirm your function prototype and value type passed conform to this signature?

    MSCORE_EXPORT int   mdlScanCriteria_setXAttributeTest (ScanCriteriaP scP, XAttributeHandlerId* handlerId, UInt32 attrId)

    For #2 (new/replacement API recommendation).  As mentioned at this time I do not have a concrete recommendation for a replacement API, though I suspect the new e.g. XAttributeHandle, XAttributeHandler API may likely provide an effective replacement, though I would need to see if I can find or create any code snips to exercise associated setup and call backs.  I will try to place a few more cycles in on this in parallel to final preparations needed towards the MSCE SDK U14 release (sorry - no specific date I can announce yet).

    In summary, please check the function prototype to see if it helps make this unpublished function come to life again for you and I will try to find a new replacement to recommend or file an enhancement if XAttributeHandle/XAttributeHandler API is not capable of replacing mdlScanCriteria_setXAttributeTest .

    Please reply back to this thread with your results when possible.

    Thank you and HTH,
    Bob



Reply
  • Hi and ,

    had brought this thread to my attention this morning to try and review and provide any feedback possible.

    From our meeting and review of this issue I find two fundamental questions/paths to pursue.

    1. Can the unpublished function mdlScanCriteria_setXAttributeTest continue to be used in CONNECT successfully as it was in V8i?
    2. Is there a new updated API available in CONNECT to recommended to replace mdlScanCriteria_setXAttributeTest?

    Fortunately I am seeing options for both; however there is the direct getting up and running with the old approach (recommended for now) and the find and recommend a new replacement CONNECT API (requires some additional exploration/investigation in order to recommend).

    So, for #1.  In our review we searched and found a few prior posts (this thread and Volker) leading to the progression to this thread and can state a couple points with a recommendation (if not current in your code):

    • 's prototype recommendation of an unpublished function for V8i - pay close attention to the last parameter type.
    • Is this unpublished function still (internally) available in CONNECT? Yes.
    • Is this unpublished function (actively) used in CONNECT? Yes. PrintFoundation and AnimCore.
    • The above also hints/answers: Does it work and Can it be used w/o crashing(?). Yes.

    From the code snip provided in this thread above (thank you), Given if all the other scancriteria is configured properly, then we have to question if the function prototype is correct - specifically the last parameter's: data type and how the value is passed.  can you confirm your function prototype and value type passed conform to this signature?

    MSCORE_EXPORT int   mdlScanCriteria_setXAttributeTest (ScanCriteriaP scP, XAttributeHandlerId* handlerId, UInt32 attrId)

    For #2 (new/replacement API recommendation).  As mentioned at this time I do not have a concrete recommendation for a replacement API, though I suspect the new e.g. XAttributeHandle, XAttributeHandler API may likely provide an effective replacement, though I would need to see if I can find or create any code snips to exercise associated setup and call backs.  I will try to place a few more cycles in on this in parallel to final preparations needed towards the MSCE SDK U14 release (sorry - no specific date I can announce yet).

    In summary, please check the function prototype to see if it helps make this unpublished function come to life again for you and I will try to find a new replacement to recommend or file an enhancement if XAttributeHandle/XAttributeHandler API is not capable of replacing mdlScanCriteria_setXAttributeTest .

    Please reply back to this thread with your results when possible.

    Thank you and HTH,
    Bob



Children