← Back to team overview

kicad-developers team mailing list archive

Re: [RFC] Proof of concept of mathematical expression input for text fields.

 

On Sun, Aug 27, 2017 at 04:06:50PM -0400, David Novak wrote:
> On 8/27/2017 11:03 AM, Russell Oliver wrote:
> >Hi all,
> >
> >Attached is a patch that allows for the use of a mathematical expression
> >when editing the value field of components in Eeschema.
> >
> >If editing the value field and the entered string begins with an equals
> >sign "=" as you would when entering a formula into an Excel spreadsheet
> >cell, it is compiled and parsed when the Enter button is pressed while the
> >text entry is in focus.
> >
> >A valid expression is returned as a double value which is then printed
> >with a format to remove trailing zeroes. An invalid expression will not
> >change the text value.
> >
> >The expression parser is simple wrap of the C++ Mathematical Expression
> >Toolkit Library (ExprTk)  written Arash Partow and is under the MIT
> >licence [1].
> >
> >I think this provides a template for other numerical input fields within
> >Kicad.
> >
> >[1] http://www.partow.net/programming/exprtk/index.html
> >
> >Kind Regards
> >Russell
> >
> You might consider muparser.
> 
> David
> 

+1 muparser is already present in many distros:

apt-cache search muparser
libmuparser-dev - fast mathematical expressions parse library (development)
libmuparser-doc - fast mathematical expressions parser library (documentation)
libmuparser2v5 - fast mathematical expressions parser library (runtime)


-- 


Marco Ciampa

I know a joke about UDP, but you might not get it.

------------------------

 GNU/Linux User #78271
 FSFE fellow #364

------------------------



Follow ups

References