通过 API 可获得作为图的独立值的时间序列数据。这就是显示动画的方式。
此示例可执行以下任务:
在需要读取特定结果集或将数据放入新的结果集时可使用此示例。
'%RunPerInstance
'@
'@ DESCRIPTION
'@ Split Presssure Time Series Result into Individual Results.
'@ Recreate the Pressure Time Series Result
'@
'@ SYNTAX
'@ ReadingPressureData
'@
'@ PARAMETERS
'@ none
'@
'@ DEPENDENCIES/LIMITATIONS
'@ none
'@
'@ History
'@ Created DRA 9/8/2006
'@@
Option Explicit
SetLocale("en-us")
Dim SynergyGetter, Synergy
On Error Resume Next
Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
On Error GoTo 0
If (Not IsEmpty(SynergyGetter)) Then
Set Synergy = SynergyGetter.GetSASynergy
Else
Set Synergy = CreateObject("synergy.Synergy")
End If
Synergy.SetUnits "METRIC"
Dim PlotManager
Dim ResultID, Header, UserPlot, Indp, nodeID, Value, IndpValues, i, j ,Ave, Count, Str
ResultID = 1180
' Split Presssure Result into Individual Results.
Set PlotManager = Synergy.PlotManager()
Set IndpValues = Synergy.CreateDoubleArray()
PlotManager.GetIndpValues ResultID, IndpValues
' Display to Screen Average Pressure at interval through results
For i = 0 to IndpValues.size()-1 Step 5
Set PlotManager = Synergy.PlotManager()
Set Indp = Synergy.CreateDoubleArray()
Indp.AddDouble(IndpValues.val(i))
Set nodeID = Synergy.CreateIntegerArray()
Set Value = Synergy.CreateDoubleArray()
PlotManager.GetScalarData ResultID, Indp, nodeID, Value
Ave = 0.0
Count = 0.0
For j = 0 To nodeID.size - 1
Count = Count +1
Ave = Ave + Value.val(j)
Next
If Count > 0 Then
Ave = Ave / cdbl(count)
End If
Str = Str + "Time=" & CStr(IndpValues.val(i)) & " Average P =" & Ave &" MPa" & vbCRLF
Next
MsgBox Str
'Recreate current Time Series Pressure Result
Set UserPlot = PlotManager.CreateUserPlot()
Header = "New Pressure Time Series"
PlotManager.DeletePlotByName(Header)
UserPlot.SetName(Header)
UserPlot.SetDataType("NDDT")
UserPlot.SetDeptUnitName("MPa")
UserPlot.SetDeptName("Time")
UserPlot.SetVectorAsDisplacement(False)
For i = 0 to IndpValues.size-1
Set Indp = Synergy.CreateDoubleArray()
Indp.AddDouble(IndpValues.Val(i))
Set nodeID = Synergy.CreateIntegerArray()
Set Value = Synergy.CreateDoubleArray()
PlotManager.GetScalarData ResultID, Indp, nodeID, Value
UserPlot.AddScalarData IndpValues.Val(i), nodeID, Value
Next
UserPlot.Build()
MsgBox "Script Complete"
Wscript.Quit