Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [CONNECT DgnPlatformNet] ScanCriteria.SetElementTypeTest doesn't do what I expect

$
0
0

It is not nessessary to call EnsureCapacity before setting the bit.  Using SetBit will adjust the capacity of the BitMask to the amount required by the bit being set.

EnsureCapacity will just make sure it is at least X size so there should be no need to call it on every iteration.

The example I posted above did have a mistake, the max type value should be used rather than the sum of types.

                uint maxType = 0;
                foreach (MSElementType type in types)
                {
                    uint currentTypeValue = (uint) type;

                    bitMask.SetBit(currentTypeValue - 1, true);
                    if (currentTypeValue > maxType)
                        maxType = currentTypeValue;
                }

                uint bmSize = 1 + maxType;
                bmSize = (bmSize + 7) / 8;
                bmSize = (bmSize * 16) - 15;
                bitMask.EnsureCapacity(bmSize + 1);

Both yours and mine should work, as they are doing the same thing.
I agree with you though, hopefully they push out a cleaner solution in the upcoming sdk updates.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>