VBS for exporting XY plot for one node

VBS for exporting XY plot for one node

rami.rouhana
Enthusiast Enthusiast
1,163 Views
3 Replies
Message 1 of 4

VBS for exporting XY plot for one node

rami.rouhana
Enthusiast
Enthusiast

I am recording a macro to export one node XY plot in txt form. That was very esay.

 

Now I am trying to edit the VB script so I can export XY plot for another node, and the code does not contain the Node number. In the macro I have exported node N12508 . The only data I have in the code is ID 1180.

 

How can I select a different node in the VB script ?

the purpose is to make a script that can export XY  plot for 10 or 20 nodes. (So recording again a macro for the other node is not the solution i am looking for.)

 

Here is the code of the Macro for exporting one node XY plot.

 

'%RunPerInstance
'@ DESCRIPTION
'@ Macro recorded by Synergy on 05-Nov-2015 at 11:46:20
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"
Set PlotManager = Synergy.PlotManager()
Set Plot = PlotManager.CreatePlotByDsID(1180, True)
Set Viewer = Synergy.Viewer()
Viewer.ShowPlot Plot
Set PlotManager = Synergy.PlotManager()
Set Viewer = Synergy.Viewer()
Set Plot = Viewer.ActivePlot()
Plot.SaveXYPlotCurveData "C:\Users\rouhana\Desktop\Pressure data for one node\Node N12508 XY Pressure.txt"

Everyday is a good day for science !
0 Likes
Accepted solutions (1)
1,164 Views
3 Replies
Replies (3)
Message 2 of 4

jinwang
Autodesk
Autodesk
Accepted solution

Node selection is not recorded in the script. 1180 is the result ID for pressure.

 

Add the following two lines after "Set Plot = Viewer.ActivePlot()"

 

Plot.SetXYPlotMaxNumberOfCurves 10
Plot.SetPlotNodesFromString "N1 N2 N3 N4 N5"

 

The first line is to set the max number of curves to 10 (max number allowed in one plot).

The second line is to specify nodes in the plot.

 

Message 3 of 4

rami.rouhana
Enthusiast
Enthusiast

Thank you, it worked perfectly.

 

I just watned to ask, where did you find that code ?

 

Is there a pdf file that lists those ?

 

Thank you

Everyday is a good day for science !
0 Likes
Message 4 of 4

mppkumar
Advisor
Advisor

Hi

 

Please refer the below image

 

class.png

 

 

Once you are in this page, you can refer the required classes & methods

 

 

Thanks
M P Pradeep Kumar


If my views / comments acceptable, provide "Kudos" as appreciation, if answers your query, please click the "Accept as Solution"