Differences between XM and V8i using opendesignfileforprogram

I've posted this problem in a another thread that had a different subject.

I'm getting different results running this code in XM and in V8i.

In XM the result is Num=5, which is correct.

In V8i the result is Num=1, which is wrong. Apparently oLevels only gets level "Default" and ignores the others.

Sub NumLevels()
Dim oFile As DesignFile
Dim FileNameDgn As String
Dim Num As Integer
Dim oLevels As Levels

FileNameDgn = "C:\Lixo\Test.dgn"
Set oFile = OpenDesignFileForProgram(FileNameDgn, False)
Set oLevels = oFile.Levels
Num = oLevels.Count
End Sub

Any idea why?

Parents Reply
  • Robert,

    Thanks for your help. That solved my first problem. The second problem is that after changing

    a level's name, the changes are not saved. Below is the code that works in XM but doesn't works in V8i.

    Do you know why?

    Dim oLevel As Level

    Set oLevel = oFile.DefaultModelReference.Levels.Find("A")

    oLevel.Name = "B"

    oFile.DefaultModelReference.Levels.Rewrite

    LuĂ­s

Children