DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem Script Editor

Hallo,

 

im Zuge einer wissenschaftlichen Arbeit benutze ich DIAdem um Messdaten auszuwerten. Zur Automatisierung dieser Auswertung würde ich gern ein Programm im Script Editor erstellen.

Da ich jedoch wenig Erfahrung mit der Erstellung eines solches Scripts habe und auch keine Bücher dazu finde, arbeite ich derzeit mit der Hilfe Funktion, mit der ich aber nur teilweise voran komme.

 

Ziel der Programmfunktion:

1) Messdaten sind im Dateiformat .dat gespeichert und sollen nach dem Start des Programms durch den Benutzer aus einem bestimmten Ordner von der Festplatte ausgewählt werden können.

Bis jetzt hab ich leider nur die Funktion über eine bestimmte Datei herausgefunden: 

 

Call DataFileLoad(MyFolders(0)&"Name.dat","","") '... DataFilename,FileImportFilter,ImportAction 

 

Das Importieren soll auch nach hinzufügen von neuen Messdaten noch möglich sein

 

2) Anschließend werden die eingelesenen Daten: Time 1, Wert 1, Time 2, Wert2, Time 3, Wert 3 formatiert, da die Zeit immer gleich ist.

Realisiert hab ich dies mit folgender Funktion

 

Dim i
i = 2
for i = 2 to 78
Call Data.Root.ChannelGroups(1).Channels.Remove("Time_" & i) 'Alle Zeiten nach Time_1 löschen
next

 

3) Diese Messdaten habe ich zur Auswertung in das View Fenster gezogen und mir so von jedem Wert, abhängig von der Zeit (Time 1) ein eigenes 2D Diagramm erstellen lassen.

 

Es soll jedoch automatisch jedes Diagramm in den Report exportiert werden und anschließend der Export auf eine Word Vorlage stattfinden, sodass jedes Diagramm nach einer bestimmten Anordnung auf dem Word Dokument erscheint.

 

Kann mir bitte jemand bei der Erstellung eines solchen Programms weiterhelfen?

0 Kudos
Message 1 of 10
(6,810 Views)

Hallo Eddy,

 

es gibt keine direkte Funktion 'in Word exportieren'.

 

Es gibt eine Funktion, die vom View-Modul ins Report-Modul exportiert. Die findest du in der Symbolleiste links neben den Synchronisationselementen.

 

Aus dem Report-Modul kannst du in verschieden Formate exportieren. Unter anderem Powerpoint. Dort kannst du eine Vorlage hinterlegen.

Wenn du in Word exportieren möchtest, bleibt dir nur der Weg über einen Bildexport.

 

Viele Grüße

 

 

 

0 Kudos
Message 2 of 10
(6,782 Views)

Danke für die Antwort. Ich werde den Export in eine Powerpoit Datei auch in betracht ziehen.

 

Zur Erstellung der Diagramme habe ich gedanklich dieses Programm geschrieben.

Es erstellt in Abhängigkeit der Anzahl von Messdaten gleich große Diagramme im View Fenster.

Funktioniert so jedoch leider noch nicht 🙂

Ist es denn überhaupt möglich wie in Zeile 5, 6 und 7 eine bereits deklarierte Variable durch eine andere Variable (in dem Fall eine Zahl, welche nach jedem Schritt um 1 steigen soll) zu definieren?

Wenn ja wie müssen "MyArea" und "DiagrNr" verknüpft werden?

 

 

1    dim DiagrAnz: DiagrAnz = GlobUsedChn
2        while DiagrAnz > 1
3            dim DiagrNr: DiagrNr = 1
4                while DiagrNr <= GlobUsedChn
5                    dim MyAreaDiagrNr: Set MyArea & "DiagrNr" = MyArea & ("DiagrNr"-1).SplitBottom("MyArea : & DiagrNr",(1-1/"DiagrAnz"))
6                    MyArea & "DiagrNr".DisplayObjType = "CurveChart2D"
7                    call MyArea & "DiagrNr".DisplayObj.Curves.Add(1,2)
8                    DiagrNr = DiagrNr + 1
9                wend
10          DiagrAnz = DiagrAnz - 1
11      wend

Danke

Grüße Eddy

0 Kudos
Message 3 of 10
(6,726 Views)

Hi Eddy,

 

