← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix for 3D model offset

 

Oliver,

historically that was in inches for the 3D viewer...
Mario didn't change the file format to avoid breaking any previous releases I think, but managed to calculate correctly offset and displaying in the 3D viewer and exporter...

I don't know if aligning these parameters to mm inside the kicad_pcb file format would worth the breaking back compatibility of boards, considering that there are no errors in the 3D viewer nor in the exporters...

The only issue is that offset values, as pointed out from JP, are stored internally in inches, but in terms of user experience and in the 3D Gui everything is displayed and calculated fine right now...

Maurice



On 11/9/2017 11:18 PM, Oliver Walters wrote:
Maurice,

The error is that the offset is stored (file format) in inches but it should be mm.

Now that I know that the issue is in the file, I'm happy that the internals to KiCad were working well, it just didn't make sense for the assumption that units were in mm

On 10 Nov 2017 08:39, "easyw" <easyw@xxxxxxxxxxxx <mailto:easyw@xxxxxxxxxxxx>> wrote:

    Hi Oliver,

    could you please explain me if the proposed patch/rework is fixing
    an issue in 3d visualization and/or exporting or just changing the
    fact that ATM the offset is stored in inches, compared to other
    values in mm?

    I remember that Mario avoided to change the internal kicad_pcb
    format, but fixed the displaying of the offset calculating it
    correctly and displaying correctly the value in inches or
    millimeters, depending on the pcb settings both in the editor or the
    model ...

    I never noticed a wrong offset in VRML when exporting a board and
    parts using the offset...
    Nor I noticed a wrong offset in 3D viewer ...

    I could say nothing about the step exporter because I use mine and
    so I never tested the internal step exporter...

    I attached an image of two cubes, the red is 1x1x1mm and the blue is
    2x1x0.5mm.
    I applied an offset of 1x1x1 in mm to the second one, and the
    reciprocal positions are fine; moreover when I select the units to
    mm I get the offset displayed in mm, and if I set the unit in
    inches, the offset is displayed in inches...

    Maurice



    On 11/9/2017 9:09 PM, Oliver Walters wrote:

        I like 2) or 3) - I think that a major release is a good time to
        fix such a bug.

        Would you like me to add a patch implementing one of these
        options JP?

        On 9 Nov 2017 23:33, "Kristoffer Ödmark"
        <kristofferodmark90@xxxxxxxxx
        <mailto:kristofferodmark90@xxxxxxxxx>
        <mailto:kristofferodmark90@xxxxxxxxx
        <mailto:kristofferodmark90@xxxxxxxxx>>> wrote:

             Currently the footprints arent compatible anyway i guess, they
             support more than 4.07 footprints do. So option 2 is my
        preferred
             solution.

             On 11/09/2017 12:51 PM, jp charras wrote:

                 Le 09/11/2017 à 11:12, Kristoffer Ödmark a écrit :

                     My 2 cents is that the headaches of storing values
        in mixed
                     units, without indication of which unit
                     they are stored as is a huge drawback for
        readability of the
                     saved files and for maintainability.

                     Also I think the proposed new tag offset is a good
        idea,
                     since the libraries can be gradually
                     updated then. That the files cannot be opened by
        previous
                     versions is a minor problem, since the
                     files cannot be opened by kicad 4.07 anyway already.


                 In fact, footprint files can be opened by 4.07 version,
        as long
                 as they contain no round rect or
                 custom pads (should be most of files)


                     On 11/09/2017 12:55 AM, Wayne Stambaugh wrote:

                         This requires a file version bump and code that
        tests
                         for prior versions
                         before converting the units on read.  At that
        point, the
                         file will no
                         longer be compatible with prior version of
        KiCad.  I'm
                         not opposed to
                         this but I'm not sure it's worth the headaches
        it will
                         cause.

                         On 11/08/2017 03:33 PM, Oliver Walters wrote:

                             What about a controversial idea:

                             Read "at" dimensions as inches, but new
        files write
                             "offset" in mm.

                             This preserves read compatibility but fixes the
                             units issue going forward.

                 <...>

                 There are 3 different things related to the anchor
        coordinate 3D
                 shapes in Oliver's patch:

                 1 - coordinate units inside Kicad: they should be in
        internal units
                 (I do not remember if it is currently the case).
                 no problem.

                 2 - Display unit name in dialog: good enhancement.

                 3 - how to store this anchor coordinate in .kicad_pcb
        files.
                 There are 2 options:
                 opt 1 - use keyword "at" and store it in inches
        (current case).
                 Certainly annoying because all other
                 coordinates use mm, but this is not a major issue.
                 opt 2 - be able to read "at" (inches) and "offset" (or
        perhaps
                 "anchor") (in mm) and use offset as
                 new keyword: but it breaks compatibility with old
        (namely the
                 recent 4.07) kicad version.
                 opt 3 - same as 2, but stores "offset" (or "anchor")
        *only* if
                 it is not the default value (0 0 0).
                 AFAIK, the default value is the case of most (perhaps all)
                 footprint files in our official repo.

                 in case of option 2, the parser should be (obviously)
        able to
                 understand the keyword  "offset" (or
                 "anchor") to prepare the future.


             _______________________________________________
             Mailing list: https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>
             <https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>>
             Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
        <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
             <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx
        <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>>
             Unsubscribe : https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>
             <https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>>
             More help   : https://help.launchpad.net/ListHelp
        <https://help.launchpad.net/ListHelp>
             <https://help.launchpad.net/ListHelp
        <https://help.launchpad.net/ListHelp>>




        _______________________________________________
        Mailing list: https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>
        Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
        <mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx>
        Unsubscribe : https://launchpad.net/~kicad-developers
        <https://launchpad.net/~kicad-developers>
        More help   : https://help.launchpad.net/ListHelp
        <https://help.launchpad.net/ListHelp>




References