I have both versions of Microstation V8i (SS10) and Select, but the vba applications no longer work on v8i.

I have both versions of Microstation V8i (SS10) and Select, the vba applications no longer work on v8i.
But if I launch the application from the Select version, it works.
I'd like to be able to run the applications on both versions of Microstation.

Parents
  • Microstation V8i (Select serie 10) version 07.11.09.919
     
    De : Jon Summers <bounce-DE0601D9-CA2E-4005-A7B3-982ABAEE9AEB@communities.bentley.com>
    Envoyé : mardi, le 12 septembre 2023 09:41
    À : MicroStationForum@communities.bentley.com
    Objet : RE: [MicroStation Forum] I have both versions of Microstation V8i (SS10) and Select, but the vba applications no longer work on v8i.
     
     
    I have both versions of Microstation

    What is the exact version no. (e.g. v10.x.y.z) of MicroStation that you are using on each computer? Use key-in VERSION to see the version no. in the MicroStation Message Center, or Help→About MicroStation in the backstage.

    See this blog that shows you how to obtain MicroStation's version number.

    If you're using an additional product (e.g. ProjectWise, OpenXxx) let us know about that too!

    View online

     

    You received this notification because you subscribed to the forum.  To unsubscribe from only this thread, go here.

    Flag this post as spam/abuse.

     
  • exemple off application:

    Imports System.Math
    Imports MicroStationDGN
    
    Public Class Form1
    
        Public msapp As New MicroStationDGN.Application
        Public kf As New kFonctionsV8.Fonctions
    
        Dim UneDecimale, DeuxDecimales, TroisDecimales As Boolean
        Dim echelle, marge, distance, distanceComplement As Double
        Dim NiveauCotation, NiveauCotationComplement, cote, cotation, coteComplement As String
        Dim pt1, pt2, milieu As Point3d
        Dim oTextElement As TextElement
        Dim oLine As LineElement
        Dim ciMessage As CadInputMessage
        Dim ci As CursorInformation = msapp.CursorInformation
        Dim msg, boxstyle, reponse
    
        Dim Calcul As Double
    
    
        Const TOLERANCE = 0.05
    
        Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
            Me.CenterToScreen()
    
            'Teste si le fichier est 2D ou 3D
            If msapp.ActiveModelReference.Is3D Then
                ToolStripStatusLabel1.Text = "Modèle 3D"
                ToolStripStatusLabel1.ForeColor = Color.Red
                NI.BalloonTipTitle = "Cotation Cadastre"
                NI.BalloonTipText = "Modèle 3D détecté." & Chr(13) & "Les cotations indiqueront les distances horizontales."
                NI.ShowBalloonTip(1000)
            Else
                ToolStripStatusLabel1.Text = "Modèle 2D"
                ToolStripStatusLabel1.ForeColor = Color.Green
            End If
    
            'Détermine l'échelle
            echelle = msapp.ActiveSettings.GridUnits * 100
    
            'Affiche l'échelle
            lblEchelle.Text = Trim(CStr(echelle))
    
            'Lecture des variables de configuration
            NiveauCotation = msapp.ActiveWorkspace.ConfigurationVariableValue("KCONFIG_NIVEAU_COTATION")
    
            msapp.CadInputQueue.SendCommand("level create " & NiveauCotation)
            msapp.CadInputQueue.SendCommand("active level " & NiveauCotation)
    
            msapp.ShowCommand("Cotation")
    
        End Sub
    
        Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
    
            Try
    
                Me.Hide()
    
                'Une décimale
                If opt1Decimale.Checked Then
                    UneDecimale = True
                    DeuxDecimales = False
                    TroisDecimales = False
                End If
    
                'Deux décimales
                If opt2Decimales.Checked Then
                    UneDecimale = False
                    DeuxDecimales = True
                    TroisDecimales = False
                End If
    
                'Trois décimales
                If opt3Decimales.Checked Then
                    UneDecimale = False
                    DeuxDecimales = False
                    TroisDecimales = True
                End If
    
    
                Do
    
                    'Curseur de localisation
                    msapp.CommandState.StartLocate(New Class1)
                    msapp.CommandState.EnableAccuSnap()
    
                    '****************************************
                    'Premier point
                    '****************************************
                    msapp.ShowCommand("Cotation")
                    msapp.ShowPrompt("Déterminez le premier point / [RESET] pour annuler")
    
                    ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                    If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
                        pt1.X = ciMessage.Point.X
                        pt1.Y = ciMessage.Point.Y
                    Else
                        msapp.CadInputQueue.SendReset()
                        Me.Show()
                        Exit Sub
                    End If
    
                    '****************************************
                    'Deuxième point
                    '****************************************
                    msapp.ShowCommand("Cotation")
                    msapp.ShowPrompt("Déterminez le second point / [RESET] pour annuler")
    
                    ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                    If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
                        pt2.X = ciMessage.Point.X
                        pt2.Y = ciMessage.Point.Y
                    Else
                        msapp.CadInputQueue.SendReset()
                        Me.Show()
                        Exit Sub
                    End If
    
                    'Crée la ligne support pour la cotation
                    oLine = msapp.CreateLineElement2(Nothing, pt1, pt2)
                    msapp.ActiveModelReference.AddElement(oLine)
    
                    'Calcule la distance et le milieu entre les deux points
                    distance = Sqrt(((pt1.X - pt2.X) ^ 2) + ((pt1.Y - pt2.Y) ^ 2))
                    milieu = msapp.Point3dFromXYZ((pt1.X + pt2.X) / 2, (pt1.Y + pt2.Y) / 2, 0)
    
                    'Formate le texte de cotation
                    If UneDecimale Then cote = Format(distance, "########0.0")
                    If DeuxDecimales Then cote = Format(distance, "########0.00")
                    If TroisDecimales Then cote = Format(distance, "########0.000")
    
                    'Si pas de complément on place la cote
                    If Not chkComplement.Checked Then
    
    
                        Form2.txtMesure.Text = cote
    
                        cotation = "-" & LTrim(Form2.txtMesure.Text) & "-"
    
                        'Crée le texte
                        oTextElement = msapp.CreateTextElement1(Nothing, cotation, milieu, msapp.Matrix3dIdentity)
    
                        msapp.CadInputQueue.SendKeyin("ACTIVE TXJ=CB")
                        msapp.CadInputQueue.SendKeyin("LV=" + NiveauCotation)
    
                        'msapp.CadInputQueue.SendKeyin("WORDPROCESSOR PLACE TEXT ICON")
                        'msapp.MbeSetAppVariable("WORDPROC", "gWordProcResourceData.method", 4&)
    
    
    
                        msapp.CadInputQueue.SendKeyin("PLACE TEXT ABOVE")
                        msapp.CadInputQueue.SendKeyin(cotation)
    
                        'place le texte au milieu de la ligne à coter
                        msapp.CadInputQueue.SendTentativePoint(milieu, ci.CurrentView)
                        msapp.CadInputQueue.SendDataPoint(milieu)
    
                        msapp.ShowCommand("Cotation : " & cote & " m")
                        msapp.ShowPrompt("[DATA] pour placer / [RESET] pour changer de place")
    
                        ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                        'DATA place le texte
                        If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
    
                            msapp.CadInputQueue.SendLastInput()
                            msapp.ActiveModelReference.RemoveElement(oLine)
    
    
                        Else
    
                            'RESET change la place du texte
                            msapp.CadInputQueue.SendKeyin("NULL")
                            msapp.CadInputQueue.SendKeyin("ACTIVE TXJ=CT")
                            msapp.CadInputQueue.SendKeyin("PLACE TEXT BELOW")
                            msapp.CadInputQueue.SendKeyin(cotation)
    
                            msapp.CadInputQueue.SendTentativePoint(milieu, ci.CurrentView)
                            msapp.CadInputQueue.SendDataPoint(milieu)
    
                            msapp.ShowCommand("Cotation : " & cote & " m")
                            msapp.ShowPrompt("[DATA] pour placer / [RESET] pour annuler")
    
                            ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                            If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
    
                                msapp.CadInputQueue.SendLastInput()
    
                            Else
    
                                msapp.ActiveModelReference.RemoveElement(oLine)
                                oLine.Redraw(MsdDrawingMode.msdDrawingModeErase)
    
                            End If
    
                            'Place les éléments dans le bon niveau
                            msapp.CadInputQueue.SendKeyin("Level element select Default")
                            msapp.CadInputQueue.SendKeyin("change level")
    
                        End If
    
                        'si complément
                    Else
    
                        Form2.txtMesure.Text = cote
                        Form2.ShowDialog()
    
                        'Teste si l'écart est dans la tolérance
    
    
                        If Form2.optEncod.Checked Then Calcul = Abs(Val(Form2.txtMesure.Text) - Val(Form2.txtDistance.Text))
                        If Form2.optRuban.Checked Then Calcul = Abs(Val(Form2.txtMesure.Text) - Val(Form2.txtRuban.Text))
    
    
                        If Calcul >= TOLERANCE Then
    
                            'on accepte pas l'écart
                            If MsgBox("Ecart hors tolérance. Continuer quand même?", MsgBoxStyle.YesNo, "Hors tolérance") = 7 Then
    
                                'Supprime la ligne support si elle existe encore
                                If Not (oLine Is Nothing) Then
                                    msapp.ActiveModelReference.RemoveElement(oLine)
                                End If
    
                                Me.Show()
                                Exit Sub
    
                            Else
                                'on accepte qd même l'écart > 5, on active le niveau adéquat
                                NiveauCotationComplement = msapp.ActiveWorkspace.ConfigurationVariableValue("KCONFIG_NIVEAU_COTA_SUP5")
                                msapp.CadInputQueue.SendCommand("level create " & NiveauCotationComplement)
                                msapp.CadInputQueue.SendCommand("active level " & NiveauCotationComplement)
    
                            End If
    
                        Else
                            'on accepte l'écart < 5, on active le niveau adéquat
                            NiveauCotationComplement = msapp.ActiveWorkspace.ConfigurationVariableValue("KCONFIG_NIVEAU_COTA_INF5")
                            msapp.CadInputQueue.SendCommand("level create " & NiveauCotationComplement)
                            msapp.CadInputQueue.SendCommand("active level " & NiveauCotationComplement)
    
                        End If
    
    
                        'Si "cote mesurage" est coché
                        If Form2.optEncod.Checked Then
                            'msapp.CadInputQueue.SendKeyin("LV=" + NiveauCotationComplement)
                            cotation = "[" & LTrim(Form2.txtMesure.Text) & "]" & "mes." & Form2.txtMesurage.Text
                        Else
                            'msapp.CadInputQueue.SendKeyin("LV=" + NiveauCotationComplement)
                            cotation = "[" & LTrim(Form2.txtMesure.Text) & "]" & "<" & Form2.txtMes.Text & ">" & "mes." & Form2.txtMes2.Text
                        End If
    
                        oTextElement = msapp.CreateTextElement1(Nothing, cotation, milieu, msapp.Matrix3dIdentity)
    
                        msapp.CadInputQueue.SendKeyin("NULL")
                        msapp.CadInputQueue.SendKeyin("ACTIVE TXJ=CB")
                        msapp.CadInputQueue.SendKeyin("PLACE TEXT ABOVE")
                        msapp.CadInputQueue.SendKeyin(cotation)
    
                        msapp.CadInputQueue.SendTentativePoint(milieu, ci.CurrentView)
                        msapp.CadInputQueue.SendDataPoint(milieu)
    
                        msapp.ShowCommand("Cotation : " & cote & " m")
                        msapp.ShowPrompt("[DATA] pour placer / [RESET] pour changer de place")
    
                        ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                        If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
    
                            msapp.CadInputQueue.SendLastInput()
    
                        ElseIf ciMessage.InputType = MsdCadInputType.msdCadInputTypeReset Then
    
                            msapp.CadInputQueue.SendKeyin("NULL")
                            msapp.CadInputQueue.SendKeyin("ACTIVE TXJ=CT")
                            msapp.CadInputQueue.SendKeyin("PLACE TEXT BELOW")
                            msapp.CadInputQueue.SendKeyin(cotation)
    
                            msapp.CadInputQueue.SendTentativePoint(milieu, ci.CurrentView)
                            msapp.CadInputQueue.SendDataPoint(milieu)
    
                            msapp.ShowCommand("Cotation : " & cote & " m")
                            msapp.ShowPrompt("[DATA] pour placer / [RESET] pour annuler")
    
                            ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                            If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
    
                                msapp.CadInputQueue.SendLastInput()
    
                            Else
    
                                msapp.CadInputQueue.SendReset()
                                msapp.ActiveModelReference.RemoveElement(oLine)
                                oLine.Redraw(MsdDrawingMode.msdDrawingModeErase)
                                Me.Show()
                                Exit Sub
    
                            End If
    
    
                        End If
    
    
                        'Place les éléments dans le bon niveau
                        msapp.CadInputQueue.SendKeyin("Level element select Default")
                        msapp.CadInputQueue.SendKeyin("change level")
    
                        msapp.CadInputQueue.SendKeyin("LV=" + NiveauCotation)
    
                        'Si "cote mesurage" est coché
    
                        If Form2.optEncod.Checked Then
                            coteComplement = LTrim(Form2.txtDistance.Text)
                        Else
                            coteComplement = LTrim(Form2.txtRuban.Text)
                        End If
    
                        distanceComplement = Val(coteComplement)
    
    
                        'Formate le texte de cotation
                        If UneDecimale Then coteComplement = Format(distanceComplement, "########0.0")
                        If DeuxDecimales Then coteComplement = Format(distanceComplement, "########0.00")
                        If TroisDecimales Then coteComplement = Format(distanceComplement, "########0.000")
    
    
                        cotation = "-" & coteComplement & "-"
    
                        Form2.txtDistance.Clear()
                        Form2.txtMesure.Clear()
    
                        oTextElement = msapp.CreateTextElement1(Nothing, cotation, milieu, msapp.Matrix3dIdentity)
    
                        msapp.CadInputQueue.SendKeyin("NULL")
                        msapp.CadInputQueue.SendKeyin("ACTIVE TXJ=CB")
                        msapp.CadInputQueue.SendKeyin("PLACE TEXT ABOVE")
                        msapp.CadInputQueue.SendKeyin(cotation)
    
                        msapp.CadInputQueue.SendTentativePoint(milieu, ci.CurrentView)
                        msapp.CadInputQueue.SendDataPoint(milieu)
    
                        msapp.ShowCommand("Cotation : " & cote & " m")
                        msapp.ShowPrompt("[DATA] pour placer / [RESET] pour changer")
    
                        ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                        If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
    
                            msapp.CadInputQueue.SendLastInput()
                            msapp.ActiveModelReference.RemoveElement(oLine)
                            Form2.txtMesurage.Clear()
                            Form2.txtMes.Clear()
                            Form2.txtMes2.Clear()
    
                        ElseIf ciMessage.InputType = MsdCadInputType.msdCadInputTypeReset Then
    
                            msapp.CadInputQueue.SendKeyin("NULL")
                            msapp.CadInputQueue.SendKeyin("ACTIVE TXJ=CT")
                            msapp.CadInputQueue.SendKeyin("PLACE TEXT BELOW")
                            msapp.CadInputQueue.SendKeyin(cotation)
    
                            msapp.CadInputQueue.SendTentativePoint(milieu, ci.CurrentView)
                            msapp.CadInputQueue.SendDataPoint(milieu)
    
                            msapp.ShowCommand("Cotation : " & cote & " m")
                            msapp.ShowPrompt("[DATA] pour placer / [RESET] pour annuler")
    
                            ciMessage = msapp.CadInputQueue.GetInput(MsdCadInputType.msdCadInputTypeDataPoint, MsdCadInputType.msdCadInputTypeReset)
    
                            If ciMessage.InputType = MsdCadInputType.msdCadInputTypeDataPoint Then
    
                                msapp.CadInputQueue.SendLastInput()
    
                            Else
    
                                msapp.CadInputQueue.SendReset()
                                msapp.ActiveModelReference.RemoveElement(oLine)
                                oLine.Redraw(MsdDrawingMode.msdDrawingModeErase)
                                Me.Show()
                                Exit Sub
    
                            End If
                        End If
    
                        'Place les éléments dans le bon niveau
                        msapp.CadInputQueue.SendKeyin("Level element select Default")
                        msapp.CadInputQueue.SendKeyin("change level")
    
                    End If
    
                    'Fin de traitement
    
    
                    'Supprime la ligne support si elle existe encore
                    If Not (oLine Is Nothing) Then
                        msapp.ActiveModelReference.RemoveElement(oLine)
                    End If
    
                    'Reset du texte dans le wordproc
                    msapp.CadInputQueue.SendReset()
    
                    'Place les éléments dans le bon niveau
                    msapp.CadInputQueue.SendKeyin("Level element select Default")
                    msapp.CadInputQueue.SendKeyin("change level")
    
                Loop
    
            Catch ex As Exception
    
                NI.BalloonTipTitle = "Cotation Cadastre"
                NI.BalloonTipText = "Traitement interrompu. Application minimisée."
                NI.ShowBalloonTip(500)
                Me.Show()
                Me.WindowState = FormWindowState.Minimized
                Exit Sub
    
            End Try
    
    
    
        End Sub
    
        Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
    
            NI.Dispose()
            msapp.CommandState.StartDefaultCommand()
            Me.Close()
    
        End Sub
    
        Private Sub Form1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Leave
    
            NI.Dispose()
            msapp.CommandState.StartDefaultCommand()
            Me.Close()
    
        End Sub
    
        Private Sub NI_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NI.MouseDoubleClick
    
            Me.WindowState = FormWindowState.Normal
    
        End Sub
    
    End Class
    

  • exemple
    Imports System.Math
    Imports MicroStationDGN

    Imports is a .NET statement.  Why do you use it in a VBA macro?

    ToolStripStatusLabel

    ToolStripStatusLabel1 is a Windows.Forms class.  What's that doing in a VBA macro?

    Have you referenced some Windows DLLs in your VBA project?

     
    Regards, Jon Summers
    LA Solutions

  • You're right, it's a .NET instruction Microstation, not a VBA macro.
    But my problem is the same: the application no longer works on Microsation V8i.

  • Then you need to recompile it to CONNECT version.

    Can you be more specific what you mean by SELECT version and CONNECT?

    V8i SS4 - is SELECT

    V8i SS10 - is also SELECT version but with SES licensing.

    Technically should be the same as no other changes were made but we have noticed in practice that these two versions don't work the same. SS10 is less stable and some long processing VBA macros tend to crash.

  • Hi Philippe,

    Similarly to and : At first it is necessary to make you situation clear, because so far, the discussion is messy and versions and technologies are not clear.

    Can you please confirm whether I am right?

    • You have installed
      • MicroStation V8i (SELECTseries 10) , version 08.11.09.919
      • MicroStation CONNECT Edition ... what update and version?
    • The application that is discussed is VB.NET (not VBA)?
    But my problem is the same: the application no longer works on Microsation V8i.

    Problem may be the same, but context is very different (and answers too) when talking about different versions and you mix VBA and VB.NET.

    Generally: It's not possible to run application both on V8i and CE. To make it clear (with focus on NET):

    • MicroStation V8i is 32bit application, supporting NET Framework 3.5
    • MicroStation CONNECT Edition is 64bit application, supporting NET Framework 4.6

    Source code must be migrated and recompiled to target different bitness and runtime version, often more modifications are necessary, because plenty of differences exist.

    Exceptions exist from this rule (simple VBA, maybe in specific scenario external COM/Interop applicaitons), but they are rare and often extra limitations and requirements exist.

    With regards,

      Jan

    • You have installed
      • MicroStation V8i (SELECTseries 10) , version 08.11.09.919
      • MicroStation CONNECT Edition .Update 17 10.17.00.209
    • The application that is discussed is VB.NET (not VBA)? it is a "Visual Basic 8" from 2010.
    • enclosed is the link weetransfert to the code and the exe file.
    • https://we.tl/t-PKbd2IeoLL
  • This application is just for placing text in a map. The numbers correspond to cadastral natures. 

  • it is a "Visual Basic 8" from 2010.

    Ok, it makes the situation worse ... at least for me ;-)

    I assume this external process accesses MicroStation through COM and I have little knowledge how it works when two the same COM libraries, in 32bit and 64bit variants, are registered. But because they are registered in separate locations, I assume when exe is compiled to 32 and 64bits, they should be able to connect to the right MicroStation versions.

    With regards,

      Jan

    Answer Verified By: Philippe Bildstein 

Reply Children
No Data