As soon as I tried to add another Y-Axis to my diagrams I got a catastrophic failure. After trial & error I could figure out that it only happened when I accessed the primary "YAxis" object before. Here is a minimum example to reproduce this error. It is taken from the HELP-pages, just added one line. !!! Attention: DIAdem needs to be restarted thereafter !!!
Dim oMy2DaxisSystem, oMyPosition, oMy2DCurve1, oMy2DCurve2, oMyAxis Call Data.Root.Clear() Call DataFileLoad("C:\Program Files (x86)\National Instruments\DIAdem 2012\Examples\Data\" & "Example_data.tdm","TDM","") Call Report.NewLayout() Set oMy2DaxisSystem = Report.ActiveSheet.Objects.Add(eReportObject2DAxisSystem,"My2DAxisSystem") Set oMyPosition = oMy2DAxisSystem.Position.ByCoordinate oMyPosition.X1 = 20 oMyPosition.Y1 = 20 oMyPosition.X2 = 80 oMyPosition.Y2 = 80 '--- added line starts Call oMy2DaxisSystem.YAxis.Label.Font.Color.SetPredefinedColor(ePredefinedColorBlack) '--- added line ends Set oMy2DCurve1 = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "MyFirstCurve") oMy2DCurve1.Shape.XChannel.Reference = "/" oMy2DCurve1.Shape.YChannel.Reference = "/" Set oMy2DCurve2 = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "MySecondCurve") oMy2DCurve2.Shape.XChannel.Reference = "/" oMy2DCurve2.Shape.YChannel.Reference = "/" Set oMyAxis = oMy2DaxisSystem.YAxisList.Add("SecondAxis") oMy2DCurve2.YAxisReference = "SecondAxis" Call Report.Refresh()
Can anyone explain why that happens and how it could be solved?
Which exact DIAdem version do you use?
I checked your script with "12.0.1f5436 Service Pack 1b" and it worked fine.
If you don't have the latest SP you can download it from ni.com. If you search for "diadem 2012 sp1b" you get a list for the different languages.
I am using 12.0.0f4911 right now.
Will try to update my version in due time and test again or maybe wait for the 2014 release which is hopefully coming soon.