Level off - IsDisplayedInView [VBA][V8i]

Hi guys,

I wrote this code, to set off all levels.

Sub AllLevelOff()
    Dim myLevel As Level
    Dim myLevels As Levels
    Dim myView As View
    Dim iViewIndex As Integer
    
    iViewIndex = 1
    Set myLevels = ActiveDesignFile.Levels
    
    Set myView = ActiveDesignFile.Views(iViewIndex)
    
    For Each myLevel In myLevels
        'MsgBox myView.Index
        'Dim str As String
        'str = myLevel.Name
        'Set myLevel = ActiveDesignFile.Levels(myLevel.Name)
        myLevel.IsDisplayedInView(myView) = False
        'myLevel.IsDisplayed = False
        'myLevel.IsFrozen = True
    Next myLevel
    myLevels.Rewrite
    RedrawAllViews
    
    Dim sPipeID As String
    sPipeID = "LO-001"
    ActiveDesignFile.Levels(sPipeID & " - 3D - Axis").IsActive = True
End Sub

but it works only for Global display and Frozen, not for View display.

I followed those articles/codes:

http://www.la-solutions.co.uk/content/V8/MVBA/MVBA-LevelControl.htm

https://communities.bentley.com/products/microstation/w/microstation__wiki/2895/2895

I work around the problem using the isdisplayed property, but I ask why it shouldn't work. Do you know anything about it?
Now, I've seen an answer by Jon Summers in which he says, if I don't get it wrong, that isdisplayedinview is only available from version 8.01 of VBA.

But if so, why do I see the property among those available with Level objects? And anyway why doesn't my code work?

Thank you so much,
Paolo

  • Hi Paolo,

    But if so, why do I see the property among those available with Level objects?

    I do not understand your question.

    According to documentation, IsDisplayedInView method is available from 08.00. You specified you use MicroStation V8i, which is 08.11. So why you are surprised you see the method in the list?

    And anyway why doesn't my code work?

    It's hard to say, when you (A) did no specify exactly, what the code should do and (B) did not provide any test data.

    To say "set off all levels" is not precise and to be developer (even using simple VBA) requires to be always precise as much as possible. There are levels in active design file and in references. We have 8 views and every views can be controlled in different modes (independent, global view, global freeze). It produces many alternatives whay maybe you want to achieve.

    With regards,

      Jan

    P.S. Why you decided to do not follow standard subject format [<product> <version> <language>] >question> and you use own one?

  • I've seen an answer by Jon Summers in which he says, if I don't get it wrong, that isdisplayedinview is only available from version 8.01 of VBA

    Whatever you may have read, look in VBA help.  The date when a function was introduced is included in that documentation.

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jan,

    According to documentation, IsDisplayedInView method is available from 08.00. You specified you use MicroStation V8i, which is 08.11. So why you are surprised you see the method in the list?

    I understood version 8 of VBA, not Microstation. Now, I see. :-)

    It's hard to say, when you (A) did no specify exactly, what the code should do and (B) did not provide any test data.

    I supposed it was clear: the code (IsDisplayedInView) didn't set off level in view. Anyhow I'll try to be precise as much as possible.

    Why you decided to do not follow standard subject format [<product> <version> <language>] >question> and you use own one?

    I didn't know there is a standard format. I'm sorry. I'll follow it, now. 
    Is "[MS V8i - VBA] Question" correct?

    Thanks a lot.

    Paolo.

  • Hi Jon,

    as suggested, I looked for my question around the web and then in the forum.

    I found two interesting (at least, in my opinion), I shared with the forum.

    And thenI found that answer by you. As I supposed (and wrote) I was wrong. You was speaking abot v8 of Microstation but I understood (also deceived by the fact that my code didn't work)  you were speaking abot VBA release. That's all :-)

    Anyhow, your suggestion about documentation's date will be surely useful.

    Thanks so much.

    Best regards,

    Paolo