08-31-2017 04:44 AM - edited 08-31-2017 04:46 AM
Hello All,
I use LabVIEW actor framework quite well in my projects.
Each time I create new actors I follow:
1. Create new override VIs : Actor Core.vi, Pre Launch Init.vi and Stop Core.vi
2. I do the standard modification please see RED marked in the attached picture for faster understanding, normally its just extra piece of code to stop actor.
I want to skip the step 2 and I wish to create those stop functionality automatically when follow step 1 for each actor I create so I can save some time 😉
is it good idea ? how to achieve this ? What changes need to do inside AF VIs ?
Thanks for help 🙂
Solved! Go to Solution.
08-31-2017 05:27 AM
I hope I got your question right...
I'd suggest creating your own class (AmitsActor) inheriting from the basic Actor Class. AmitsActor will implement the required code for Pre Launch Init, Actor Core
Your application Actors can inherit from AmitsActor et voila.Don't forget to use the Call Parent within the children
Caveat: when using ActorCore.vi with a visible FP, be careful which FP you are actually seeing.
08-31-2017 06:27 AM
An alternative might be to create a custom right click action with a label like "My VIs from Override" and have it create VIs from template.
I expect it would require some (at least for me) non-trivial scripting, but it would probably be possible. You could have the action disable if the Actor already had any of those VIs defined, or something like that if you wanted.
There was a presentation somewhere on creating custom right click actions - I'll try find a link.
08-31-2017 01:29 PM - edited 08-31-2017 01:32 PM
You can write a VI that does scripting to do all of that work.
[Edit] The eariler two posts don't actually solve your problem directly. I thought they did on first read, but the new ancestor class suggestion doesn't provide the extension points correctly and the right-click doesn't work for the project tree.
This VI ships with LabVIEW and is not password protected:
<labview>\resource\Framework\Providers\AddActor\Support\Create Child Actor.vi
It's the VI that gets called when you use the project and choose "New >> Actor". You could add code in there to pop up a new 2-button dialog to ask "Do you want to add event handling?" and then call scripting functions to do the work that you want to do.
Make sure you make a backup copy of the VI before you start. Also make sure that you back up your edited version because if you install a patch or service pack for LabVIEW, the file might get overwritten by a new installer.
08-31-2017 01:30 PM
@cbutcher wrote:
An alternative might be to create a custom right click action with a label like "My VIs from Override" and have it create VIs from template.
The right-click plug-ins only work for items on a block diagram, not for the project tree.
08-31-2017 08:27 PM
@AristosQueue (NI) wrote:
@cbutcher wrote:
An alternative might be to create a custom right click action with a label like "My VIs from Override" and have it create VIs from template.
The right-click plug-ins only work for items on a block diagram, not for the project tree.
Oops. Looks like I confused Augmented Right Click Menus (Youtube LAF video - Darren Nattinger) with the LabVIEW Project Provider (Forum Group), which is completely different and from what I can see, much more involved (and requires signing an INI file... probably not trivial either).
Sorry for the bad post. It was good to learn about the Create Child Actor VI though.
09-05-2017 09:22 AM
cbutcher wrote:Sorry for the bad post. It was good to learn about the Create Child Actor VI though.
No problem.
We tried to keep as many of the AF VIs open as possible. There's only a couple that are password protected where we took advantage of some unstable unreleased features of LabVIEW -- a couple tricks that work under very specific conditions but crash/corrupt in other contexts. Darren Nattinger and I have been on a campaign for about a decade to remove most of the passwords of LabVIEW. We make progress slowly. 🙂