← Back to team overview

kicad-developers team mailing list archive

Re: Converting KiCAD to metric units: The approach

 

On 06/22/2011 01:34 AM, Lorenzo Marcantonio wrote:
> On Wed, 22 Jun 2011, Vladimir Uryvaev wrote:
>
>> As I see, there's no more (or very little) activity on this task.
>>
>> I developed the approach on how to convert KiCAD to metric unit. This approach
>> is fully based on OOP.
>>
>> There are several stages on converting:
> CUT
>
> I completely disagree. This is too complex for what we want... in fact
> OOP most of the time only complicates life but that's IMHO:P
>
> In the past the best way do defeat the issue was agreed to be the common
> divider, something like 200nm or such. Just use it instead of the
> current decimil and fix the scaling factors in the conversions (which
> are mostly in the common/ code). Voilà, metric kicad with no rounding
> issues...

I still agree with Lorenzo, Alex, and the factors that led to this posting back
here:

  https://blueprints.launchpad.net/kicad/+spec/unit-system


which I personally asked Alex to do, just to get it documented.

Simply changing the internal unit to a new fixed quantum is the best path in my
opinion.  From there you only need 2 scaling factors to generate mils or your
most preferred metric unit.

Vladimir, I don't know if you are proposing working with alternate sets of
internal units.  If so, I think that is unnecessary and probably a difficult path.


> But IMHO it should be done *together* with the new file format so to
> have only one format conversion to do... i.e. traditional kicad in
> decimils and SWEET/sexp/whatever in nano units...

Regarding the file format issue, I see no reason why the current file formats
cannot be tweaked to support metric or imperial.  So I disagree with Lorenzo on
this.  No reason to wait.  I see a need for only two units in the file PCB formats:


1) Imperial.  The blueprint says 1/100th of a mil.  But I would argue adding a
decimal point to the numbers, and simply saving them as mils in files.  I do not
think we'd have to use exponents, simply numbers with decimal points.  Such as
70.378 (mils).  Exponents are not desirable.

(See below for why a decimal point is helpful in the files.)


2) Metric.  Somebody pick, if a decimal point is used in the number, it can even
be millimeters.


Each PCB file type can name which of the two units it is using (with perhaps a
third being what we have now).  On file loading, these numbers can be converted
to the 1 nanometer internal unit without error or any rounding, exactly.

On file saving, things are a little different.  Because you have such fine
granularity in the 1 nm internal unit, converting to say 1/100th of a mil *whole
number* cannot be done without some rounding.  To avoid the rounding on the
conversion in this direction, we can use a decimal point in the numbers saved
within the PCB files.  If this is done, then I see no problems with my plan,
somewhat modified from the blueprint.

Dick




Follow ups

References