DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Waveform in Plugin Script

I am creating a plugin script for a custom data file format.  I want to create a waveform type for the signals.  However I cannot get the correct variable to do this.  I've tried the "waveform" channel property variable.  I've tried several other solutions.  However I cannot get it to become a waveform.
 
Is the solution to set a channel variable?  What is it?  What am I missing here?
0 Kudos
Message 1 of 2
(3,159 Views)

Hi jcbalding,

This is one of those things you never could come up with yourself, but once you have the function to copy from DataPlugin to DataPlugin, you stop thinking about entirely.  Here's the function:

Sub CreateWaveform(ChannelObj, X_start, X_delta, X_name, X_unit)
  ChannelObj.Properties.Add "wf_start_offset", X_start
  ChannelObj.Properties.Add "wf_increment",    X_delta
  ChannelObj.Properties.Add "wf_xname",        X_name
  ChannelObj.Properties.Add "wf_xunit_string", X_unit
  ChannelObj.Properties.Add "wf_samples",      CLng(1)
  ChannelObj.Properties.Add "wf_time_pref",    "relative"
  ChannelObj.Properties.Add "wf_start_time",   CreateTime(0,1,1,0,0,0,0,0,0)
End Sub ' CreateWaveform()

Note that DIAdem studiously avoids reading the "wf_start_time" property and always uses "relative" for the "wf_time_pref" property regardless of what value you assign above.  LabVIEW, however, will accept the actual values you assign to these two properties.  Note also that the "wf_start_time" property needs to be assigned either a DataPlugin time object (shown above) or a standard VBScript variant of subtype date/time.  The "wf_samples" property should be filled with the length of the waveform if you know it, but it causes no problems to leave it set to 1 (shown above) regardless of the actual length.  DIAdem will ignore this value, though LabVIEW users will thank you if you fill it correctly.

Regards,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

Message 2 of 2
(3,137 Views)