I think if you have a large number of curves you want to view stacked on top of each other, I'd recommend instead putting all the curves in 1 VIEW area and using the built-in Y scaling option "n Systems [Linear]".  Still, if you really want separate Areas, one for each curve, for a group of XYYYYY channels, then this should do it for you:

 

Call View.ActiveSheet.Areas.RemoveAll()
Set Areas = View.ActiveSheet.Areas
Set Group = Data.Root.ActiveChannelGroup
Set LastArea = Areas(1)
jMax = Group.Channels.Count
XChRef = Group.Channels(1).GetReference(eRefTypeIndexName)
YChRef = Group.Channels(2).GetReference(eRefTypeIndexName)
Set LastArea = Areas(1)
LastArea.Name = ChnName(YChRef)
LastArea.DisplayObjType = "CurveChart2D"
Call LastArea.DisplayObj.Curves2D.Add(XChRef, YChRef)
FOR j = jMax TO 3 Step -1
  YChRef = Group.Channels(j).GetReference(eRefTypeIndexName)
  Set Area = LastArea.SplitBottom(ChnName(YChRef), (j-2)/(j-1))
  Area.DisplayObjType = "CurveChart2D"
  Call Area.DisplayObj.Curves2D.Add(XChRef, YChRef)
  Set LastArea = Area
NEXT ' Channel
Call WndShow("VIEW")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 4 of 10
(6,708 Views)

Hi,

 

thank you for the answer.

I think the best solution for my problem are only 4 curves/VIEW area.

After that i will export the VIEW Window to Powerpoint.

 

Can you help me to solve this Problem?

 

Thank you very much

 

0 Kudos
Message 5 of 10
(6,560 Views)

Hi eddy,

 

DIAdem VIEW does not export directly to Powerpoint, but you can export from DIAdem VIEW to DIAdem REPORT, and there you can use the "PPT" icon at the top of the panel to export to Powerpoint.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 6 of 10
(6,540 Views)

Hi Brad,

 

thank you! But I don´t find an PPT icon in Diadem 11.1

 

I still use the print function to exprot the Report in PDF. But there are some problems. The automatisation only works after i choose the printer "PDF Creator"

 

The other problem is related to the Report. If I work in the View Window and click on the botton "Export to Report" I get the same Curves in the Report Window. But when I use the automatic funktion of the script programm, I got wrong curves. How can it be that the function works wth an mouse click works and the same function programmed in the script editor (with the tech function), doesn´t work.

 

regards

Eddy

 

 

0 Kudos
Message 7 of 10
(6,463 Views)

Hi Eddy,

 

That's too bad, you missed the PPT button by only 1 version-- it released the next year with DIAdem 2010.  If I remember correctly, though, there was an example that shipped with DIAdem 11.1 that showed how to export to PPT programmatically.

 

Can you post the code you're using to send the VIEW graphs to REPORT?  I agree that it should behave the same as the interactive buttton.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 8 of 10
(6,445 Views)

Hi Brad,

 

PDF export  is ok, but it still works after choosing the "printer name"  "PDF Complete"

After save this data, the programm is creating a pdf

I use this function( from the teach function):

 

'Erstellung einer PDF Datei
'--------------------------------------------------------------
PrintLeftMarg    = 2
PrintTopMarg     = 2
PrintWidth       = 25
PrintOrient      = "landscape"
Call PicPrint("WinPrint")               '... PrintDevice

'---------------------------------------------------------------

Is there a function for creating pdf directly?

 

 

The function sending VIEW to REPORT is the following:

 

Dim MyFolders()
Call InitMyFolders
'-------------------------------------------------------------------------------
Sub InitMyFolders
  ReDim MyFolders(1)
  MyFolders(0)="C:\PROGRAM FILES (X86)\NATIONAL INSTRUMENTS\DIADEM 11.1\Resource\"
End Sub
'-------------------------------------------------------------------------------

Call ScriptStart(MyFolders(0)&"VWServices","VWTransViewRep",0) '... FileDlgName,VBSProcName,AutoObjLetOpen

The solution is not the same like doing it by hand and also it still works after the second time starting the program

 

Can you help?

Thank you

Eddy

0 Kudos
Message 9 of 10
(6,387 Views)

Hi Brad,

 

good news. The PDF export works great. I have only Problems with the transfer from VIEW to REPORT

 

regards

Eddy

0 Kudos
Message 10 of 10
(6,367 Views)