VBA turn on reference level

I have a routine to turn on the DISPLAY RASTER setting with in a specific raster. I need to be able to turn on Level number 2 on in that same reference file. Here is what I have so far.

Sub TurnOnRasterDispInAllRefs()
For Each att In ActiveModelReference.Attachments
If UCase(att.AttachName) = "DSEAL.DGN" Or UCase(att.AttachName) = "DSEAL" Then
att.DisplaysRasterReferences = True
att.Rewrite

Dim lvls As Levels
Dim lvl As Level

Set lvls = att.Levels
For Each lvl In att.Levels
If lvl.Number = 2 Then
lvl.IsDisplayed = true
End If
Next

lvls.Rewrite
RedrawAllViews
End If
Next
ActiveDesignFile.Save
End Sub

 

Parents
  • I am look to turn on a specific level in specific reference file. The reference file is dseal.dgn. I am looking for level number 2.  Just in case a user has renamed the level. I have only had 10 years exprience with MicroStation verses 22 years with AutoCAD. So I do not quite understand why they have a name and a number, but that's another story. The turning the display reference comes on problem the levels for the vectors will not turn on. I have found a crude work around.

    CadInputQueue.SendKeyin "reference levels on 2 DSEAL.DGN"
    CadInputQueue.SendKeyin "selview 1"

    I would like to find a cleaner way than without having to use key-in but that may be the way I have to go.

     

     

  • Level Names, Codes, and Numbers

    Tim:

    I do not quite understand why levels have a name and a number.

    There are three ways, as a programmer, that you use with levels: name, code, and number.

    From the user point of view, a level has a name. The level code is an integer that the user sees in MicroStation's UI. It's for convenience: pre-V8, many folks just used a number and didn't assign a level name.

    Internally, MicroStation uses level IDs. As a programmer, you get to use the level ID, which is something your user never sees. The level ID and the level code are unrelated: the level ID is assigned automatically by MicroStation; the level code must be unique but is assigned by the user.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Level Names, Codes, and Numbers

    Tim:

    I do not quite understand why levels have a name and a number.

    There are three ways, as a programmer, that you use with levels: name, code, and number.

    From the user point of view, a level has a name. The level code is an integer that the user sees in MicroStation's UI. It's for convenience: pre-V8, many folks just used a number and didn't assign a level name.

    Internally, MicroStation uses level IDs. As a programmer, you get to use the level ID, which is something your user never sees. The level ID and the level code are unrelated: the level ID is assigned automatically by MicroStation; the level code must be unique but is assigned by the user.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children
No Data