The AF Msg Constructor Utility
When the “Send” Method Isn’t Enough
When sending a message to another actor using NI’s Actor Framework, most of the time you’d be interacting with the message class’ “Send” method. It provides a connector pane that matches the payload method’s and automatically bundles those inputs before enqueueing the message object on another actor’s enqueuer. But sometimes want to bundle information into a message class but not send it at the same time. What then?
Let’s take a look at the “Advanced” sub-palette for Actor Framework:
The VIs within the green outline (plus some others in other nested palettes) use the message object as the input to those VIs. If you wanted to populate those messages with data, you’d need to create accessors for every data parameter. If those parameters changed, you’d need to manually change or create new accessors - it’s a pain.
Introducing the “Zyah AF Msg Constructor” Utility
Instead of creating and modifying accessors for each message class, once you install the Zyah AF Msg Constructor VIP, you’ll see a new right-click menu option available on each message class within your LabVIEW project.
Once you click on “Create Construct Method” a new “Construct” method for that class will be created and automatically added to the message class.
This new VI will have the same connector pane inputs as the “Send” method but instead of adding the message to an actor’s enqueuer it will output the message object on a wire so that you can use it with the aforementioned Advanced AF method (or however else you’d like). If the connector pane of the payload method changes, just choose “Rescript Message with Constructor” from the right-click menu and both the “Send” and “Construct” methods of the message class will be updated. We hope this saves you some time and frustration!
Where to Get It
VIPM (VI package) - https://www.vipm.io/package/zyah_solutions_lib_zyah_af_msg_constructor/
GitLab (source) - https://gitlab.com/zyah-solutions/community-tools/zyah-af-msg-constructor