LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to inherit from Actor.lvclass?

Solved!
Go to solution

Hi all

 

I'm playing around with the Actor Framework. After studying the Evaporative Cooler example project I would like to do an absolute minimal example from scratch. That is I would like to open a blank project, manually add a few classes, make them inherit from Actor.lvclass and so on (e.g. not start from the Actor Framework project template).

The first problem I've run into (and not yet solved) is how to inherit from the Actor.lvclass?.

 

Both the Evaporative Cooler example project(ECEP) and the Actor Framework project template (AFPT) have some classes already inheriting from Actor.lvclass so new classes will get this inheritance option also. ECEP and AFPT therefor also have vi.lib -> Actor Framework.lvlib in their Dependencies.

 

But how do I get Actor Framework.lvlib in my Dependencies? I can not just drag C:\Program Files\National Instruments\LabVIEW 2012\vi.lib\ActorFramework\Actor Framework.lvlib to Dependencies in my Project Explorer.

I can however drag C:\Program Files\National Instruments\LabVIEW 2012\vi.lib\ActorFramework\Actor Framework.lvlib somewhere else in my Project Explorer (just like adding a VI to the project). This gives me the option to inherit from Actor.lvclass and if I remove Actor Framework.lvlib from my project again (after making a class inherit from it) it will be listed under dependencies. But I hope there is a better / cleaner way to to it.

 

I would also like this to work when I move the project to another computer with another labview installation path. Will my above approach make sure that Actor Framework.lvlib is always loaded from the vi.lib subfolder or is it now "hardcoded" to my current install path?

 

Best regards
Jonas CJ

 

 

0 Kudos
Message 1 of 6
(2,884 Views)
Solution
Accepted by topic author JonasCJ

You should read some documentation and tutorials on LVOOP, because that's the mechanism that's used. In this case, you need to have actor loaded in the project, so the easiest is to drop one of the framework VIs in a blank VI, then go into your class properties, go to the inheritance page and click the change button. The tree shows you the class loaded in the project, which is why you needed the first step for the first class. After that, the class is already loaded, because your other class inherits from it, so you don't need something calling it explicitly.

 

As for the path, vi.lib is a logical path, so it will work correctly when moving between computers and LV versions.


___________________
Try to take over the world!
Message 2 of 6
(2,875 Views)

Thank you for your reply tst.

I know LVOOP (from tutorial and NI course material). The only thing I didn't know was that you can only inherit from classes which are loaded in the current project.*

So bascially my method of 1) adding Actor Framework.lvlib to the project, 2) setting at least one class to inherit from Actor.lvclass and then 3) removing Actor Framework.lvlib from the project, is a legitimate way to to it? (It's almost the same as dropping an actor into an empty VI, it forces the classes to load).

 

And great that vi.lib is alread dynamically handled.

* I don't think they actually mention this in LVOOP texts. They usually just create a class and then another to inherit from the first and then they are conveniently loaded already.
Of course I could also see that doing nothing (e.g. just creating a class and going straight to the inheritance properties) was not enough to inherit from Actor.lvclass.

0 Kudos
Message 3 of 6
(2,872 Views)

When starting from scratch - instead of from templates - on any VI in your project, just drop "Data Communication -> Actor Framework -> Launch Actor". That will put AF in your dependencies. (Or, on a block diagram, type ctrl-space, then start typing "launch".)

0 Kudos
Message 4 of 6
(2,858 Views)

Thank your for your reply  Todd_Lesher.

Yours and tst's method (of dropping an Actor Framework vi, e.g. Launch Actor, on a vi) is easier and prettier than mine 🙂

0 Kudos
Message 5 of 6
(2,856 Views)

@JonasCJ wrote:

The only thing I didn't know was that you can only inherit from classes which are loaded in the current project.*


I wasn't actually consciously aware of this either. When you asked the question, I actually had to think "so wait, how do classes actually get to appear in the inheritance tree?" and I had to go to the dialog to verify that it really is classes already loaded in the project. There is certainly something to be said for adding a button to the dialog which will allow us to select a class from disk and if you add such an idea to the IE, I will vote for it (even though in practice it doesn't really bother me personally). In general, the whole inheritance setting mechanism could use some help and there are some ideas in the IE about how to improve it.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(2,851 Views)