如何透過LabVIEW從Sequence檔案中取得Step屬性

更新 Oct 28, 2022

環境

軟體

  • TestStand

我在找一種不需要打開TestStand,便可以從sequence檔案中取得step屬性的方法。我是否能使用LabVIEW來呼叫TestStand API進而達到此目的?

  1. 啟動NI TestStand並建立一個新的sequence檔案。
  • 新增一個Statement step
  • 將step重新命名為Test
  • Expression中加入Random(1,100)
  • 將檔案命名為Test.seq並儲存在C:\Test\
10.png
  1. 啟動LabVIEW並建立一個新VI。現在,您應該參考TestStand API Reference Help來實現下方的功能。
  2. 建立TestStand UI Application Manger的instance。
  • 使用ApplicationMgr.GetEngine方法建立TestStand Engine object
11.png
  1. 使用Engine.GetSequenceFileEx方法來載入儲存於C:\Test\Test.seq的檔案。
12.png
  1. 使用SequenceFile.GetSequence方法來存取MainSequence並將index的值設定為0
13.png
  1. 使用Sequence.AsPropertyObject方法來存取PropertyObject class中定義的屬性和方法。
14.png
  1. 使用PropertyObject.GetValString方法。
  • 使用lookup string Main["Test"].TS.PostExpr來取得Test step的Post-Expression
  • 將options的值設定為0
15.png
  1. 使用Engine.ReleaseSequenceFileEx方法釋放檔案並關閉所有reference。
16.png
  1. 此時,完整的VI將如下所示。
17.png

執行VI後,該VI將在GetValString的string indicator中顯示“Random(0,100)”。