Remove Elements in dgn-file with specific name

I have this:

using (FileLevelCache levelCache = ActiveDgnFile.GetLevelCache())
{
LevelHandleCollection levelHandles = levelCache.GetHandles();
foreach (LevelHandle level in levelHandles)
{
if (level.Name.EndsWith(" P") || level.Name.EndsWith(" L"))
{
levelCache.RemoveLevel(null, level);

levelCache.Write();
}
}
}

But it dont remove the levels. I think I need to remove the elements assosiated with the levels before removing the levels. But I dont know how...

Can anyone help?

Parents Reply
  • Hi ,

    Most often, if a key-in command is known and exists it can and should be the preferred and most easily maintainable method used.

    If an app needs/requires to create an input queue command from scratch or partially for key-in purposes then it is appropriate to identify, create and assign specific CMDNUM identifiers (UInt16); some (but certainly not all) are published and can be found in the developer shell, like:

    C:\Program Files\Bentley\MicroStationCONNECTSDK\examples>sdkinc
    C:\Program Files\Bentley\MicroStationCONNECTSDK\include>s "^#define.CMD_" *

    Thank you and HTH,
    Bob



Children
No Data