I use the following code phrase quite often:
Set lev = ActiveDesignFile.Levels.Find("SM3D_ELEKTRO_DECKENLEUCHTE") If lev Is Nothing Then Set lev = ActiveDesignFile.AddNewLevel("SM3D_ELEKTRO_DECKENLEUCHTE") ActiveDesignFile.Levels.Rewrite End If
Unfortunately there seems to be a weakness:
Sometimes the command "Set lev = ActiveDesignFile.Levels.Find("SM3D_ELEKTRO_DECKENLEUCHTE")" results in lev = nothing and therefore it tries to add the level.
But when doing "Set lev = ActiveDesignFile.AddNewLevel("SM3D_ELEKTRO_DECKENLEUCHTE")" then the message
pops up.
The message means that the level already exists!
I have no idea why "Set lev = ActiveDesignFile.Levels.Find("SM3D_ELEKTRO_DECKENLEUCHTE")" fails to find the level!
Does anyone have an idea what could be wrong here??