kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #16577
Re: more pythonic scripting API for pcbnew
And the version with default units:
https://github.com/KiCad/kicad-python/pull/7/files
Looks quite clean to me, and yet all the precision from native units is retained, plus
we can do things like:
>> p = Point((2**31-1) * nm, (-(2**31)+1) *nm)
>> p.nm
(2147483647.0, -2146483648.0)
>>> p=Point(1,2)
>>> p.inch
(0.03937007874015748, 0.07874015748031496)
>>> p=Point(1*inch, 1*inch)
>>> p.inch
(1.0, 1.0)
>>> p.mm
(25.4, 25.4)
>>> p.nm
(25400000.0, 25400000.0)
>>> p.rotate(90, around=(0,0))
>>> p
Point(-25.4, 25.4)
Miguel Ángel Ajo
On Sunday, 25 de January de 2015 at 03:03, Miguel Ángel Ajo wrote:
> A little experiment, with the suggested * mm / * inch notation.
>
> https://github.com/KiCad/kicad-python/pull/6/files [1]
>
> Look specially at the tests (last files).
>
> Feel free to comment over the code.
>
> If we could default to mm (my preferred) or inches, we could
> save a lot of code (specially to process by human brains
> reading python) while retaining all the precision.
>
>
> Best,
> Miguel Ángel Ajo
> [1] Note: 2 builds failed because I didn’t make the C++ “pcbnew” module for the tests.
>
>
> On Sunday, 25 de January de 2015 at 02:56, Tomasz Wlostowski wrote:
>
> > On 25.01.2015 02:50, Miguel Ángel Ajo wrote:
> > >
> > > I was just testing that.
> > >
> > > Python floats (in all architectures) are double, so the 52 bit fraction (11 bit exp) is always
> > > going to hold more information that the 32bits wxPoint /wxSize can hold.
> > >
> >
> >
> > Hi Miguel,
> >
> > Sorry, I'm a C/C++ guy, so float defaults for me to 32 bits ;) Doubles
> > look ok, although the decimal part will be anyway truncated on the way
> > from Python to C++ (if we decide to keep the nm as default unit)
> >
> > Cheers,
> > T.
> >
> >
> >
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx (mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx)
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
>
>
References
-
more pythonic scripting API for pcbnew
From: PTT, 2015-01-07
-
Re: more pythonic scripting API for pcbnew
From: LordBlick, 2015-01-07
-
Re: more pythonic scripting API for pcbnew
From: Adam Wolf, 2015-01-07
-
Re: more pythonic scripting API for pcbnew
From: LordBlick, 2015-01-15
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-15
-
Re: more pythonic scripting API for pcbnew
From: Brian Sidebotham, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: LordBlick, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: LordBlick, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Tomasz Wlostowski, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: LordBlick, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Piers Titus van der Torren, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: LordBlick, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-16
-
Re: more pythonic scripting API for pcbnew
From: Tomasz Wlostowski, 2015-01-24
-
Re: more pythonic scripting API for pcbnew
From: tiger12506, 2015-01-24
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-24
-
Re: more pythonic scripting API for pcbnew
From: Piers Titus van der Torren, 2015-01-25
-
Re: more pythonic scripting API for pcbnew
From: Tomasz Wlostowski, 2015-01-25
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-25
-
Re: more pythonic scripting API for pcbnew
From: Tomasz Wlostowski, 2015-01-25
-
Re: more pythonic scripting API for pcbnew
From: Miguel Ángel Ajo, 2015-01-25