LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with labview scripting and waveform chart

I am new to Labview scripting and came across this problem when trying to script a vi containing a waveform chart.  I want gain access to the chart History Data property through a reference to the chart when scripting it.  For some reason it seems that Labview does not expose this property, although other chart properties are.  I have attached a sample vi that I hope illustrates this.  Any ideas?

0 Kudos
Message 1 of 13
(3,571 Views)

Your VI has a property node with the History property.  You can obviosly create such a node; so what's the problem?

0 Kudos
Message 2 of 13
(3,556 Views)

The History property in this example is attached to the chart in the main form.  I want to gain access to the History property for the chart in the scripted vi.  The only purpose of including this one here is to illistrate what it is that I am after.  If you try to create the History property for the scripted vi you will find that it is not listed.

0 Kudos
Message 3 of 13
(3,550 Views)

LabVIEW Scripting is an NI Labs product and therefore not officially supported using this forum (See Technical Support in the link).

 

Quoted:

Technical Support
Because this is an NI Labs product, NI does not support LabVIEW VI Scripting. All technical issues should be posted on the API Community:
https://forums.ni.com/t5/LabVIEW-APIs/ct-p/7006

Disclaimer
The Scripting API is subject to change between LabVIEW versions. NI makes no guarantees that any feature or behavior associated with the Scripting API will either exist, migrate automatically, or have a functionally equivalent behavior in different versions of LabVIEW.

 

So i am sorry that this feature you are looking for does not exist. On the other hand, i am wondering why you want to have this feature at all.... 

You can try setting the default value of the indicator. It should do what you are looking for.

NOTE: Setting large arrays as default will result in huge VI files and long loading/saving times....

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 13
(3,546 Views)

Thank you for your response.  What I really want to do is to be able to control the size of the History Data as well as set some other properties of the chart (such as Stacked?) dynamically.  Seeing as how the size of the History Data buffer (for one thing) is set before the VI is loaded I was hoping I could control it by scripting the control and then dynamically loading this VI into a sub panel at run time.  You mentioned "You can try setting the default value of the indicator".  I'm not sure how this is possible, at least not for the History Buffer size.  If you know of a technique please pass it along.

0 Kudos
Message 5 of 13
(3,536 Views)

So you can create a History property node in one VI (the main on), but not in a newly created VI?

0 Kudos
Message 6 of 13
(3,535 Views)

The problem is that a newly created chart does not have a data type, so cannot show a History because it does not know what type to expose.  This is indicated in the code by the fact that your newly created Chart is not a (strict) reference, but the reference from the front panel control is.  You should be able to solve this issue by either creating the chart using a strict reference or wiring a DBL to it after creation.  In either case, you will need a strict reference.  The easiest way to get this is with a dummy chart on the front panel of your scripting code.  Make sure you set the type of the dummy chart before use.

0 Kudos
Message 7 of 13
(3,531 Views)

When I run his code, I get a chart with a data type of Double, and the History property is readily available.  I really have no idea what his problem is.

0 Kudos
Message 8 of 13
(3,515 Views)

Thanks, this helps a lot, I think I now understand why this property was not being exposed.

0 Kudos
Message 9 of 13
(3,512 Views)

@Norbert_B wrote:

LabVIEW Scripting is an NI Labs product and therefore not officially supported using this forum (See Technical Support in the link).

 


I was under the impression (perhaps mistakenly) that since LV10 scripting is officially supported.  Not that one should expect much from that support since it is a bit outside the mainstream, but official nonetheless.

 

DFGray's solution is a pretty good one, you can use 'Create Object From Reference' to get a copy of the Dummy chart in the New VI.  Personally, I would probably create a .ctl file with the desired Chart and place it on the new VI.  My usual scripting workflow is to drop as many pre-made 'chunks' (controls or segments of code) and then use scripting to make the connections.  Trying to do too much from scratch is a quick way into a morass.

0 Kudos
Message 10 of 13
(3,514 Views)