LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Sleepy_Engineer

Quick Drop Simple Math

Status: New

I use the following shortcuts in Quick Drop:

"+" - shortcut for "add"

"-" - shortcut for "subtract"

"*" - shortcut for "multiply"

"/" - shortcut for "divide"

 

And that got me thinking that what I would really like is to be able to type simple math equations and have Quick Drop generate said equations.

So if we typed "(*3+2)/(4+5.68)", Quick Drop would spit out the following:

simple math.png

 

-Carl Wecker

14 Comments
tst
Knight of NI Knight of NI
Knight of NI

I don't know if I would want this or not (I don't write these kinds of calculations too often), but you could do this today if you want to:

 

  1. The math node has code which does most of the heavy lifting (parsing formulas and converting them to LV code).
  2. You can write a QD keyboard shortcut which would call the relevant code from the math node on your search term and then paste the created code into the original VI.

I should probably also point out that you could use the formula node to input the text directly in the diagram, but it's a matter of personal preference whether you like that or not.


___________________
Try to take over the world!
SteenSchmidt
Trusted Enthusiast

While we're at plugs I will mention my own GPMath toolset if you need to specify expressions programmatically, a feature sorely lacking in LabVIEW (I mean it's there alright, represented by the Formula Parsing functions, but my toolset is much much faster and vastly more powerful):

 

Math_ParseEval.png

 

Or you could split up the parsing and evaluation steps:

 

Math_Parse_Eval.png

 

GPMath supports hundreds of functions, including stuff like user defined periodic functions, piece-wise defined functions etc.

 

Personally I wouldn't think it worth making a QD plugin for this (which you actually could make yourself, it's all documented).

 

Cheers,

Steen

CLA, CTA, CLED & LabVIEW Champion
jcarmody
Trusted Enthusiast

My first though was to convert Darin.K's Math Node into a QD plugin.  That'd be so cool.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

SteenSchmidt
Trusted Enthusiast

Except that's still a static formula entry from edit-time. This is already built into LabVIEW with the Formula Node.

 

/Steen

CLA, CTA, CLED & LabVIEW Champion
Sleepy_Engineer
Member

Interesting comments. The math node and the GPMath toolset both look incredible and I will definitely install and use. I haven't yet needed to add any math at run-time but am excited that the tool is already built to make it easier. And I had no idea that the math node existed. Pasting formulas from wikipedia and having it output the G-code is brilliant! And it sounds like pulling up the math node in QD, typing in the code, and having it output the G-code is pretty much what I was looking for.

 

I also don't use complicated math very often, but I do often need to multiply or divide by a constant and am always looking for a way to do things just a hair faster/easier (: It may be worth using the formula node for complicated static formula entry or GPMath for some complicated run-time math, but when I just want to lay down a few simple math nodes it would be nice to do it straight from QD. In other words, the impetus for my idea had little to do with good ways of converting equations into G-code or ways to insert/use equations in labVIEW, but how to get simple math equations onto my block diagram easier and more quickly. That being said, being made aware of the Math Node and GPMath Toolset definitely made the post worth it, and I plan to use them both (:

 

Thanks!

-Carl

 

 

tst
Knight of NI Knight of NI
Knight of NI

Just be aware that the math node code was written as an example, not necessarily as something robust and that the node itself is an XNode, which isn't officially supported and may cause problems (probably not, but you never know). This should not be an issue if you just generate the G code.

 

Although, looking at it now again, I see that Darin says there that he already has support for QD, so maybe you don't need to do anything other than install the plugin.


___________________
Try to take over the world!
Darin.K
Trusted Enthusiast

The more useful code is the ConvertMathToG.vi, it leaves out the XNode coolness and does the scripting work.  As often as I need it, I find that it is a nice addition to the Tools menu, haven't felt compelled to add it to QD.

 

I have the pieces to make this work, it would just take a bit of time and testing.  The parsing and scripting is done, and the version I have now is fairly robust.  I have also written code to put snippet code on the cursor so you can drop it in a controlled fashion (ie. you see the outline).  I would have to test this out a little bit more for unwanted side effects.

 

Oh, and if I want to do symbolic math dynamically I use SymPy, very nice.

X.
Trusted Enthusiast
Trusted Enthusiast

@SteenSchmidt: when and where will this toolset been released? I suppose that would be awesome for those of use who want to implement the ability for users to provide their own favorite fitting model, for instance.

SteenSchmidt
Trusted Enthusiast

@X: Well, the toolset is basically finished, and have been for a couple of months, but the sad part is that it might not be free Smiley Sad I haven't fully come to a decission yet on that, so...

 

I'm in the process of getting a GPower webpage up, should happen some time in this month, where more info can be found. But I won't use too much bandwidth here on this toolset if it ends up costing money. Free stuff, sure, but... It was only because it seemed to fit so well.

 

/Steen

CLA, CTA, CLED & LabVIEW Champion
X.
Trusted Enthusiast
Trusted Enthusiast

Keep us posted.