About using mm as the default unit, other people may disagree, we should provide facilities to let people specify their unit.
On Friday, 16 de January de 2015 at 18:30, LordBlick wrote: > In response to a message written on 16.01.2015, 18:10, from Piers Titus van > der > Torren: > > About units: For me it was a big benefit to be able to just use any 2 > > element > > tuple like object for coordinates and sizes, and direct numbers for other > > values, and not having to use a conversion to internal units all the time. > > I do > > a lot of my calculations with numpy, so it makes things a lot easier if > > numpy > > arrays can be used directly. > > To me it makes most sense to use mm as default unit for the python API, and > > convert from inches to mm using a simple inch2mm function. > > > > Why not use KiCAD internal units ? > > I would hold internally the IUs, I agree. But that should only be internal, or accessible via .to_iu / .from_iu if we wanted… The user shouldn’t need to know what an IU is unless he really wants, for some reason. > Any necessary geometric calculation can be > implemented in compiled _pcbnew.so > Also we can look onto Cython… > > We may reuse any logic that it’s already provided by the pcbnew classes, and sometimes we can even extend them (if there is an evident bottleneck). > > > > Furthermore I put my script in a github repository, like Wayne suggested, I > > hope > > this leads to more organized experimenting, please clone and improve. It > > can be > > found at https://github.com/pierstitus/kicad-python > > > > LordBlick, thanks for another improvement to the layer conversion, it is > > much > > better to use the names that are used in the GUI ('F.Cu' instead of 'F_Cu'). > > > > As Jean-Pierre Charras wrote in thread nearly, board names for cooper layers > may > vary: > brd = pcbnew > pcb = brd.GetBoard() > >>> pcb.SetLayerName(0, 'Top') > True > >>> pcb.SetLayerName(31, 'Bottom') > True > >>> pcb.SetLayerName(32, 'BottomGlue') > False > >>> > > Hmm, that’s an important point for not referencing layers by names dynamically, (I was proposing that too) may be we should be defining a set of 32 constants for the layers we can reference and keep up to date with any ID changes at the C++ side. Although I suppose ID’s are not going to change for compatibility reasons. > > > It's committed to the github repo above. > Thank you for cooperate… :) > > Thank you Piers, it’s actually an awesome start point. > > -- > Best Regards, > LordBlick > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : [email protected] > (mailto:[email protected]) > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp > >
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

