LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

QD Shortcut - Change to Compound Math

There is a fairly popular idea (and equally popular duplicate) on the Idea Exchange to conserve the operation when replacing an operator with the Compound Arithmetic Node.  This has annoyed me a little lately, so instead of getting mad I am getting even.  Here is a QD shortcut that will replace Add, Subtract, Multiply, Divide, And, Or, and Xor with the corresponding Compound Arithmetic Node.  Just select some functions, Ctrl-Space Ctrl-m and they will be replaced.

 

Usual Drill:  copy m.vi to the shortcut folder:  [LabVIEW 2009]\resource\dialog\QuickDrop\plugins

 

Change the letter if you'd like (in case I stomped an existing shortcut, but even if I did you should change that one Smiley Wink ). 

 

Added bonus:  RCF plug-in is attached as well.  Copy the llb to the RCF plug-in folder.  (The community VIPM insisted that the package should be 1+ Mb which seems a bit excessive, so I have gone the manual route).

 

As you may have seen, I have been prone to fiddling with math and scripting in LV.  This operation is part of my math cleanup tool which will automatically combine sprawling triangles into compact Compound Arithmetic Nodes.  Right now I only unleash it upon VIs I generate from scratch, if I figure out a way to tame the BD cleanup tool it will be quite useful on a general basis.

 

Enjoy.

Download All
Message 1 of 5
(3,287 Views)

Great idea!  I had the same one, and I had it a few months back when it was still kosher to add features to LV 2010... 😉

Message 2 of 5
(3,269 Views)

 


@Darren wrote:

Great idea!  I had the same one, and I had it a few months back when it was still kosher to add features to LV 2010... 😉


 

Ctrl-Space Compo Ctrl-P is a bit hidden, and it only seems to get addition and multiplication correct.  Subtract should (IMO) invert the second terminal, and division still gets replaced with addition.  Seems functional for the Boolean inputs.

 

I thought I would be deprecating this plugin when I upgraded, but I think it will be sticking around until LV11 at least.  At this point, the RCF plugin gets about 75% of the action anyways.

0 Kudos
Message 3 of 5
(3,201 Views)

I don't think I've ever replaced a subtract or a divide with compound arithmetic, just because those operations are so often binary and (obviously) ordered.  I guess you could replace a subtract with a compound add with a negated second input...but with divide, are you inserting a 1/x on the second input to a multiply compound arithmetic?  Certainly possible, but again, I question the utility.

0 Kudos
Message 4 of 5
(3,179 Views)

 


@Darren wrote:

I don't think I've ever replaced a subtract or a divide with compound arithmetic, just because those operations are so often binary and (obviously) ordered.  I guess you could replace a subtract with a compound add with a negated second input...but with divide, are you inserting a 1/x on the second input to a multiply compound arithmetic?  Certainly possible, but again, I question the utility.


 

As a member of the "Blue Team" I understand that you may feel pressure to use the triangles for math instead of the Compound Arithmetic.  Smiley Wink

 

Spoiler

Look at the LV logo if you do not get the joke

 

A great way to clean up many a BD is to replace a bunch of those triangles with Compound Arithmetic.  Or sometimes you add another variable as time goes by.  Either way, it is often the case that you will want  to replace a subtract or divide with CA.  They are no more or less binary operations then add and multiply.  Replacing divide should simply invert the second input (IMO) so that after replacement you have not changed the meaning of the code.  To me that is perfectly natural, even if it may not be used all that often (I use it quite often as I am slowly removing all triangles in favor of CA).

 

Utility is in the eye of the VI-holder.

 

0 Kudos
Message 5 of 5
(3,160 Views)