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?
Jon Summers said:The problem with EnqueueCmd is that it requires a ULong cmdNum (command number).
EnqueueCmd
ULong cmdNum
But how often command number is required to be used? Classic funkcionality is accessible using key-i s, new one sometimes as Named command, which can also be invoked by key-in.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Samuel Wiklund said:Maybe a workaround
Trying to use workarounds often leads to worse solution.
Samuel Wiklund said:drop the smart solids so they are not longer cell represented
And what you will do with the elements? They can spread over different levels, so it pollutes your data.
Hi Jon Summers,
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