Help, please, how I can delete a curve in ETM using VBA?
Hello,
Using this example I can create curves by VBA. But I don't know how to delete a curve. Help, please, how I can delete a curve using VBA?
[INDENT][INDENT]'Create Function for TREND - PICTURE
Sub CreateTrendFunction()
Dim zPIC As DynPicture
Dim zFCT As RtFunction
Dim i As Integer
Set zPIC = MyWorkspace.ActiveDocument.DynPictures.Item("TREND")
'Create new function
Set zFCT = MyWorkspace.ActiveDocument.RtFunctions.Create("picTREND", tpPicture)
'function settings...
With zFCT
.DynProperties("Picture") = zPIC.Name
i = .DynProperties("PictFilter[-1]")
If i = 0 Then .CreateDynProperty "PictFilter"
.DynProperties("PictFilter[0].RefreshRate") = 1
.DynProperties("PictFilter[0].Name") = "WIZARD TREND"
.DynProperties("PictFilter[0].IsArchive") = False
.DynProperties("PictFilter[0].IsXAxis") = False
'Add 3 CURVES
For i = 0 To 2
n = .DynProperties("PictFilter[0].Curve[-1]")
If n <= i Then
'create CURVE SubItem if needed
.CreateDynProperty ("PictFilter[0].Curve")
.CreateDynProperty ("PictFilter[0].Curve[" & i & "].VarInfo")
.CreateDynProperty ("PictFilter[0].Curve[" & i & "].YAxe")
.CreateDynProperty ("PictFilter[0].Curve[" & i & "].YAxe[0].Scale")
End If
'change curve settings
.DynProperties("PictFilter[0].Curve[" & i & "].GraphName") = "MyVariable_" & i
.DynProperties("PictFilter[0].Curve[" & i & "].HasYAxis") = True
.DynProperties("PictFilter[0].Curve[" & i & "].IsShow") = True
.DynProperties("PictFilter[0].Curve[" & i & "].IsInterpolation") = True
.DynProperties("PictFilter[0].Curve[" & i & "].VarInfo.VarName") = "MyVariable_" & i
.DynProperties("PictFilter[0].Curve[" & i & "].VarInfo.Channel") = "MyVariable_" & i
.DynProperties("PictFilter[0].Curve[" & i & "].VarInfo.Variable") = "MyVariable_" & i
.DynProperties("PictFilter[0].Curve[" & i & "].VarInfo.VarMaxValue") = 1000
.DynProperties("PictFilter[0].Curve[" & i & "].VarInfo.VarMinValue") = 0
.DynProperties("PictFilter[0].Curve[" & i & "].YAxe.IsAutoScale") = False
.DynProperties("PictFilter[0].Curve[" & i & "].YAxe.Color") = vbBlack
.DynProperties("PictFilter[0].Curve[" & i & "].YAxe.Scale.ScaleTop") = 1000
.DynProperties("PictFilter[0].Curve[" & i & "].YAxe.Scale.ScaleBotton") = 0
Next i
'filter settings (relative time 5 minutes)
.CreateDynProperty ("PictFilter[0].TimeAxe")
.DynProperties("PictFilter[0].TimeAxe.OldDiff") = 3600
.DynProperties("PictFilter[0].TimeAxe.TimeFilter.Options") = 65535
.DynProperties("PictFilter[0].TimeAxe.TimeFilter.ARVTime1") = CDate(25569.0451388889) '("01.01.1970 01:05:00")
.DynProperties("PictFilter[0].TimeAxe.TimeFilter.ARVTime2") = CDate(25569.0416666667) '("01.01.1970 01:00:00")
End With
End Sub
[/INDENT][/INDENT]
This is a migrated post! Originally posted on 13.01.2014 by user a-grigoriev. 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