← Back to team overview

kicad-developers team mailing list archive

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

 

Incidentally I have written a similar calculator last week and included it
in Pcbnew. I used the lemon parser generator
but exprtk might be a better choice. That way it should be easy to extend
the calculator with support for
variables without re-inventing the wheel.

I wanted to mimick the behaviour of Solidworks or CorelDraw; they do not
use '=' to introduce a formula.
The text is always interpreted as expression and constants may have units.

So if I want to move a FP from x:80.442 50mil to the right I write (or
append) "80.442+50mil".
A difference is that I use the OnTextFocusLost event to start the
evaluation and OnTextFocusGet to restore
the previous text just before the evaluation (ups, should have been 25mils).

The next step would be to integrate the evaluator in the footprint editor
as well. But it does not seem to be wise
right now ;).

 - Michael



On Mon, Aug 28, 2017 at 2:45 PM, hauptmech <hauptmech@xxxxxxxxx> wrote:

> or perhaps the python parser is already used in enough kicad builds that
> it should be used?
>
> On 28/08/17 19:56, Tomasz Wlostowski wrote:
>
>> On 27.08.2017 22:28, Marco Ciampa wrote:
>>
>>> +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)
>>>
>> ...And exprtk is a single header file, which compiles on any OS. There
>> is life outside Linux, too.
>>
>> - my 5 cents,
>> Tom
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References