Showing results 1 to 4 of 4

Thread: Extend Trend Time Scale (vba code)

  1. #1
    Join Date
    16.12.2010
    Posts
    32

    Default Extend Trend Time Scale (vba code)

    Hi All

    I want to copy the small trend screen to large trend screen.

    by the way it does not work vba as follows.


    With zFunction
    myStr = "PictFilter[0].Curve[" & I & "]"
    theStr = "Curve[" & k & "]"


    .DynProperties(myStr & ".TimeFilter.ARVTime1") = zPicture.DynProperties(theStr & "TimeFilter.ARVTime1")
    .DynProperties(myStr & ".TimeFilter.ARVTime2") = zPicture.DynProperties(theStr & "TimeFilter.ARVTime2")


    so, I want to know vba code of Trend time scale. (X-axe time scale)

    Thanks

  2. #2
    Join Date
    16.12.2010
    Posts
    32

    Default Re: Extend Trend Time Scale (vba code)

    Hi All,

    customer ask me for seeing the large trend screen(pop-up) , after click the button on small trend screen.

    so, it means, curve, timefilter.. etc on trend screen are displayed into large trend screen by click.

    my vba cord is as follows:

    curve and other properties does work . but just timefilter.

    plz check a vba cord ^^

    thanks

    *************************************************
    Public Sub LeftClickDown_CopyScreen(obElem As Element)

    '################################################# #################################################'
    ' '
    ' This function is used to clear selected curve out of the trend '
    ' '
    '################################################# #################################################'

    Dim zPicture As DynPicture
    Dim zFilter As PictureFilter
    Dim zFunction As RtFunction
    Dim I As Integer
    Dim k As Integer
    Dim cnt As Integer
    Dim curStr As String
    Dim arrCur
    Dim myStr As String
    Dim theStr As String

    'create a object of the screen
    Set zPicture = thisProject.DynPictures.Item(myTrendScreenName)
    'create a object of the picturefilter
    Set zFilter = zPicture.PictureFilter
    'create a object of open function
    Set zFunction = thisProject.RtFunctions.Item("00_Open_Other_Trend")

    'filter in ETM
    With zFilter

    I = 0
    cnt = 0

    'search inactive curve in the ETM
    Do While .DynProperties("Curve[" & I & "].VarInfo.VarName") <> ""
    ' If Not .DynProperties("Curve[" & I & "].IsShow") Then
    ' cnt = cnt + 1
    ' Else
    'active curve variable name string
    curStr = curStr & "," & .DynProperties("Curve[" & I & "].VarInfo.VarName")
    ' End If

    I = I + 1
    cnt = I
    Loop

    End With


    'filter in function
    With zFunction

    'if exist inactived curve
    If cnt > 0 Then
    I = 0
    'clear all curves
    Do While .DynProperties("PictFilter[0].Curve[" & I & "].VarInfo.VarName") <> ""
    'clear one curve
    delOneCurve zFunction, I

    I = I + 1
    Loop

    'if exist active curve
    If curStr <> "" Then
    'curve number in function
    cnt = I
    'create array of active curve
    curStr = Mid(curStr, 2)
    arrCur = Split(curStr, ",")

    'create function property of active curve
    For I = 0 To UBound(arrCur)
    'curve does not exist -> create new curve
    If cnt <= I Then
    myStr = "PictFilter[0].Curve[" & I & "]"

    .CreateDynProperty ("PictFilter[0].Curve")
    .CreateDynProperty (myStr & ".VarInfo")
    .CreateDynProperty (myStr & ".YAxe")
    .CreateDynProperty (myStr & ".YAxe[0].Scale")
    .CreateDynProperty ("PictFilter[0].TimeAxe")
    End If

    k = 0
    'loop curves in the ETM
    Do While zFilter.DynProperties("Curve[" & k & "].VarInfo.VarName") <> ""
    'search variable in the ETM
    If arrCur(I) = zFilter.DynProperties("Curve[" & k & "].VarInfo.VarName") Then
    'assign ETM property -> function property
    myStr = "PictFilter[0].Curve[" & I & "]"
    theStr = "Curve[" & k & "]"

    .DynProperties(myStr & ".HasYAxis") = zFilter.DynProperties(theStr & ".HasYAxis")
    'adjust the exiting curves
    .DynProperties(myStr & ".GraphName") = zFilter.DynProperties(theStr & ".GraphName")
    .DynProperties(myStr & ".Titel") = zFilter.DynProperties(theStr & ".Titel")
    .DynProperties(myStr & ".IsShow") = zFilter.DynProperties(theStr & ".IsShow")
    .DynProperties(myStr & ".IsInterpolation") = zFilter.DynProperties(theStr & ".IsInterpolation")
    .DynProperties(myStr & ".Color") = zFilter.DynProperties(theStr & ".Color")
    .DynProperties(myStr & ".VarInfo.VarName") = zFilter.DynProperties(theStr & ".VarInfo.VarName")
    .DynProperties(myStr & ".VarInfo.Variable") = zFilter.DynProperties(theStr & ".VarInfo.Variable")
    .DynProperties(myStr & ".VarInfo.VarMaxValue") = zFilter.DynProperties(theStr & ".VarInfo.VarMaxValue")
    .DynProperties(myStr & ".VarInfo.VarMinValue") = zFilter.DynProperties(theStr & ".VarInfo.VarMinValue")
    .DynProperties(myStr & ".YAxe.IsAutoScale") = zFilter.DynProperties(theStr & ".YAxe.IsAutoScale")
    .DynProperties(myStr & ".YAxe.Scale.ScaleTop") = zFilter.DynProperties(theStr & ".YAxe.Scale.ScaleTop")
    .DynProperties(myStr & ".YAxe.Scale.ScaleBotton") = zFilter.DynProperties(theStr & ".YAxe.Scale.ScaleBotton")
    .DynProperties(myStr & ".YAxe.IsTitelLeftBotton") = zFilter.DynProperties(theStr & ".YAxe.IsTitelLeftBotton")
    .DynProperties(myStr & ".YAxe.FirstOrd") = zFilter.DynProperties(theStr & ".YAxe.FirstOrd")
    .DynProperties(myStr & ".YAxe.Color") = zFilter.DynProperties(theStr & ".YAxe.Color")
    .DynProperties(myStr & ".YAxe.DivCount") = zFilter.DynProperties(theStr & ".YAxe.DivCount")
    .DynProperties(myStr & ".YAxe.MainDiv") = zFilter.DynProperties(theStr & ".YAxe.MainDiv")
    .DynProperties(myStr & ".YAxe.IsYAutoScale") = zFilter.DynProperties(theStr & ".YAxe.IsYAutoScale")
    .DynProperties(myStr & ".YAxe.DivCount") = zFilter.DynProperties(theStr & ".YAxe.DivCount")
    .DynProperties(myStr & ".YAxe.MainDiv") = zFilter.DynProperties(theStr & ".YAxe.MainDiv")


    .DynProperties("PictFilter[0].TimeAxe[0].TimeFilter.ARVTime1") = zFilter.DynProperties("TimeAxe[0].TimeFilter.ARVTime1")
    .DynProperties("PictFilter[0].TimeAxe[0].TimeFilter.ARVTime2") = zFilter.DynProperties("TimeAxe[0].TimeFilter.ARVTime2")


    Exit Do
    End If

    k = k + 1
    Loop
    Next
    End If

    'execute the function
    .Start
    End If

    End With

    'release objects
    Set zFunction = Nothing
    Set zFilter = Nothing
    Set zPicture = Nothing
    End Sub

  3. #3
    Join Date
    15.09.2016
    Posts
    61

    Default Re: Extend Trend Time Scale (vba code)

    Hello,

    I want to do something in that way, too.

    But i only want to take the Time Filter of the actual pic to set the Filter in a Screen Switch Function.



    For Example, I have one Extendet Trend Screen and two Screen Switch Functions.

    I use the one Function to show Temperatures and the other to show Pressures.

    Now I want to switch from Temperature to Pressure and Back again without loosing the Values of my Time Filter.



    Here is my code:



    Public Sub LeftClickUp_Trend_RWM(obElem As Element)
    
    Dim MyPicFilter As PictureFilter
    Dim MyFct As RtFunction
    
    Set MyPicFilter = thisProject.DynPictures.Item(obElem.Parent.Parent.Name).PictureFilter
    
    Select Case (obElem.Name)
        Case "Temperature": thisProject.Variables.Item("ppArchive").Value = 1
        Case "Pressure": thisProject.Variables.Item("ppArchive").Value = 2
    End Select
    
    Select Case (thisProject.Variables.Item("ppArchive").Value)
        Case 1:     Set MyFct = thisProject.RtFunctions.Item("sscr_ar_TrendRWMTemperature")
        Case 2:     Set MyFct = thisProject.RtFunctions.Item("sscr_ar_TrendRWMPressure")
    End Select
    
    MyFct.DynProperties("PictFilter.TimeFilter.ARVTime1") = MyPicFilter.DynProperties("TimeFilter.ARVTime1")
    MyFct.DynProperties("PictFilter.TimeFilter.ARVTime2") = MyPicFilter.DynProperties("TimeFilter.ARVTime2")
    
    MyFct.Start
    
    obElem.LeftClickUp
    
    End Sub





    I use the same code to switch between Report Viewer Screens without Problems.



    I think I have the wrong DynProperties for a screen of the type Extended Trend.

    Can someone Help me with the right ones?
    Last edited by Florian L. : 21st June 2017 at 10:58

  4. #4
    Join Date
    15.09.2016
    Posts
    61

    Default Re: Extend Trend Time Scale (vba code)

    My function works with these DynProperties.

    MyFct.DynProperties("PictFilter[0].TimeAxe[0].TimeFilter.ARVTime1") = MyPicFilter.DynProperties("TimeAxe[0].TimeFilter.ARVTime1")
    MyFct.DynProperties("PictFilter[0].TimeAxe[0].TimeFilter.ARVTime2") = MyPicFilter.DynProperties("TimeAxe[0].TimeFilter.ARVTime2")


    Thank you gyu

Similar Threads

  1. trend element scale
    By hash84 in forum zenon Service Engine Supervisor
    Replies: 1
    Last Post: 17th September 2013, 15:27
  2. Replies: 6
    Last Post: 19th August 2013, 00:15
  3. Replies: 4
    Last Post: 22nd February 2012, 20:42
  4. Couldn't extend Runtime to 2monitors
    By nurul in forum zenon Service Engine Supervisor
    Replies: 5
    Last Post: 23rd June 2011, 23:56
  5. Select trend profile from VBA
    By mvj in forum VBA
    Replies: 5
    Last Post: 2nd December 2009, 09:46

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •