LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Capture Events When Writing Block Diagrams

Hi All,

 

I am a PhD student working on a project that monitors how LabVIEW developers write code and when they make a change to code.

 

I need to capture events that occur when the developers are writing code in a block diagram, but the only event mechanism I can find is for the front panel when the VI is running. Anyone know if it is possible to capture events when a VI is not running or when writing a code via the Block Diagram? I want to have a plugin running the in background that can capture user events within LabVIEW as a background process.

 

Any suggestion or help is really appreciated!

 

Thanks

Saheed

0 Kudos
Message 1 of 14
(3,120 Views)

Brian may have more to add since he is THE expert when it comes to Xnodes and scripting.

 

Search for Lavag.org and look for info on XNodes.

 

Xnodes are similar to XControls in that they can run when the VI containing them is not running e.g. the VI is being edited. But unlike the XControl Xnodes live on the block diagram.

 

You will also have to get familiar with LV Scripting since that functionality will be involved before you are done.

 

Now as far as a plug-in that will let you spy of developers...

 

Not sure how you would do that aside from possibly developing an XNode that is wrapped up in an error cluster and you replace the error cluster that is built into LV.

 

Were you assigned this project or did you choose it?

 

I hope you PHD is not riding on you accomplishing this.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 14
(3,092 Views)

Well there are multiple solutions and they might depend on what kind of thing you want to monitor or how to react.  Yes an XNode is an option where the user interacts with a node and you can write code as it is interacted with.  If a user wires something up do something, is the kind of events you'll have.  Or if the user right clicks, or left clicks, or resizes etc.  XNodes are experimental, undocumented, and you lots of fun when they work.  I did a few presentations on them here, and here, and here is a tool I made for making XNodes.

 

Without knowing more I might suggest you go another route which is registering for events and monitoring user interactions.  This also involves undocumented, and experimental features of LabVIEW along with private methods.  But there are some good examples of this in action which work well.  Checkout the the improved JKI State Machine Editor which monitors user interactions and can react to objects selected on the block diagram.  I believe the source is available and open, if it isn't this is based on an older tool the CaseSelect.  A similar tool I use for helping with panes and splitters found here.  This works on front panel objects but most of the principals are the same with finding VI activation and then monitoring for item selection.

Message 3 of 14
(3,077 Views)

Thanks Ben. I would try to work around you suggestion and see if it works. Yes, I chose this project because I find it challenging and interesting. If it works, i expect it to cover a large chunk of my PhD. Otherwise, I have to find some alternative routes. Thanks

0 Kudos
Message 4 of 14
(3,070 Views)

Thanks Hooovahh, This looks really helpful.

0 Kudos
Message 5 of 14
(3,066 Views)

@Saheed wrote:

I am a PhD student working on a project that monitors how LabVIEW developers write code and when they make a change to code.


 

How about just a plain screen recorder external to LabVIEW?

0 Kudos
Message 6 of 14
(3,048 Views)

Thanks altenbach, but a screen recorder can't work. A video makes it more difficult for automated analysis and may require lots of human intervention. Secondly, the goal of the project is to aid a targeted set of developers write better LabVIEW code. Hence, I will still need a way to interact with a developer when he/she is writing Block Diagrams. Thanks.

0 Kudos
Message 7 of 14
(3,044 Views)

If you start this code running in parallel with development, you can poll to see how many objects exist on the block diagram of whatever the top-most VI is and how many objects are selected.  By checking each successive polling for changes and then logging those exact changes, you can get a pretty good idea of what is being done on the block diagram.

 

Adding code to parse the arrays of references to actually check what has changed (and to ensure that when the developer switches which diagram they are editing it doesn't log 1000 changes all at once) is left as an exercise for the reader.

Watch for changes.png

Message 8 of 14
(3,025 Views)

@Saheed wrote:

Hi All,

 

I am a PhD student working on a project that monitors how LabVIEW developers write code and when they make a change to code.

 


Maybe one of the scripting experts can chime in, because I am not one. But is there a way to access the "undo" list. LabVIEW keeps a history of actions in the undo list so you can undo them. If there is a way to tap into this list, then you can see what is changing.

 

mcduff

Message 9 of 14
(3,009 Views)

@mcduff wrote:

@Saheed wrote:

Hi All,

 

I am a PhD student working on a project that monitors how LabVIEW developers write code and when they make a change to code.

 


Maybe one of the scripting experts can chime in, because I am not one. But is there a way to access the "undo" list. LabVIEW keeps a history of actions in the undo list so you can undo them. If there is a way to tap into this list, then you can see what is changing.

 

mcduff


Undoing the Undo List!

 

That is enough of a contradiction to entertain me. I like it.

 

It is not my favorite contradiction but good enough for this thread.

 

 

Spoiler

From the KJV version of the Bible, I believe there is a line in 2 Kings that reads...

 

".. in the morning when they woke up, they were all dead."

 

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 10 of 14
(3,006 Views)