Easy configuration of language switchable curvenames / Einfache Projektierung von sprachumschaltbare Kurvennamen

Easy configuration of language switchable curvenames / Einfache Projektierung von sprachumschaltbare Kurvennamen

Situation:
In the Extended Trend (ETM) it is possible to use keywords at curve names in order to have them language switchable. The configuration has to be done by hand and thus take some time to configure.
Remedy:
Using the VBA script below the variable identification (@tagname) will be entered as curve name.
For adding the variable identification to the language table as keyword use the "Language Change Wizward" (category "Language Table")
-> copy&paste the VBA code into "MyWorkspace" or a module and afterwards execute it via the toolbar "VBA macros" in the editor
------------------------------------------------------------
Situation:
Im Erweiterten Trend (ETM) ist es möglich den Kurvennamen sprachumschaltbar zu definieren. Dies ist muss manuell durchgeführt werden und ist mit einem gewissen Projektierungsaufwand verbunden.
Abhilfe:
Mit Hilfe des unten angeführten VBA-Script wird die projektierte Variablenkennung als Kurvenname definiert.
Damit die Variablenkennung einfach sprachumschaltbar definiert werden kann der "Language Change Wizward" verwendet werden.
-> VBA-Script in "MyWorkspace" oder ein Modul kopieren und anschließend über die Toolbar "VBA Makros" im Editor ausführen

VBA Code:

'writing the variable identification as curve name
'this is designed for projects where the curve name should be language switchable
'for adding the variable identification to the language table as keyword use the "Language Change Wizward" (category "Language Table")
Public Sub TrendCurveNameVarIdent()
Dim obFuncs As RtFunctions
Dim obFunc As RtFunction
Dim iFunc As Integer
Dim obPics As DynPictures
Dim obPic As DynPicture
Dim obVars As Variables
Dim obCurveVar As Variable
Dim iCurves As Integer
Dim iCurvesConf As Integer
Dim iCurveNamesModif As Integer
'create a object of the function collection
Set obVars = MyWorkspace.ActiveDocument.Variables

'create a object of the picture collection
Set obPics = MyWorkspace.ActiveDocument.DynPictures
'create a object of the function collection
Set obFuncs = MyWorkspace.ActiveDocument.RtFunctions

'loop through all functions
For iFunc = 0 To obFuncs.Count - 1
'create a object of the function
Set obFunc = obFuncs.Item(iFunc)
'check if the object could be created successfully
If Not obFunc Is Nothing Then
'check if the function is a pictureswitch function (tpPicture = 3)
If obFunc.Type = tpPicture Then
'get the linked picture
Set obPic = obPics.Item(obFunc.DynProperties("PictSwitch[0].Picture"))
'check if the linked picture exists
If Not obPic Is Nothing Then
'check if the picture is a ETM picture (5 = Extended trend)
If obPic.Type = 5 Then
'get the number of curves configured in the picture switch function
iCurvesConf = obFunc.DynProperties("PictFilter[0].Curve[-1]")
'loop through the curves
For iCurves = 0 To iCurvesConf - 1
'get the variable linked to this curve
Set obCurveVar = obVars.Item(obFunc.DynProperties("PictFilter[0].Curve[" & iCurves & "].VarInfo.VarName"))
'check if the linked variable exits
If Not obCurveVar Is Nothing Then
'check if a tagname has been configured
If Len(obCurveVar.Tagname) > 0 Then
'check if the curve name is already the variable identification
If StrComp(obCurveVar.Tagname, obFunc.DynProperties("PictFilter[0].Curve[" & iCurves & "].GraphName")) <> 0 Then
'write the variable identification to the curvename
obFunc.DynProperties("PictFilter[0].Curve[" & iCurves & "].GraphName") = obCurveVar.Tagname
iCurveNamesModif = iCurveNamesModif + 1
End If
End If
'release the created object
Set obCurveVar = Nothing
End If
Next iCurves
End If
'release the created object
Set obPic = Nothing
End If
End If
'release the created object
Set obFunc = Nothing
End If
Next iFunc

'release the created objects
Set obFuncs = Nothing
Set obPics = Nothing
Set obVars = Nothing

MsgBox "Curves modyfied: " & iCurveNamesModif
End Sub


This is a migrated post! Originally posted on 08.11.2010 by user herberto. Please be aware that information can be outdated.

    Disclaimer

    This document governs the use of our Community Forum. By registering and using the platform, you accept these conditions.

    The COPA-DATA Community Forum serves to encourage the exchange of information and experience about the zenon software between forum users respectively zenon users.

    Please mind that any published information on the Community Forum is the subjective opinion and view based on the experience and the level of knowledge of the author. COPA-DATA does not overtake any responsibility for the content and the accuracy of the shared information.

    Users of the Community Forum are encouraged to share only well-founded experiences and to point out any risks associated with the implementation of proposed solutions to problems. COPA-DATA at its absolute discretion, reserves the right to moderate the forum. In this connection COPA-DATA may remove any information containing false facts, potentially dangerous solutions, bad language or content that may insult, degrade or discriminate others. COPA-DATA may block a non-complying user from forum access if the user violated this provision.

    COPA-DATA reserves the right to change this document from time to time at own discretion.


    Ing. Punzenberger COPA-DATA GmbH
    Karolingerstraße 7b · 5020 Salzburg · Austria
    www.copadata.com