DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I programmatically create a plot in Diadem?

Hi All

 

I have seen a couple of very old posts on this matter but they are not helpfull. after calculating my channels, I would like to programmatically plot them. I tried :

 

' Add a new 2D axis system (plot) to the active tab
Dim axisSystem
Set axisSystem = View.ActiveSheet.SheetObjs.Add("2D-Axis")

 

or

 

' Add a new 2D axis system (plot) to the active tab
Dim axisSystem
Set axisSystem = View.ActiveSheet.Areas(1).DisplayObj.Add("2D-Axis") 

 

and

 

' Add a new 2D axis system (plot) to the active tab
Dim axisSystem
Set axisSystem = View.ActiveSheet.SheetObjects.Add(e2DAxisSystem)

 

also I am not sure about the next lines :

 

' Add a curve to the axis system
Call axisSystem.Curves.AddY(channelName)

' Configure the curve appearance (optional)
axisSystem.Curves(1).Line.Color = RGB(255, 0, 0) ' Red color
axisSystem.Curves(1).Line.Width = 2 ' Line width

' Configure axis labels (optional)
axisSystem.Axes.X.Title.Text = "Frequency"
axisSystem.Axes.Y.Title.Text = "Power Spectral Density"

 

please someone write the whole process for Diadem 2017 and 2019? how it is done?

0 Kudos
Message 1 of 4
(350 Views)

Ok In the help this is given :

 

Eigenschaft: XChannelName für 2DCurve
Bestimmt den Namen des x-Kanals einer Kurve in einem 2D-Achsensystem von DIAdem-VIEW.

Object.XChannelName
Object 2DCurve
Objekt mit dieser Eigenschaft
Object.XChannelName String mit Schreib-/Lesezugriff

Das folgende Beispiel erstellt ein 2D-Achsensystem mit einer Kurve und gibt die Kanalnamen in einer Meldung aus:

Script kopieren

Dim oMyCurves, oMyCurve
View.Sheets(1).Areas(1).DisplayObjType = "CurveChart2D"
Set oMyCurves = View.Sheets(1).Areas(1).DisplayObj.Curves2D
Call oMyCurves.Add("[1]/[1]","[1]/[3]")
For Each oMyCurve in oMyCurves
Call MsgBoxDisp("X-channel: " & oMyCurve.XChannelName & vbCrLf & "Y-channel: " & oMyCurve.YChannelName)
Next

I tried it, and it can plot, but it shows only these numbers on the plot label, I mean, when you hover the mouse on the checked box with the curve color indicator, instead of seeing [1]/Time, you see only [1]

 

So I tried :

 

Dim oMyCurves, oMyCurve
View.Sheets(1).Areas(2).DisplayObjType = "CurveChart2D"
Set oMyCurves = View.Sheets(1).Areas(2).DisplayObj.Curves2D
Call oMyCurves.Add("[1]/Data.Root.ChannelGroups(1).Channels(1).Name","[1]/Data.Root.ChannelGroups(1).Channels(3).Name")

 

but it does not work, and despite this name label is assigned, no curve is plotted

0 Kudos
Message 2 of 4
(312 Views)

and how can I select the sheets by names instead of numbers??

0 Kudos
Message 3 of 4
(311 Views)

Hey.

 

Maybe it's not exactly what you're looking for, but: why do you need to create the report after calculation of the channels? Wouldn't it be easier to create it before (e.g. based on one test run) and then use it as a sample for following tests?

Adjustment of the scaling (ranges, ticks, notes etc.) is - in my opinion - much easier than complete new creation, particularly if you need to do it per code.

 

Whether this can be a way for you?..

 

Greetings,

Vassili

0 Kudos
Message 4 of 4
(252 Views)