← Back to team overview

kicad-developers team mailing list archive

Re: more pythonic scripting API for pcbnew

 

On 15 January 2015 at 10:20, Miguel Ángel Ajo <majopela@xxxxxxxxxx> wrote:
> Yesterday I wrote a proposal for discussion here:
>
> http://pads.kicad-pcb.org/p/kicad-scripting-layer  (please write your name
> for your color
> using the top right icon, so what you write can be identified to you).
>
> I tried not to look too much into the original Piers proposal,
> to do a true top-down design (“how do I like to interact with kicad
> objects?”)
>
> In the end, it looks quite much like Piers proposal, just with the
> difference
> of Point/Size objects receiving the unit.
>
> I was trying to be as pythonic as possible avoiding set_/get_ methods,
> and instead rely on attributes and implicit setters/getters.
>
> The listed options are not exclusive, just different ways of doing the same.
>
> Please feel free to write about other use cases, or copy, paste, then modify
> my blocks
> to provide different possible interactions.
>
> Best,
> Miguel Ángel.
>
> Miguel Ángel Ajo

Hi Miguel,

I thought I'd add my thoughts here instead of changing what others have done.

I see that someone doesn't like the Point( 10, 10, unit=MM ) paradime
for creating a 2D vector.

Personally, I prefer that construct compared to the proposed point_mm(
10, 10 ) by quite a long way.

But, it's of course a pain to always use unit=MM. Generally we know
the units we're going to work with when we start with pcbnew scripting
so it would be good to be able to do something like
pcbnew.default_units = MM somewhere near the start of the script and
then all 2D vectors can be created without the unit=MM additional
argument, such as: Point( 10, 10 ) instead.

That would make a nicer interface in my opinion. I only had a chance
to have a quick look at it. Thanks for getting something together for
people to look at.

Best Regards,

Brian.


Follow ups

References