Issue when setting level from level library ...

We have discovered the following problem:

In our environment (Microstation V8i (SELECT Series 3) - Version 08.11.09.459) we have got several VBA programs in place which support the users to create dimensionings of elements.

After starting the first sub the program sets the desired level which should be used for dimensioning (ie. the user selects a level name in a userform and the desired level is set as level within the dimension style).

Here is the code of this selection:

If FrmDeckenbemassung.ob_Bemassung = True Then

  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG")
  
  If Not lev Is Nothing Then
  
    Set ActiveSettings.DimensionStyle.Level = lev
  
  End If
  
  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG_LÜFTUNG")

  If Not lev Is Nothing Then lev.IsDisplayedInView(ActiveDesignFile.Views(1)) = False

Else

  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG_LÜFTUNG")
  
  If Not lev Is Nothing Then
  
    Set ActiveSettings.DimensionStyle.Level = lev
  
  End If
  
  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG")

  If Not lev Is Nothing Then lev.IsDisplayedInView(ActiveDesignFile.Views(1)) = False

End If


Now - the Levels "DECKENELEMENTIERUNG_BEMASSUNG" and "DECKENELEMENTIERUNG_BEMASSUNG_LÜFTUNG" belong to a level library.

The code works fine as long as the level is already in use within the ActiveDesignFile. If it is not it ends up in a runtime error:

When I now stop the code, and add p.ex. a line element that uses the same level that was selected for the dimensioning and re-run the dimensioning sub again then it works without troubles!


What's the problem with using a level from a level library when it was not used before in the ActiveDesignFile?

Parents
  • Hi,

    quasi_modo said:
    What's the problem with using a level from a level library when it was not used before in the ActiveDesignFile?

    It's not a problem, but just a feature how MicroStation works ;-)

    If a level comes from a dgnlib, but has not been used yet in the active design file, it's displayed only. Its definition exists only in the dgnlib, but not in active file. When such library is used, the definition is copied automatically from dgnlib to the file.

    Some VBA methods work with all available levels and they don't distnguished between levels in active design file and levels from dgnlib(s). But there are some methods that require the level has to exist in the active file.

    The solution is to use lev.IsFromLevelLibrary property thats is False if the level definition does not exist in the active design file yet.

    With regards,

      Jan

Reply
  • Hi,

    quasi_modo said:
    What's the problem with using a level from a level library when it was not used before in the ActiveDesignFile?

    It's not a problem, but just a feature how MicroStation works ;-)

    If a level comes from a dgnlib, but has not been used yet in the active design file, it's displayed only. Its definition exists only in the dgnlib, but not in active file. When such library is used, the definition is copied automatically from dgnlib to the file.

    Some VBA methods work with all available levels and they don't distnguished between levels in active design file and levels from dgnlib(s). But there are some methods that require the level has to exist in the active file.

    The solution is to use lev.IsFromLevelLibrary property thats is False if the level definition does not exist in the active design file yet.

    With regards,

      Jan

Children