Discussion Groups

Simulation Moldflow Insight

Reply
Contributor
fukushige
Posts: 20
Registered: ‎01-19-2010
Accepted Solution

api macro to create xy-plot with node id

517 Views, 2 Replies
09-18-2012 05:13 PM

Hi, all

 

I'm troubling with the subjected api macro.

I want to create a XY-plot with known node ID.

Can anybody advise me which part is incorrect?

 

============================================================================

SetLocale("en-us")
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "Metric"
Set PlotManager = Synergy.PlotManager()
Set Plot = PlotManager.CreatePlotByDsID(1180, True)
Plot.SetXYPlotShowLegend True
Set Viewer = Synergy.Viewer()
Viewer.ShowPlot Plot
Set PlotManager = Synergy.PlotManager()
Set Plot = Viewer.ActivePlot()
Set Plot = EntList.SelectFromString "N20258"
Plot.SaveXYPlotCurveData "%MY_DOCUMENTS%\My ASMI 2013 Projects\test\output.txt"
Set PlotManager = Synergy.PlotManager()
Set Plot = PlotManager.FindPlotByName2("Pressure:XY Plot", "Pressure")
Set Viewer = Synergy.Viewer()
Viewer.HidePlot Plot

============================================================================

 

Best Regards,

Please use plain text.
Product Support
nordhb
Posts: 455
Registered: ‎03-23-2009

Re: api macro to create xy-plot with node id

09-28-2012 02:37 AM in reply to: fukushige

Hi,
please, see below.

Regards,
Berndt

'==============================================================
SetLocale("en-us")
Set Synergy = CreateObject("synergy.Synergy")
Synergy.SetUnits "Metric"
Set StudyDoc = Synergy.StudyDoc()
Set EntList = StudyDoc.CreateEntityList() '* create an empty entity list
Set PlotManager = Synergy.PlotManager()
Set Plot = PlotManager.CreatePlotByDsID(1180, True)
Plot.SetXYPlotShowLegend True
Set Viewer = Synergy.Viewer()
Set PlotManager = Synergy.PlotManager()
Set Plot = Viewer.ActivePlot()
Set PlotManager = Synergy.PlotManager()
Set Plot = PlotManager.FindPlotByName2("Pressure:XY Plot", "Pressure")
Set Viewer = Synergy.Viewer()
EntList.SelectFromString "N20258"  '* popoulate the entity list
Plot.AddXYPlotCurve(EntList)  '* plot the curve of entity
Viewer.ShowPlot Plot
'==============================================================



Berndt Nordh
Please use plain text.
Contributor
fukushige
Posts: 20
Registered: ‎01-19-2010

Re: api macro to create xy-plot with node id

09-28-2012 03:09 AM in reply to: fukushige

Dear Berndt-san

 

Thank you for your help!

It worked well.

 

Best Regards,

Shige

Please use plain text.