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.

     

     

  • Tim:

    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.

    The cleaner way is to use the levels API.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply Children
No Data