From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding curve after PICload command

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 3
(2,720 Views)
Solution
Accepted by topic author Igni

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

Otmar D. Foehner
0 Kudos
Message 2 of 3
(2,684 Views)

Dear Otmar,

 

Thank you very much. It worked.

 

Regards,

X. Ignatius

0 Kudos
Message 3 of 3
(2,669 Views)