LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Scripting Main Board

I have long list of questions for you (sorry) which is in part related to the Project Provider Framework, but advised to post to this community.

Is it possible to purposely break a library or VI using scripting without adding anything to the block diagram? When I say break, I mean the broken run arrow for all VIs that are part of the library/class: http://www.ni.com/getting-started/labview-basics/debug

For example the LV Class type has certain rules that will cause a break if they aren't adhered to. If a parent class has a method which is specified as "must be overridden" in a child class, and the child class does not override that method, the class blocks execution and lists the errors.

Is it possible to create similar functionality with new objects that have different rules? Or is this behavior hard coded into LabVIEW itself?

How does the Library decide it's broken? Does the project periodically check certain rules? Is it checked when something is modified? Are there any useful event's that can be hooked onto?

Also had a read through this, but couldn't find anything related: http://www.ni.com/tutorial/11472/en/

Many thanks



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 161 of 171
(3,228 Views)

Hello all,

I am working with LabVIEW 2015 for some of my projects and now I need to work with NI scripting but I need some help to start. As I just found, I know how to enable it and I have done it (tools->options->VI Server-> VI scripting)but I do not know how to open an editor to start coding.

0 Kudos
Message 162 of 171
(3,228 Views)

VI Scripting works just like writing a normal VI. What Scripting does is enabling you to programmatically create or modify VIs using special SubVIs, Properties and Methods. When browsing all VI or Control Properties or Methods after enabling VI Scripting in the LabVIEW options you will notice, that there are a bunch of menu entries that do not appear while Scripting is disabled.

Have a look at this introduction:

http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/scripting_property_method/

and its contained links to further documentation of VI Scripting.

If you could be more specific about what you want to achieve using Scripting more detailed help can be given.

0 Kudos
Message 163 of 171
(3,228 Views)

Thank you for your reply. I started with simple diagrams and now I just work with that to understend it. So Now I have a problem with while loop. How can I fine its termintion to connect to a button or constant by wiring? I mean, I started to write a code and now I want to connect while loop termination to a stop button. How can I find the termination reference and connect to a button?

0 Kudos
Message 164 of 171
(3,228 Views)

Try this:

TestVI.PNG

ScriptVI.PNG

I can't find a way to attach the actual code. If you need the code, please send me a private message with your email and I'll send it to you.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 165 of 171
(3,228 Views)

I implemented as your program but is has an error on the first "To More specific class" which is for Control Terminal as you see in the image. Do you have any idea?

Error.JPG

0 Kudos
Message 166 of 171
(3,228 Views)

It would appear that there were no controls found. Note that in my "test.vi" I had a simple while loop and a boolean control. The traverse for gobjects VI will find all instances of the specified class. I would guess that you have 0 matching objects. The error you are getting would align with not finding any control terminals on the block diagram. If you wish to confirm this, connect and indicator to the "# of refs" output. Make sure there is at least one control on the diagram of test.vi

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 167 of 171
(3,228 Views)

Ok, I added a control and also a while loop and now it works but I need to create all objects and structures by scripting so this method does not work for me. I guess I should do something else. I wrote another code which creates everything automatically as you see below. My very very basic question is: if I want to make everything by VI scripting, which method is suitable, your suggested program or the code I attached. I mean, for me it is important to know what kind of object and control should be used (in your code Traverse and To More Specific class in my code New VI and New Vi Object) or in the third method I make all objects by a code then I traverse and connect them.

First.JPGFirstBD.JPG

0 Kudos
Message 168 of 171
(3,228 Views)

I was simply trying to show you how to connect something to the conditional terminal. If you have programmatically created the while loop and the control,  simply use those references in place of traverse objects. If you need further help please post the code you have so far.

Charles

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 169 of 171
(3,228 Views)

Thank you for  your answer. Actually, I am trying to make a scripting VI and use FPGA and also FIFO DMA to transfer some special data from an FPGA board which is on the cRIO. The first question: Is there any object or a  class to add an FPGA instance and open it by scripting? Also the same question for FIFO DMA.

Thank you

0 Kudos
Message 170 of 171
(3,228 Views)