01-31-2017 06:13 AM
Hi,
I have ready made TDR file with report. I had called this report using picload and after that if I would like to add constant curve for example X=10 or Y=5 programmatically, I am not able to do so. Can anyone help me in solving this problem .
Regards,
X. Ignatius
Solved! Go to Solution.
01-31-2017 11:14 AM
Hello X. Ignatius,
The general rule in DIAdem is to add the report items graphically to a report in the REPORT editor, then load the TDR file with the items already embedded, which would include the line for the constant.
There is a way to add items programmatically as well, although it's not my first choice for modifying report layouts.
Here is some example code in the modern, object oriented interface:
Set Sheet = Report.ActiveSheet Set Graph = Sheet.Objects("2D-Axis1") Set Curve = Graph.Curves2D.Add(e2DShapeConstant, "ConstCurve") Curve.Shape.Settings.Line.Color.ColorIndex = eColorIndexBlue Curve.Shape.YConstant.Reference = "@@Data.GetChannel(""[1]/Speed"").Properties(""maximum"").Value@@" Call Report.Refresh
This code will work with the Example data set and the Example TDR file that are loaded by DIAdem as a default when you start DIAdem. You will have to adapt that to your layout, specifically the object names.
For completeness, here is the same code in the "old", non-object oriented interface in DIAdem:
Call GraphObjOpen("2D-Axis1") Call GraphObjNew("2D-Curve", "ConstCurveName") Call GraphObjOpen("ConstCurveName") D2CConstXName = "NOVALUE" D2CConstYName = "@@Str(ChnPropValGet(""[1]/Speed"",""maximum""), ""AutoAdj"")@@" D2CAxisPairNo = 1 D2CCurveType = "Constant" D2CurveColor = "blue" Call GraphObjClose("ConstCurveName") Call GraphObjClose("2D-Axis1") Call PicUpdate
We highly recommend using the new object oriented interface posted above this code, both things do the same.
One note about the PicLoad command. That command is part of the old REPORT interface, and will be obsoleted in a future version of DIAdem since it has been replaced by the object oriented REPORT interface some years back. Instead of PicLoad, you should use:
Call Report.LoadLayout(MyFolders(0)&"EXAMPLE.tdr")
Please let us know if this helps,
Otmar
02-01-2017 07:46 AM
Dear Otmar,
Thank you very much. It worked.
Regards,
X. Ignatius